String returns a nice human-readable version of this instruction.
()
| 44 | |
| 45 | // String returns a nice human-readable version of this instruction. |
| 46 | func (inst *instruction) String() string { |
| 47 | operands := make([]string, len(inst.operands)) |
| 48 | for i, op := range inst.operands { |
| 49 | operands[i] = op.String() |
| 50 | } |
| 51 | |
| 52 | name := "" |
| 53 | if int(inst.opcode) < len(instructionNameMap) { |
| 54 | name = instructionNameMap[inst.opcode] |
| 55 | } |
| 56 | if name == "" { |
| 57 | name = "<unknown op>" |
| 58 | } |
| 59 | return name + " " + strings.Join(operands, " ") |
| 60 | } |
| 61 | |
| 62 | // compileFunction compiles a given LLVM function to an easier to interpret |
| 63 | // version of the function. As far as possible, all operands are preprocessed so |