use of com.oracle.truffle.llvm.parser.model.enums.Linkage in project sulong by graalvm.
the class Module method createFunction.
private void createFunction(long[] args) {
final int recordOffset = useStrTab() ? STRTAB_RECORD_OFFSET : 0;
Type type = types.get(args[FUNCTION_TYPE + recordOffset]);
if (type instanceof PointerType) {
type = ((PointerType) type).getPointeeType();
}
final FunctionType functionType = (FunctionType) type;
final boolean isPrototype = args[FUNCTION_ISPROTOTYPE + recordOffset] != 0;
final Linkage linkage = Linkage.decode(args[FUNCTION_LINKAGE + recordOffset]);
final AttributesCodeEntry paramAttr = paramAttributes.getCodeEntry(args[FUNCTION_PARAMATTR + recordOffset]);
if (isPrototype) {
final FunctionDeclaration function = new FunctionDeclaration(functionType, linkage, paramAttr);
module.addFunctionDeclaration(function);
scope.addSymbol(function, function.getType());
if (useStrTab()) {
readNameFromStrTab(args, function);
}
} else {
final FunctionDefinition function = new FunctionDefinition(functionType, linkage, paramAttr);
module.addFunctionDefinition(function);
scope.addSymbol(function, function.getType());
if (useStrTab()) {
readNameFromStrTab(args, function);
}
functionQueue.addLast(function);
}
}
Aggregations