use of com.oracle.truffle.llvm.parser.metadata.MDBaseNode in project sulong by graalvm.
the class DebugInfoModuleProcessor method processModule.
public static void processModule(ModelModule irModel, Source bitcodeSource, MetadataValueList metadata) {
MDUpgrade.perform(metadata);
final DebugInfoCache cache = new DebugInfoCache(metadata, irModel.getSourceStaticMembers());
final Map<LLVMSourceSymbol, SymbolImpl> globals = irModel.getSourceGlobals();
final Map<LLVMSourceStaticMemberType, SymbolImpl> staticMembers = irModel.getSourceStaticMembers();
irModel.accept(new SymbolProcessor(cache, bitcodeSource, globals, staticMembers));
final MDBaseNode cuNode = metadata.getNamedNode(MDNamedNode.COMPILEUNIT_NAME);
final MetadataProcessor mdParser = new MetadataProcessor(cache, globals, staticMembers);
if (cuNode != null) {
cuNode.accept(mdParser);
}
irModel.setFunctionProcessor(new DebugInfoFunctionProcessor(cache));
}
use of com.oracle.truffle.llvm.parser.metadata.MDBaseNode in project sulong by graalvm.
the class DebugInfoFunctionProcessor method initSourceFunction.
private void initSourceFunction(FunctionDefinition function, Source bitcodeSource) {
final MDBaseNode debugInfo = getDebugInfo(function);
LLVMSourceLocation scope = null;
LLVMSourceFunctionType type = null;
if (debugInfo != null) {
scope = cache.buildLocation(debugInfo);
LLVMSourceType actualType = cache.parseType(debugInfo);
if (actualType instanceof LLVMSourceFunctionType) {
type = (LLVMSourceFunctionType) actualType;
}
}
if (scope == null) {
final String sourceText = String.format("%s:%s", bitcodeSource.getName(), function.getName());
final Source irSource = Source.newBuilder(sourceText).mimeType(DIScopeBuilder.getMimeType(null)).name(sourceText).build();
final SourceSection simpleSection = irSource.createSection(1);
scope = LLVMSourceLocation.createBitcodeFunction(function.getName(), simpleSection);
}
final SourceFunction sourceFunction = new SourceFunction(scope, type);
function.setSourceFunction(sourceFunction);
for (SourceVariable local : sourceFunction.getVariables()) {
local.processFragments();
}
}
use of com.oracle.truffle.llvm.parser.metadata.MDBaseNode in project sulong by graalvm.
the class DebugInfoGenerator method getSourceFunctionName.
public static String getSourceFunctionName(FunctionDefinition function) {
if (function.hasAttachedMetadata()) {
final MDBaseNode attachment = function.getMetadataAttachment(MDKind.DBG_NAME);
if (attachment != null) {
final DIVisitor visitor = new DIVisitor();
attachment.accept(visitor);
return visitor.getFunctionName();
}
}
return null;
}
Aggregations