use of com.oracle.truffle.llvm.parser.model.SymbolTable in project sulong by graalvm.
the class FunctionStart method parseArguments.
static void parseArguments(IRScope scope, SymbolImpl callTarget, Instruction inst, SymbolImpl[] target, int[] src) {
if (src.length == 0) {
return;
}
final Type[] paramTypes;
if (callTarget instanceof FunctionDefinition) {
paramTypes = ((FunctionDefinition) (callTarget)).getType().getArgumentTypes();
} else if (callTarget instanceof FunctionDeclaration) {
paramTypes = ((FunctionDeclaration) (callTarget)).getType().getArgumentTypes();
} else {
paramTypes = Type.EMPTY_ARRAY;
}
final SymbolTable symbols = scope.getSymbols();
for (int i = Math.min(paramTypes.length, src.length) - 1; i >= 0; i--) {
if (paramTypes[i] == MetaType.METADATA) {
target[i] = MetadataSymbol.create(scope.getMetadata(), src[i]);
} else {
target[i] = symbols.getForwardReferenced(src[i], inst);
}
}
// parse varargs
for (int i = paramTypes.length; i < src.length; i++) {
target[i] = symbols.getForwardReferenced(src[i], inst);
}
}
Aggregations