diff --git a/src/asm/Assembler.go b/src/asm/Assembler.go index ea5e162..08d15ec 100644 --- a/src/asm/Assembler.go +++ b/src/asm/Assembler.go @@ -6,7 +6,6 @@ import ( "git.urbach.dev/cli/q/src/config" "git.urbach.dev/cli/q/src/data" "git.urbach.dev/cli/q/src/dll" - "git.urbach.dev/cli/q/src/token" ) // Assembler contains a list of instructions. @@ -166,7 +165,7 @@ func (a *Assembler) Skip(instr Instruction) bool { // Jump + Return is unnecessary jump, isJump := a.Last().(*Jump) - if isJump && jump.Condition == token.Invalid { + if isJump && jump.Condition == None { return true } diff --git a/src/asm/Assembler_test.go b/src/asm/Assembler_test.go index 93a068c..a996d1d 100644 --- a/src/asm/Assembler_test.go +++ b/src/asm/Assembler_test.go @@ -6,7 +6,6 @@ import ( "git.urbach.dev/cli/q/src/asm" "git.urbach.dev/cli/q/src/config" "git.urbach.dev/cli/q/src/cpu" - "git.urbach.dev/cli/q/src/token" "git.urbach.dev/go/assert" ) @@ -115,12 +114,16 @@ func TestAssembler(t *testing.T) { g.Append(&asm.Label{Name: "g"}) g.Append(&asm.Call{Label: "a"}) g.Append(&asm.Compare{Destination: 0, Source: 1}) - g.Append(&asm.Jump{Label: "a", Condition: token.Equal}) - g.Append(&asm.Jump{Label: "a", Condition: token.NotEqual}) - g.Append(&asm.Jump{Label: "a", Condition: token.Greater}) - g.Append(&asm.Jump{Label: "a", Condition: token.GreaterEqual}) - g.Append(&asm.Jump{Label: "a", Condition: token.Less}) - g.Append(&asm.Jump{Label: "a", Condition: token.LessEqual}) + g.Append(&asm.Jump{Label: "a", Condition: asm.Equal}) + g.Append(&asm.Jump{Label: "a", Condition: asm.NotEqual}) + g.Append(&asm.Jump{Label: "a", Condition: asm.Greater}) + g.Append(&asm.Jump{Label: "a", Condition: asm.GreaterEqual}) + g.Append(&asm.Jump{Label: "a", Condition: asm.Less}) + g.Append(&asm.Jump{Label: "a", Condition: asm.LessEqual}) + g.Append(&asm.Jump{Label: "a", Condition: asm.UnsignedGreater}) + g.Append(&asm.Jump{Label: "a", Condition: asm.UnsignedGreaterEqual}) + g.Append(&asm.Jump{Label: "a", Condition: asm.UnsignedLess}) + g.Append(&asm.Jump{Label: "a", Condition: asm.UnsignedLessEqual}) g.Append(&asm.Return{}) final := asm.Assembler{} diff --git a/src/asm/Condition.go b/src/asm/Condition.go new file mode 100644 index 0000000..fceb0ed --- /dev/null +++ b/src/asm/Condition.go @@ -0,0 +1,20 @@ +package asm + +// Condition represents the exact condition to use in jumps +// and conditional set instructions. It separates signed and +// unsigned comparisons. +type Condition uint8 + +const ( + None Condition = iota + Equal + NotEqual + Greater + GreaterEqual + Less + LessEqual + UnsignedGreater + UnsignedGreaterEqual + UnsignedLess + UnsignedLessEqual +) \ No newline at end of file diff --git a/src/asm/Instructions.go b/src/asm/Instructions.go index ee26b67..b9ac267 100644 --- a/src/asm/Instructions.go +++ b/src/asm/Instructions.go @@ -2,7 +2,6 @@ package asm import ( "git.urbach.dev/cli/q/src/cpu" - "git.urbach.dev/cli/q/src/token" ) type ( @@ -28,13 +27,13 @@ type ( CompareNumber rn ConditionalSet struct { Destination cpu.Register - Condition token.Kind + Condition Condition } Divide rrr DivideSigned rrr Jump struct { Label string - Condition token.Kind + Condition Condition } Label struct { Name string diff --git a/src/asm/compilerARM.go b/src/asm/compilerARM.go index 889e5f5..a546655 100644 --- a/src/asm/compilerARM.go +++ b/src/asm/compilerARM.go @@ -6,7 +6,6 @@ import ( "git.urbach.dev/cli/q/src/arm" "git.urbach.dev/cli/q/src/config" - "git.urbach.dev/cli/q/src/token" ) type compilerARM struct { @@ -94,25 +93,25 @@ func (c *compilerARM) Compile(instr Instruction) { c.append(code) case *ConditionalSet: switch instr.Condition { - case token.Equal: + case Equal: c.append(arm.SetIfEqual(instr.Destination)) - case token.NotEqual: + case NotEqual: c.append(arm.SetIfNotEqual(instr.Destination)) - case token.Greater: + case Greater: c.append(arm.SetIfGreater(instr.Destination)) - case token.GreaterEqual: + case GreaterEqual: c.append(arm.SetIfGreaterEqual(instr.Destination)) - case token.Less: + case Less: c.append(arm.SetIfLess(instr.Destination)) - case token.LessEqual: + case LessEqual: c.append(arm.SetIfLessEqual(instr.Destination)) - case token.UnsignedGreater: + case UnsignedGreater: c.append(arm.SetIfUnsignedGreater(instr.Destination)) - case token.UnsignedGreaterEqual: + case UnsignedGreaterEqual: c.append(arm.SetIfUnsignedGreaterEqual(instr.Destination)) - case token.UnsignedLess: + case UnsignedLess: c.append(arm.SetIfUnsignedLess(instr.Destination)) - case token.UnsignedLessEqual: + case UnsignedLessEqual: c.append(arm.SetIfUnsignedLessEqual(instr.Destination)) default: panic("unknown condition") @@ -147,25 +146,25 @@ func (c *compilerARM) Compile(instr Instruction) { ) switch instr.Condition { - case token.Equal: + case Equal: jump, encodable = arm.JumpIfEqual(offset) - case token.NotEqual: + case NotEqual: jump, encodable = arm.JumpIfNotEqual(offset) - case token.Greater: + case Greater: jump, encodable = arm.JumpIfGreater(offset) - case token.GreaterEqual: + case GreaterEqual: jump, encodable = arm.JumpIfGreaterEqual(offset) - case token.Less: + case Less: jump, encodable = arm.JumpIfLess(offset) - case token.LessEqual: + case LessEqual: jump, encodable = arm.JumpIfLessEqual(offset) - case token.UnsignedGreater: + case UnsignedGreater: jump, encodable = arm.JumpIfUnsignedGreater(offset) - case token.UnsignedGreaterEqual: + case UnsignedGreaterEqual: jump, encodable = arm.JumpIfUnsignedGreaterEqual(offset) - case token.UnsignedLess: + case UnsignedLess: jump, encodable = arm.JumpIfUnsignedLess(offset) - case token.UnsignedLessEqual: + case UnsignedLessEqual: jump, encodable = arm.JumpIfUnsignedLessEqual(offset) default: jump, encodable = arm.Jump(offset) diff --git a/src/asm/compilerX86.go b/src/asm/compilerX86.go index 9575082..9e2a8b7 100644 --- a/src/asm/compilerX86.go +++ b/src/asm/compilerX86.go @@ -7,7 +7,6 @@ import ( "git.urbach.dev/cli/q/src/cpu" "git.urbach.dev/cli/q/src/exe" - "git.urbach.dev/cli/q/src/token" "git.urbach.dev/cli/q/src/x86" ) @@ -93,25 +92,25 @@ func (c *compilerX86) Compile(instr Instruction) { } case *ConditionalSet: switch instr.Condition { - case token.Equal: + case Equal: c.code = x86.SetIfEqual(c.code, instr.Destination) - case token.NotEqual: + case NotEqual: c.code = x86.SetIfNotEqual(c.code, instr.Destination) - case token.Greater: + case Greater: c.code = x86.SetIfGreater(c.code, instr.Destination) - case token.GreaterEqual: + case GreaterEqual: c.code = x86.SetIfGreaterEqual(c.code, instr.Destination) - case token.Less: + case Less: c.code = x86.SetIfLess(c.code, instr.Destination) - case token.LessEqual: + case LessEqual: c.code = x86.SetIfLessEqual(c.code, instr.Destination) - case token.UnsignedGreater: + case UnsignedGreater: c.code = x86.SetIfUnsignedGreater(c.code, instr.Destination) - case token.UnsignedGreaterEqual: + case UnsignedGreaterEqual: c.code = x86.SetIfUnsignedGreaterEqual(c.code, instr.Destination) - case token.UnsignedLess: + case UnsignedLess: c.code = x86.SetIfUnsignedLess(c.code, instr.Destination) - case token.UnsignedLessEqual: + case UnsignedLessEqual: c.code = x86.SetIfUnsignedLessEqual(c.code, instr.Destination) default: panic("unknown condition") @@ -148,25 +147,25 @@ func (c *compilerX86) Compile(instr Instruction) { } case *Jump: switch instr.Condition { - case token.Equal: + case Equal: c.code = x86.Jump8IfEqual(c.code, 0x00) - case token.NotEqual: + case NotEqual: c.code = x86.Jump8IfNotEqual(c.code, 0x00) - case token.Greater: + case Greater: c.code = x86.Jump8IfGreater(c.code, 0x00) - case token.GreaterEqual: + case GreaterEqual: c.code = x86.Jump8IfGreaterEqual(c.code, 0x00) - case token.Less: + case Less: c.code = x86.Jump8IfLess(c.code, 0x00) - case token.LessEqual: + case LessEqual: c.code = x86.Jump8IfLessEqual(c.code, 0x00) - case token.UnsignedGreater: + case UnsignedGreater: c.code = x86.Jump8IfUnsignedGreater(c.code, 0x00) - case token.UnsignedGreaterEqual: + case UnsignedGreaterEqual: c.code = x86.Jump8IfUnsignedGreaterEqual(c.code, 0x00) - case token.UnsignedLess: + case UnsignedLess: c.code = x86.Jump8IfUnsignedLess(c.code, 0x00) - case token.UnsignedLessEqual: + case UnsignedLessEqual: c.code = x86.Jump8IfUnsignedLessEqual(c.code, 0x00) default: c.code = x86.Jump8(c.code, 0x00) diff --git a/src/codegen/conditionalSet.go b/src/codegen/conditionalSet.go index 69df801..dc113dd 100644 --- a/src/codegen/conditionalSet.go +++ b/src/codegen/conditionalSet.go @@ -8,7 +8,7 @@ import ( ) // conditionalSet sets the target register to 0 or 1 depending on the condition. -func (f *Function) conditionalSet(register cpu.Register, condition token.Kind) { +func (f *Function) conditionalSet(register cpu.Register, op token.Kind, unsigned bool) { if f.build.Arch == config.X86 { f.Assembler.Append(&asm.MoveNumber{ Destination: register, @@ -18,6 +18,6 @@ func (f *Function) conditionalSet(register cpu.Register, condition token.Kind) { f.Assembler.Append(&asm.ConditionalSet{ Destination: register, - Condition: condition, + Condition: tokenToCondition(op, unsigned), }) } \ No newline at end of file diff --git a/src/codegen/executeBinaryOp.go b/src/codegen/executeBinaryOp.go index a372698..05b63e6 100644 --- a/src/codegen/executeBinaryOp.go +++ b/src/codegen/executeBinaryOp.go @@ -21,7 +21,8 @@ func (f *Function) executeBinaryOp(step *Step, instr *ssa.BinaryOp) { } if step.Register != -1 { - f.conditionalSet(step.Register, instr.Op) + unsigned := types.IsUnsigned(left.Value.Type()) || types.IsUnsigned(right.Value.Type()) + f.conditionalSet(step.Register, instr.Op, unsigned) } return diff --git a/src/codegen/executeBranch.go b/src/codegen/executeBranch.go index 6a43596..bf0473f 100644 --- a/src/codegen/executeBranch.go +++ b/src/codegen/executeBranch.go @@ -5,6 +5,7 @@ import ( "git.urbach.dev/cli/q/src/config" "git.urbach.dev/cli/q/src/ssa" "git.urbach.dev/cli/q/src/token" + "git.urbach.dev/cli/q/src/types" "git.urbach.dev/cli/q/src/x86" ) @@ -12,9 +13,11 @@ func (f *Function) executeBranch(step *Step, instr *ssa.Branch) { var op token.Kind binaryOp, isBinaryOp := instr.Condition.(*ssa.BinaryOp) cas, isCas := instr.Condition.(*ssa.Cas) + unsigned := false if isBinaryOp && binaryOp.Op.IsComparison() { op = binaryOp.Op + unsigned = types.IsUnsigned(binaryOp.Left.Type()) || types.IsUnsigned(binaryOp.Right.Type()) } else if isCas { op = token.Equal @@ -39,12 +42,13 @@ func (f *Function) executeBranch(step *Step, instr *ssa.Branch) { f.insertPhiMoves(step) following := f.Steps[step.Index+1].Value.(*Label) + condition := tokenToCondition(op, unsigned) switch following.Name { case instr.Then.Label: - f.jumpIfFalse(op, instr.Else.Label) + f.jumpIfFalse(condition, instr.Else.Label) case instr.Else.Label: - f.jumpIfTrue(op, instr.Then.Label) + f.jumpIfTrue(condition, instr.Then.Label) default: panic("branch instruction must be followed by the 'then' or 'else' block") } diff --git a/src/codegen/executeUnaryOp.go b/src/codegen/executeUnaryOp.go index c966e45..daed940 100644 --- a/src/codegen/executeUnaryOp.go +++ b/src/codegen/executeUnaryOp.go @@ -22,7 +22,7 @@ func (f *Function) executeUnaryOp(step *Step, instr *ssa.UnaryOp) { Number: 0, }) - f.conditionalSet(step.Register, token.Equal) + f.conditionalSet(step.Register, token.Equal, false) default: panic("not implemented: " + instr.String()) diff --git a/src/codegen/jumpIfFalse.go b/src/codegen/jumpIfFalse.go index 6612db0..33ef732 100644 --- a/src/codegen/jumpIfFalse.go +++ b/src/codegen/jumpIfFalse.go @@ -2,31 +2,30 @@ package codegen import ( "git.urbach.dev/cli/q/src/asm" - "git.urbach.dev/cli/q/src/token" ) // jumpIfFalse jumps to the label if the previous comparison was false. -func (f *Function) jumpIfFalse(operator token.Kind, label string) { - switch operator { - case token.Equal: - f.Assembler.Append(&asm.Jump{Label: label, Condition: token.NotEqual}) - case token.NotEqual: - f.Assembler.Append(&asm.Jump{Label: label, Condition: token.Equal}) - case token.Greater: - f.Assembler.Append(&asm.Jump{Label: label, Condition: token.LessEqual}) - case token.GreaterEqual: - f.Assembler.Append(&asm.Jump{Label: label, Condition: token.Less}) - case token.Less: - f.Assembler.Append(&asm.Jump{Label: label, Condition: token.GreaterEqual}) - case token.LessEqual: - f.Assembler.Append(&asm.Jump{Label: label, Condition: token.Greater}) - case token.UnsignedGreater: - f.Assembler.Append(&asm.Jump{Label: label, Condition: token.UnsignedLessEqual}) - case token.UnsignedGreaterEqual: - f.Assembler.Append(&asm.Jump{Label: label, Condition: token.UnsignedLess}) - case token.UnsignedLess: - f.Assembler.Append(&asm.Jump{Label: label, Condition: token.UnsignedGreaterEqual}) - case token.UnsignedLessEqual: - f.Assembler.Append(&asm.Jump{Label: label, Condition: token.UnsignedGreater}) +func (f *Function) jumpIfFalse(condition asm.Condition, label string) { + switch condition { + case asm.Equal: + f.Assembler.Append(&asm.Jump{Label: label, Condition: asm.NotEqual}) + case asm.NotEqual: + f.Assembler.Append(&asm.Jump{Label: label, Condition: asm.Equal}) + case asm.Greater: + f.Assembler.Append(&asm.Jump{Label: label, Condition: asm.LessEqual}) + case asm.GreaterEqual: + f.Assembler.Append(&asm.Jump{Label: label, Condition: asm.Less}) + case asm.Less: + f.Assembler.Append(&asm.Jump{Label: label, Condition: asm.GreaterEqual}) + case asm.LessEqual: + f.Assembler.Append(&asm.Jump{Label: label, Condition: asm.Greater}) + case asm.UnsignedGreater: + f.Assembler.Append(&asm.Jump{Label: label, Condition: asm.UnsignedLessEqual}) + case asm.UnsignedGreaterEqual: + f.Assembler.Append(&asm.Jump{Label: label, Condition: asm.UnsignedLess}) + case asm.UnsignedLess: + f.Assembler.Append(&asm.Jump{Label: label, Condition: asm.UnsignedGreaterEqual}) + case asm.UnsignedLessEqual: + f.Assembler.Append(&asm.Jump{Label: label, Condition: asm.UnsignedGreater}) } } \ No newline at end of file diff --git a/src/codegen/jumpIfTrue.go b/src/codegen/jumpIfTrue.go index e5268a6..2d56dd0 100644 --- a/src/codegen/jumpIfTrue.go +++ b/src/codegen/jumpIfTrue.go @@ -2,10 +2,9 @@ package codegen import ( "git.urbach.dev/cli/q/src/asm" - "git.urbach.dev/cli/q/src/token" ) // jumpIfTrue jumps to the label if the previous comparison was true. -func (f *Function) jumpIfTrue(operator token.Kind, label string) { - f.Assembler.Append(&asm.Jump{Label: label, Condition: operator}) +func (f *Function) jumpIfTrue(condition asm.Condition, label string) { + f.Assembler.Append(&asm.Jump{Label: label, Condition: condition}) } \ No newline at end of file diff --git a/src/codegen/tokenToCondition.go b/src/codegen/tokenToCondition.go new file mode 100644 index 0000000..c12789b --- /dev/null +++ b/src/codegen/tokenToCondition.go @@ -0,0 +1,43 @@ +package codegen + +import ( + "git.urbach.dev/cli/q/src/asm" + "git.urbach.dev/cli/q/src/token" +) + +func tokenToCondition(cond token.Kind, unsigned bool) asm.Condition { + switch cond { + case token.Invalid: + return asm.None + case token.Equal: + return asm.Equal + case token.NotEqual: + return asm.NotEqual + case token.Greater: + if unsigned { + return asm.UnsignedGreater + } + + return asm.Greater + case token.GreaterEqual: + if unsigned { + return asm.UnsignedGreaterEqual + } + + return asm.GreaterEqual + case token.Less: + if unsigned { + return asm.UnsignedLess + } + + return asm.Less + case token.LessEqual: + if unsigned { + return asm.UnsignedLessEqual + } + + return asm.LessEqual + default: + panic("unknown condition") + } +} \ No newline at end of file diff --git a/src/core/evaluateBinary.go b/src/core/evaluateBinary.go index 4333b53..8b80679 100644 --- a/src/core/evaluateBinary.go +++ b/src/core/evaluateBinary.go @@ -76,19 +76,6 @@ func (f *Function) evaluateBinary(expr *expression.Expression) (ssa.Value, error } if v.Op.IsComparison() { - if types.IsUnsigned(leftValue.Type()) || types.IsUnsigned(rightValue.Type()) { - switch v.Op { - case token.Greater: - v.Op = token.UnsignedGreater - case token.GreaterEqual: - v.Op = token.UnsignedGreaterEqual - case token.Less: - v.Op = token.UnsignedLess - case token.LessEqual: - v.Op = token.UnsignedLessEqual - } - } - f.Block().Append(v) return v, nil } diff --git a/src/core/lintBinaryOp.go b/src/core/lintBinaryOp.go index 0ac3963..4e903e6 100644 --- a/src/core/lintBinaryOp.go +++ b/src/core/lintBinaryOp.go @@ -122,17 +122,17 @@ func (f *Function) lintBinaryOp(binOp *ssa.BinaryOp) error { switch { case rightInt.Int == 0: switch binOp.Op { - case token.UnsignedLess: + case token.Less: return errors.New(AlwaysFalse, f.File, binOp.Source) - case token.UnsignedGreaterEqual: + case token.GreaterEqual: return errors.New(AlwaysTrue, f.File, binOp.Source) } case rightInt.Int < 0 && strings.HasPrefix(rightInt.StringFrom(f.File.Bytes), "-"): switch binOp.Op { - case token.Equal, token.UnsignedLessEqual, token.UnsignedLess: + case token.Equal, token.LessEqual, token.Less: return errors.New(AlwaysFalse, f.File, binOp.Source) - case token.NotEqual, token.UnsignedGreaterEqual, token.UnsignedGreater: + case token.NotEqual, token.GreaterEqual, token.Greater: return errors.New(AlwaysTrue, f.File, binOp.Source) } } @@ -146,17 +146,17 @@ func (f *Function) lintBinaryOp(binOp *ssa.BinaryOp) error { switch { case leftInt.Int == 0: switch binOp.Op { - case token.UnsignedGreater: + case token.Greater: return errors.New(AlwaysFalse, f.File, binOp.Source) - case token.UnsignedLessEqual: + case token.LessEqual: return errors.New(AlwaysTrue, f.File, binOp.Source) } case leftInt.Int < 0 && strings.HasPrefix(leftInt.StringFrom(f.File.Bytes), "-"): switch binOp.Op { - case token.Equal, token.UnsignedGreaterEqual, token.UnsignedGreater: + case token.Equal, token.GreaterEqual, token.Greater: return errors.New(AlwaysFalse, f.File, binOp.Source) - case token.NotEqual, token.UnsignedLessEqual, token.UnsignedLess: + case token.NotEqual, token.LessEqual, token.Less: return errors.New(AlwaysTrue, f.File, binOp.Source) } } diff --git a/src/token/Kind.go b/src/token/Kind.go index 05471ce..a7e6837 100644 --- a/src/token/Kind.go +++ b/src/token/Kind.go @@ -62,10 +62,6 @@ const ( Greater // > LessEqual // <= GreaterEqual // >= - UnsignedLess // unsigned < - UnsignedGreater // unsigned > - UnsignedLessEqual // unsigned <= - UnsignedGreaterEqual // unsigned >= ___END_COMPARISONS___ // ___UNARY___ // Not // ! (unary) @@ -200,13 +196,13 @@ func (k Kind) String() string { return "^" case Or: return "|" - case Greater, UnsignedGreater: + case Greater: return ">" - case Less, UnsignedLess: + case Less: return "<" - case GreaterEqual, UnsignedGreaterEqual: + case GreaterEqual: return ">=" - case LessEqual, UnsignedLessEqual: + case LessEqual: return "<=" case Equal: return "==" diff --git a/src/verbose/ASM.go b/src/verbose/ASM.go index a9abd8c..01de079 100644 --- a/src/verbose/ASM.go +++ b/src/verbose/ASM.go @@ -7,7 +7,6 @@ import ( "git.urbach.dev/cli/q/src/asm" "git.urbach.dev/cli/q/src/core" "git.urbach.dev/cli/q/src/ssa" - "git.urbach.dev/cli/q/src/token" "git.urbach.dev/go/color/ansi" ) @@ -88,28 +87,28 @@ func printAssembly(f *core.Function) { imm.Print(instr.Number) case *asm.ConditionalSet: switch instr.Condition { - case token.Equal: + case asm.Equal: mnemonic.Print(" set if == ") - case token.NotEqual: + case asm.NotEqual: mnemonic.Print(" set if != ") - case token.Greater: + case asm.Greater: mnemonic.Print(" set if.s > ") - case token.GreaterEqual: + case asm.GreaterEqual: mnemonic.Print(" set if.s >= ") - case token.Less: + case asm.Less: mnemonic.Print(" set if.s < ") - case token.LessEqual: + case asm.LessEqual: mnemonic.Print(" set if.s <= ") - case token.UnsignedGreater: + case asm.UnsignedGreater: mnemonic.Print(" set if.u > ") - case token.UnsignedGreaterEqual: + case asm.UnsignedGreaterEqual: mnemonic.Print(" set if.u >= ") - case token.UnsignedLess: + case asm.UnsignedLess: mnemonic.Print(" set if.u < ") - case token.UnsignedLessEqual: + case asm.UnsignedLessEqual: mnemonic.Print(" set if.u <= ") default: - ansi.Red.Print(" set: unknown condition: " + instr.Condition.String() + " ") + ansi.Red.Print(" set: unknown condition: " + fmt.Sprint(instr.Condition) + " ") } register.Print(instr.Destination) @@ -129,30 +128,30 @@ func printAssembly(f *core.Function) { register.Print(instr.Operand) case *asm.Jump: switch instr.Condition { - case token.Equal: + case asm.Equal: mnemonic.Print(" jump if == ") - case token.NotEqual: + case asm.NotEqual: mnemonic.Print(" jump if != ") - case token.Greater: + case asm.Greater: mnemonic.Print(" jump if.s > ") - case token.GreaterEqual: + case asm.GreaterEqual: mnemonic.Print(" jump if.s >= ") - case token.Less: + case asm.Less: mnemonic.Print(" jump if.s < ") - case token.LessEqual: + case asm.LessEqual: mnemonic.Print(" jump if.s <= ") - case token.UnsignedGreater: + case asm.UnsignedGreater: mnemonic.Print(" jump if.u > ") - case token.UnsignedGreaterEqual: + case asm.UnsignedGreaterEqual: mnemonic.Print(" jump if.u >= ") - case token.UnsignedLess: + case asm.UnsignedLess: mnemonic.Print(" jump if.u < ") - case token.UnsignedLessEqual: + case asm.UnsignedLessEqual: mnemonic.Print(" jump if.u <= ") - case token.Invalid: + case asm.None: mnemonic.Print(" jump ") default: - ansi.Red.Print(" jump: unknown condition: " + instr.Condition.String() + " ") + ansi.Red.Print(" jump: unknown condition: " + fmt.Sprint(instr.Condition) + " ") } label.Print(ssa.CleanLabel(instr.Label))