use of com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceType in project graal by oracle.
the class DITypeExtractor method visit.
@Override
public void visit(MDGlobalVariable mdGlobal) {
final LLVMSourceType type = resolve(mdGlobal.getType());
parsedTypes.put(mdGlobal, type);
if (mdGlobal.getStaticMemberDeclaration() != MDVoidNode.INSTANCE && mdGlobal.getVariable() instanceof MDValue) {
final LLVMSourceType declType = resolve(mdGlobal.getStaticMemberDeclaration());
final SymbolImpl symbol = ((MDValue) mdGlobal.getVariable()).getValue();
if (declType instanceof LLVMSourceStaticMemberType) {
staticMembers.put((LLVMSourceStaticMemberType) declType, symbol);
}
}
}
use of com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceType in project graal by oracle.
the class DITypeExtractor method visit.
@Override
public void visit(MDString mdString) {
final MDCompositeType referencedType = metadata.identifyType(mdString.getString());
if (referencedType != null) {
final LLVMSourceType type = resolve(referencedType);
parsedTypes.put(mdString, type);
}
}
use of com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceType in project graal by oracle.
the class DITypeExtractor method visit.
@Override
public void visit(MDSubprogram mdSubprogram) {
// 'this' parameter of thunk methods is missing in the debug info, thus fix here.
LLVMSourceType llvmSourceType = resolve(mdSubprogram.getType());
if (Flags.THUNK.isSetIn(mdSubprogram.getFlags())) {
SymbolImpl symbol = MDValue.getIfInstance(mdSubprogram.getFunction());
if (symbol != null && symbol instanceof FunctionDefinition) {
FunctionDefinition function = (FunctionDefinition) symbol;
final DataLayout dataLayout = LLVMLanguage.get(null).getDefaultDataLayout();
LLVMSourceType llvmSourceReturnType = LLVMSourceTypeFactory.resolveType(function.getType().getReturnType(), dataLayout);
List<LLVMSourceType> typeList = new ArrayList<>();
typeList.add(llvmSourceReturnType);
for (FunctionParameter fp : function.getParameters()) {
LLVMSourceType parameterSourceType = LLVMSourceTypeFactory.resolveType(fp.getType(), dataLayout);
typeList.add(parameterSourceType);
}
llvmSourceType = new LLVMSourceFunctionType(typeList);
}
}
parsedTypes.put(mdSubprogram, llvmSourceType);
}
use of com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceType in project graal by oracle.
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("llvm", sourceText, sourceText).mimeType(DIScopeBuilder.getMimeType(null)).build();
final SourceSection simpleSection = irSource.createSection(1);
scope = LLVMSourceLocation.createBitcodeFunction(function.getName(), simpleSection);
}
final SourceFunction sourceFunction = new SourceFunction(scope, type);
function.setSourceFunction(sourceFunction);
}
use of com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceType in project graal by oracle.
the class DebugInfoCache method getSourceSymbol.
LLVMSourceSymbol getSourceSymbol(MDBaseNode mdVariable, boolean isStatic) {
LLVMSourceSymbol lookup = parsedVariables.get(mdVariable);
if (lookup != null) {
return lookup;
}
LLVMSourceLocation location = scopeBuilder.buildLocation(mdVariable);
final LLVMSourceType type = typeExtractor.parseType(mdVariable);
final String varName = MDNameExtractor.getName(mdVariable);
final LLVMSourceSymbol symbol = LLVMSourceSymbol.create(varName, location, type, isStatic);
parsedVariables.put(mdVariable, symbol);
if (location != null) {
// this is currently the line/column where the symbol was declared, we want the
// scope
location = location.getParent();
}
if (location != null) {
location.addSymbol(symbol);
}
return symbol;
}
Aggregations