|
@@ -50,6 +50,48 @@ public class Gen extends API.Gen {
|
|
|
Init();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public IvannosysTargetArch Export() {
|
|
|
+ Code Target = getTarget();
|
|
|
+ System.out.println(Target.GData());
|
|
|
+ String out = "", tmp;
|
|
|
+ Integer index;
|
|
|
+ for (Map.Entry<String, Block> x : Target.stmts.entrySet()) {
|
|
|
+ System.out.println(x.getValue().Data());
|
|
|
+ index = 0;
|
|
|
+ for (Instruction instr : x.getValue().Instructions()) {
|
|
|
+// System.out.println("Export:" + instr);
|
|
|
+ tmp = instr.G("inst.dec");
|
|
|
+ if (tmp.equals("")) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ out = out
|
|
|
+ // .concat(Integer.toHexString(index))
|
|
|
+ // .concat(":")
|
|
|
+ // .concat(String.format("%X\n", tmp.trim()) + "\n");
|
|
|
+ .concat(tmp + "\n");
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+// System.out.println("Export:" + out);
|
|
|
+ // Grava resutlado no arquivo de memoria do simulador
|
|
|
+ Utils.WriteFile("\\src\\tools\\mips\\memory\\mi.memory", out);
|
|
|
+ try {
|
|
|
+ new tools.mips.MipsProcessor(new tools.mips.MipsSettings() {
|
|
|
+ {
|
|
|
+ debugmode = false;
|
|
|
+ SetInstructionMemoryFile("\\src\\tools\\mips\\memory\\mi.memory");
|
|
|
+ SetDataMemoryFile("\\src\\tools\\mips\\memory\\md.memory");
|
|
|
+ }
|
|
|
+ }).Run().Persist();
|
|
|
+ } catch (IOException ex) {
|
|
|
+ Logger.getLogger(Gen.class.getName()).log(Level.SEVERE, null, ex);
|
|
|
+ }
|
|
|
+
|
|
|
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
|
|
+ }
|
|
|
+
|
|
|
public void CopyData(LinkedHashMap<String, Node> dst, LinkedHashMap<String, Node> src) throws Exception {
|
|
|
Node value;
|
|
|
|
|
@@ -74,7 +116,6 @@ public class Gen extends API.Gen {
|
|
|
|
|
|
public IvannosysTargetArch SetTAC(Code tac) {
|
|
|
try {
|
|
|
-// System.out.println(">>>>>>>>>>>>>>> Set tac");
|
|
|
this.tac = tac;
|
|
|
CopyData(target.GData().values(), tac.GData().values());
|
|
|
} catch (Exception ex) {
|
|
@@ -86,7 +127,7 @@ public class Gen extends API.Gen {
|
|
|
public void Init() {
|
|
|
BeforeTranslateBlock("live.var", new OcorrenceFinderProcessor());
|
|
|
BeforeTranslateBlock("register.alloc", new AllocatorMipsProcessor());
|
|
|
- AfterTranslateBlock("otimization.1", new OtimizationMips());
|
|
|
+ AfterTranslateBlock("oti.1", new OtimizationMips());
|
|
|
AfterTranslate("update.address", new UpdateAddressProcessor());
|
|
|
getTarget()
|
|
|
.Template(new TemplateMips())
|
|
@@ -662,47 +703,6 @@ public class Gen extends API.Gen {
|
|
|
.S("rd", "zero"));
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public IvannosysTargetArch Export() {
|
|
|
- Code Target = getTarget();
|
|
|
- System.out.println(Target.GData());
|
|
|
- String out = "", tmp;
|
|
|
- Integer index;
|
|
|
- for (Map.Entry<String, Block> x : Target.stmts.entrySet()) {
|
|
|
- System.out.println(x.getValue().Data());
|
|
|
- index = 0;
|
|
|
- for (Instruction instr : x.getValue().Instructions()) {
|
|
|
-// System.out.println("Export:" + instr);
|
|
|
- tmp = instr.G("inst.dec");
|
|
|
- if (tmp.equals("")) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- out = out
|
|
|
- // .concat(Integer.toHexString(index))
|
|
|
- // .concat(":")
|
|
|
- // .concat(String.format("%X\n", tmp.trim()) + "\n");
|
|
|
- .concat(tmp + "\n");
|
|
|
- index++;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-// System.out.println("Export:" + out);
|
|
|
- // Grava resutlado no arquivo de memoria do simulador
|
|
|
- Utils.WriteFile("\\src\\tools\\mips\\memory\\mi.memory", out);
|
|
|
- try {
|
|
|
- new tools.mips.MipsProcessor(new tools.mips.MipsSettings() {
|
|
|
- {
|
|
|
- SetInstructionMemoryFile("\\src\\tools\\mips\\memory\\mi.memory");
|
|
|
- SetDataMemoryFile("\\src\\tools\\mips\\memory\\md.memory");
|
|
|
- }
|
|
|
- }).Run().Persist();
|
|
|
- } catch (IOException ex) {
|
|
|
- Logger.getLogger(Gen.class.getName()).log(Level.SEVERE, null, ex);
|
|
|
- }
|
|
|
-
|
|
|
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public void TranslateUnary(Instruction inst) throws Exception {
|
|
|
// Carrega o valor se nao esta em registrador
|