mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.ssa] cmd/internal/gc: convert standard IR into SSA.
Hook into the current compiler to convert the existing
IR (after walk) into SSA. Any function ending in "_ssa"
will take this path. The resulting assembly is printed
and then discarded.
Use gc.Type directly in ssa instead of a wrapper for go types.
It makes the IR->SSA rewrite a lot simpler.
Only a few opcodes are implemented in this change. It is
enough to compile simple examples like
func f(p *int) int { return *p }
func g(a []int, i int) int { return a[i] }
Change-Id: I5e18841b752a83ca0519aa1b2d36ef02ce1de6f9
Reviewed-on: https://go-review.googlesource.com/8971
Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
parent
2f09b599c3
commit
d2fd43aa77
28 changed files with 1472 additions and 791 deletions
|
|
@ -27,7 +27,7 @@ func TestDeadLoop(t *testing.T) {
|
|||
addEdge(deadblock, exit)
|
||||
|
||||
// dead value in dead block
|
||||
deadval := deadblock.NewValue(OpConstBool, TypeBool, true)
|
||||
deadval := deadblock.NewValue(OpConst, TypeBool, true)
|
||||
deadblock.Control = deadval
|
||||
|
||||
CheckFunc(f)
|
||||
|
|
@ -55,7 +55,7 @@ func TestDeadValue(t *testing.T) {
|
|||
mem := entry.NewValue(OpArg, TypeMem, ".mem")
|
||||
exit.Control = mem
|
||||
|
||||
deadval := entry.NewValue(OpConstInt, TypeInt, 37)
|
||||
deadval := entry.NewValue(OpConst, TypeInt64, int64(37))
|
||||
|
||||
CheckFunc(f)
|
||||
Deadcode(f)
|
||||
|
|
@ -84,7 +84,7 @@ func TestNeverTaken(t *testing.T) {
|
|||
mem := entry.NewValue(OpArg, TypeMem, ".mem")
|
||||
exit.Control = mem
|
||||
|
||||
cond := entry.NewValue(OpConstBool, TypeBool, false)
|
||||
cond := entry.NewValue(OpConst, TypeBool, false)
|
||||
entry.Control = cond
|
||||
|
||||
CheckFunc(f)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue