some opt
This commit is contained in:
@@ -35,6 +35,27 @@ public class IrBasicBlock extends IrValue {
|
||||
instr.setBBlock(this);
|
||||
}
|
||||
|
||||
public void addInstr(IrInstr instr, int index) {
|
||||
instrs.add(index, instr);
|
||||
instr.setBBlock(this);
|
||||
}
|
||||
|
||||
public void deleteInstr(IrInstr instr) {
|
||||
instrs.remove(instr);
|
||||
instr.setBBlock(null);
|
||||
instr.clearUses();
|
||||
instr.clearUsers();
|
||||
}
|
||||
|
||||
public void clearAllInstrs() {
|
||||
for (IrInstr instr : instrs) {
|
||||
instr.setBBlock(null);
|
||||
instr.clearUses();
|
||||
instr.clearUsers();
|
||||
}
|
||||
instrs.clear();
|
||||
}
|
||||
|
||||
public IrFuncValue getFunc() {
|
||||
return func;
|
||||
}
|
||||
@@ -87,6 +108,20 @@ public class IrBasicBlock extends IrValue {
|
||||
return instrs;
|
||||
}
|
||||
|
||||
public IrInstr getFirstInstr() {
|
||||
if (instrs.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return instrs.get(0);
|
||||
}
|
||||
|
||||
public IrInstr getLastInstr() {
|
||||
if (instrs.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return instrs.get(instrs.size() - 1);
|
||||
}
|
||||
|
||||
public void addPred(IrBasicBlock bb) {
|
||||
this.preds.add(bb);
|
||||
}
|
||||
@@ -119,6 +154,14 @@ public class IrBasicBlock extends IrValue {
|
||||
return this.directDomi;
|
||||
}
|
||||
|
||||
public HashSet<IrBasicBlock> getDirectDomies() {
|
||||
return directDomies;
|
||||
}
|
||||
|
||||
public HashSet<IrBasicBlock> getDomiFrontier() {
|
||||
return domiFrontier;
|
||||
}
|
||||
|
||||
public void toMips() {
|
||||
new MipsLabel(getMipsLabel());
|
||||
for (IrInstr instr : instrs) {
|
||||
|
||||
Reference in New Issue
Block a user