|
|
@ -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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|