public FunctionContext( TranslationContext translationContext, GimpleFunction gimpleFunction, JimpleMethodBuilder builder) { this.gimpleFunction = gimpleFunction; this.translationContext = translationContext; this.builder = builder; VarUsageInspector varUsage = new VarUsageInspector(gimpleFunction); for (GimpleVarDecl decl : gimpleFunction.getVariableDeclarations()) { Variable localVariable = translationContext .resolveType(decl.getType()) .createLocalVariable(this, decl.getName(), varUsage.getUsage(decl.getId())); symbolTable.put(decl.getId(), localVariable); } for (GimpleParameter param : gimpleFunction.getParameters()) { ImType type = translationContext.resolveType(param.getType()); builder.addParameter(type.paramType(), "p_" + param.getName()); ImExpr paramExpr = JvmExprs.toExpr(this, new JimpleExpr("p_" + param.getName()), type.paramType(), true); Variable variable = type.createLocalVariable(this, param.getName(), varUsage.getUsage(param.getId())); variable.writeAssignment(this, paramExpr); symbolTable.put(param.getId(), variable); } }
public CallingConvention getCallingConvention() { return gimpleFunction.getCallingConvention(); }