• Michael Matloob's avatar
    cmd/internal/ssa: utility functions to make Funcs · 310d09bf
    Michael Matloob authored
    Adds a more convenient way to define Funcs for testing.
    For instance,
    
      b1:
        v1 = Arg <mem> [.mem]
        Plain -> b2
      b2:
        Exit v1
      b3:
        v2 = Const <bool> [true]
        If v2 -> b3 b2
    
    can be defined as
    
    	 fun :=Fun("entry",
    		Bloc("entry",
    			Valu("mem", OpArg, TypeMem, ".mem"),
    			Goto("exit")),
    		Bloc("exit",
    			Exit("mem")),
    		Bloc("deadblock",
    			Valu("deadval", OpConst, TypeBool, true),
    			If("deadval", "deadblock", "exit")))
    
    Also add an Equiv function to test two Funcs for equivalence.
    
    Change-Id: If1633865aeefb8e765e772b6dad19250d93a413a
    Reviewed-on: https://go-review.googlesource.com/9992Reviewed-by: default avatarKeith Randall <khr@golang.org>
    310d09bf
deadcode_test.go 1.85 KB