use of com.oracle.truffle.llvm.parser.model.symbols.globals.GlobalValueSymbol in project sulong by graalvm.
the class MDUpgrade method visit.
@Override
public void visit(MDGlobalVariable mdGlobal) {
final SymbolImpl symbol = MDSymbolExtractor.getSymbol(mdGlobal.getVariable());
if (symbol instanceof GlobalValueSymbol) {
final GlobalValueSymbol global = (GlobalValueSymbol) symbol;
attachSymbol(global, mdGlobal);
}
if (currentCU != null) {
mdGlobal.setCompileUnit(currentCU);
}
}
use of com.oracle.truffle.llvm.parser.model.symbols.globals.GlobalValueSymbol in project sulong by graalvm.
the class ModelModule method accept.
public void accept(ModelVisitor visitor) {
visitor.visit(targetDataLayout);
targetInfo.forEach(visitor::visit);
types.forEach(visitor::visit);
for (GlobalValueSymbol variable : globals) {
variable.accept(visitor);
}
defines.forEach(visitor::visit);
declares.forEach(visitor::visit);
}
use of com.oracle.truffle.llvm.parser.model.symbols.globals.GlobalValueSymbol in project sulong by graalvm.
the class BCFileRoot method exit.
@Override
public void exit() {
int globalIndex = 0;
for (GlobalValueSymbol variable : module.getGlobals()) {
if (variable.getName().equals(LLVMIdentifier.UNKNOWN)) {
variable.setName(String.valueOf(globalIndex++));
}
}
SymbolNameMangling.demangleGlobals(module);
DebugInfoModuleProcessor.processModule(module, source, scope.getMetadata());
}
use of com.oracle.truffle.llvm.parser.model.symbols.globals.GlobalValueSymbol in project sulong by graalvm.
the class Module method createGlobalVariable.
private void createGlobalVariable(long[] args) {
final int recordOffset = useStrTab() ? STRTAB_RECORD_OFFSET : 0;
final long typeField = args[GLOBALVAR_TYPE + recordOffset];
final long flagField = args[GLOBALVAR_FLAGS + recordOffset];
Type type = types.get(typeField);
if ((flagField & GLOBALVAR_EXPLICICTTYPE_MASK) != 0) {
type = new PointerType(type);
}
final boolean isConstant = (flagField & GLOBALVAR_ISCONSTANT_MASK) != 0;
final int initialiser = (int) args[GLOBALVAR_INTITIALIZER + recordOffset];
final long linkage = args[GLOBALVAR_LINKAGE + recordOffset];
final int align = (int) args[GLOBALVAR_ALIGN + recordOffset];
long visibility = Visibility.DEFAULT.getEncodedValue();
if (GLOBALVAR_VISIBILITY + recordOffset < args.length) {
visibility = args[GLOBALVAR_VISIBILITY + recordOffset];
}
final GlobalValueSymbol global;
if (isConstant) {
global = GlobalConstant.create(type, align, linkage, visibility, scope.getSymbols(), initialiser);
} else {
global = GlobalVariable.create(type, align, linkage, visibility, scope.getSymbols(), initialiser);
}
if (useStrTab()) {
readNameFromStrTab(args, global);
}
module.addGlobalSymbol(global);
scope.addSymbol(global, global.getType());
}
use of com.oracle.truffle.llvm.parser.model.symbols.globals.GlobalValueSymbol in project sulong by graalvm.
the class LLVMLivenessAnalysis method resolve.
private static int resolve(FrameDescriptor frame, SymbolImpl symbol) {
if (symbol instanceof ValueSymbol && !(symbol instanceof GlobalValueSymbol || symbol instanceof FunctionDefinition || symbol instanceof FunctionDeclaration)) {
String name = ((ValueSymbol) symbol).getName();
assert name != null;
FrameSlot frameSlot = frame.findFrameSlot(name);
assert frameSlot != null : "No Frameslot for ValueSymbol: " + symbol;
return frameSlot.getIndex();
}
return -1;
}
Aggregations