mips without optimize
This commit is contained in:
19
backend/mips/instr/data/MipsAsciiz.java
Normal file
19
backend/mips/instr/data/MipsAsciiz.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package backend.mips.instr.data;
|
||||
|
||||
import backend.mips.instr.MipsInstr;
|
||||
import backend.mips.instr.type.MipsType;
|
||||
|
||||
public class MipsAsciiz extends MipsInstr {
|
||||
private String name;
|
||||
private String str;
|
||||
|
||||
public MipsAsciiz(String name, String str) {
|
||||
super(MipsType.DATA);
|
||||
this.name = name;
|
||||
this.str = str;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return name + ": .asciiz \"" + str.replaceAll("\n", "\\n") + "\"\n";
|
||||
}
|
||||
}
|
||||
19
backend/mips/instr/data/MipsSpace.java
Normal file
19
backend/mips/instr/data/MipsSpace.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package backend.mips.instr.data;
|
||||
|
||||
import backend.mips.instr.MipsInstr;
|
||||
import backend.mips.instr.type.MipsType;
|
||||
|
||||
public class MipsSpace extends MipsInstr {
|
||||
private int size;
|
||||
private String name;
|
||||
|
||||
public MipsSpace(int size, String name) {
|
||||
super(MipsType.DATA);
|
||||
this.size = size;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return name + ": .space " + size + "\n";
|
||||
}
|
||||
}
|
||||
39
backend/mips/instr/data/MipsWord.java
Normal file
39
backend/mips/instr/data/MipsWord.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package backend.mips.instr.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import backend.mips.instr.MipsInstr;
|
||||
import backend.mips.instr.type.MipsType;
|
||||
|
||||
public class MipsWord extends MipsInstr {
|
||||
private String name;
|
||||
private ArrayList<Integer> valueList;
|
||||
|
||||
public MipsWord(String name, ArrayList<Integer> valueList) {
|
||||
super(MipsType.DATA);
|
||||
this.name = name;
|
||||
this.valueList = valueList;
|
||||
}
|
||||
|
||||
public MipsWord(String name, int value) {
|
||||
super(MipsType.DATA);
|
||||
this.name = name;
|
||||
this.valueList = new ArrayList<Integer>();
|
||||
this.valueList.add(value);
|
||||
}
|
||||
|
||||
public int getValueNum() {
|
||||
return valueList.size();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(name).append(": .word ");
|
||||
for (int value : valueList) {
|
||||
sb.append(value).append(", ");
|
||||
}
|
||||
sb.delete(sb.length() - 2, sb.length());
|
||||
sb.append("\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user