master
Sanjar Ahmadov 4 years ago
parent f2485b1e97
commit ef4ac31e04

@ -441,7 +441,7 @@ public class CodeGenImpl extends CodeGenBase
@Override @Override
public Register analyze(BooleanLiteral node) public Register analyze(BooleanLiteral node)
{ {
System.out.println("Inside BooleanLiteral: "); System.out.println("Inside BooleanLiteral: ");
backend.emitLW(T6, FP, 0, "Inside BooleanLiteral: "); backend.emitLW(T6, FP, 0, "Inside BooleanLiteral: ");
if(node.value==true) if(node.value==true)
backend.emitLI(Register.A0, 1, "Load boolean literal: true "); backend.emitLI(Register.A0, 1, "Load boolean literal: true ");
@ -486,7 +486,6 @@ public class CodeGenImpl extends CodeGenBase
System.out.println("varfuncInfo name: " + varFuncInfo.getFuncName()); System.out.println("varfuncInfo name: " + varFuncInfo.getFuncName());
System.out.println("var idx: " + varFuncInfo.getVarIndex(info.getVarName())); System.out.println("var idx: " + varFuncInfo.getVarIndex(info.getVarName()));
int tmpHandle = getRegister(); int tmpHandle = getRegister();
Register tmp = registerPool[tmpHandle]; Register tmp = registerPool[tmpHandle];
@ -515,31 +514,6 @@ public class CodeGenImpl extends CodeGenBase
int idx = varFuncInfo.getVarIndex(info.getVarName()); int idx = varFuncInfo.getVarIndex(info.getVarName());
int paramSize = varFuncInfo.getParams().size(); int paramSize = varFuncInfo.getParams().size();
int offset = getLocalVarLocationOffset(idx, paramSize); int offset = getLocalVarLocationOffset(idx, paramSize);
System.out.println("idx " +idx + " paramSize " + paramSize + " offset " + offset);
// - int curr_depth = funcInfo.getDepth();
// - int d_depth = curr_depth - info.getFuncInfo().getDepth();
// - if(d_depth == 0) {
// - int idx = funcInfo.getVarIndex(info.getVarName());
// - int paramSize = funcInfo.getParams().size();
// - int offset = getLocalVarLocationOffset(idx, paramSize);
// - return new StackVarRuntimeInfo(FP, offset);
// - } else
// - {
// - FuncInfo curr = funcInfo;
// - int tmpHandle = getRegister();
// - Register tmp = registerPool[tmpHandle];
// - backend.emitMV(tmp, FP, "tmp = FP");
// - while(d_depth > 0){
// - curr = curr.getParentFuncInfo();
// - backend.emitLW(tmp, tmp, curr.getParams().size()*wordSize, "Get static link");
// - -- d_depth;
// - }
// - // UNSAFE!!!!! PLEASE FREE THE TMP_HANDLE MANUALLY
// - return new StackVarRuntimeInfo(tmp, -wordSize*curr.getVarIndex(info.getVarName()), tmpHandle);
// - }
return new StackVarRuntimeInfo(tmp, offset, tmpHandle); return new StackVarRuntimeInfo(tmp, offset, tmpHandle);
} }

Loading…
Cancel
Save