Exemple #1
0
func printBlock(p *fmt8.Printer, b *Block) {
	fmt.Fprintf(p, "%s:\n", b)
	p.Tab()
	for _, op := range b.ops {
		printOp(p, op)
	}
	printJump(p, b.jump)
	p.ShiftTab()
}
Exemple #2
0
func printBlockInsts(p *fmt8.Printer, b *Block) {
	fmt.Fprintf(p, "%s:\n", b)
	p.Tab()
	for _, inst := range b.insts {
		fmt.Fprintln(p, dasm8.LineStr(inst.inst))
	}
	if b.jumpInst != nil {
		fmt.Fprintln(p, dasm8.LineStr(b.jumpInst.inst))
	}
	p.ShiftTab()
}
Exemple #3
0
func printFunc(p *fmt8.Printer, f *Func) {
	fmt.Fprintf(p, "func %s {\n", f.name)
	p.Tab()

	printVars(p, "args", f.sig.args)
	printVars(p, "rets", f.sig.rets)
	printVars(p, "saved regs", f.savedRegs)
	printVars(p, "locals", f.locals)

	for b := f.prologue.next; b != f.epilogue; b = b.next {
		printBlock(p, b)
	}

	fmt.Fprintln(p, "----")

	for b := f.prologue.next; b != f.epilogue; b = b.next {
		printBlockInsts(p, b)
	}

	p.ShiftTab()
	fmt.Fprintln(p, "}")
}