diff options
Diffstat (limited to 'snug-clean/src/MIPS/MIPS32.icl')
-rw-r--r-- | snug-clean/src/MIPS/MIPS32.icl | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/snug-clean/src/MIPS/MIPS32.icl b/snug-clean/src/MIPS/MIPS32.icl index e8053e3..d95b71c 100644 --- a/snug-clean/src/MIPS/MIPS32.icl +++ b/snug-clean/src/MIPS/MIPS32.icl @@ -63,16 +63,16 @@ where (Link, Direct _) -> "jal\t" (NoLink, Register _) -> "jr\t" (Link, Register _) -> "jalr\t" - toString (BranchOn1 (BCGeZero link) rs offset) = - branch1InstrS (if (link=:Link) "bgezal" "bgez") rs (checkOffset offset) - toString (BranchOn1 BCGtZero rs offset) = - branch1InstrS "bgtz" rs (checkOffset offset) - toString (BranchOn1 BCLeZero rs offset) = - branch1InstrS "blez" rs (checkOffset offset) - toString (BranchOn1 (BCLtZero link) rs offset) = - branch1InstrS (if (link=:Link) "bltzal" "bltz") rs (checkOffset offset) - toString (BranchOn2 cond rs rt offset) = - immediateInstrS (if (cond=:BCEq) "beq" "bne") rs rt (Immediate (checkOffset offset)) + toString (BranchOn1 (BCGeZero link) rs label offset) = + branch1InstrS (if (link=:Link) "bgezal" "bgez") rs label (checkOffset offset) + toString (BranchOn1 BCGtZero rs label offset) = + branch1InstrS "bgtz" rs label (checkOffset offset) + toString (BranchOn1 BCLeZero rs label offset) = + branch1InstrS "blez" rs label (checkOffset offset) + toString (BranchOn1 (BCLtZero link) rs label offset) = + branch1InstrS (if (link=:Link) "bltzal" "bltz") rs label (checkOffset offset) + toString (BranchOn2 cond rs rt label offset) = + branch2InstrS (if (cond=:BCEq) "beq" "bne") rs rt label (checkOffset offset) toString (Break arg) = "break\t" +++ toString arg @@ -112,8 +112,11 @@ immediateInstrS opcode rt rs imm = concat [opcode,"\t",toString rt,",",toString threeRegInstrS :: !String !DestinationRegister !SourceRegister !TargetRegister -> String threeRegInstrS opcode rd rs rt = concat [opcode,"\t",toString rd,",",toString rs,",",toString rt] -branch1InstrS :: !String !SourceRegister !Offset -> String -branch1InstrS opcode rs offset = concat [opcode,"\t",toString rs,",",toString offset] +branch1InstrS :: !String !SourceRegister !Label !Offset -> String +branch1InstrS opcode rs label _ = concat [opcode,"\t",toString rs,",",label] + +branch2InstrS :: !String !SourceRegister !SourceRegister !Label !Offset -> String +branch2InstrS opcode rx ry label _ = concat [opcode,"\t",toString rx,",",toString ry,",",label] instance toString Register where |