use of com.oracle.truffle.llvm.parser.model.symbols.instructions.ValueInstruction in project sulong by graalvm.
the class LLVMBitcodeInstructionVisitor method visitDebugIntrinsic.
private void visitDebugIntrinsic(SymbolImpl value, SourceVariable variable, MDExpression expression, long index, boolean isDeclaration) {
FrameSlot valueSlot = null;
if (value instanceof ValueInstruction) {
valueSlot = frame.findFrameSlot(((ValueInstruction) value).getName());
} else if (value instanceof FunctionParameter) {
valueSlot = frame.findFrameSlot(((FunctionParameter) value).getName());
}
if (valueSlot != null) {
final LLVMExpressionNode typeNode = nodeFactory.registerSourceType(valueSlot, variable.getSourceType());
if (typeNode != null) {
addInstructionUnchecked(typeNode);
}
}
final LLVMExpressionNode dbgIntrinsic = dbgInfoHandler.handleDebugIntrinsic(value, variable, expression, index, isDeclaration);
if (dbgIntrinsic != null) {
addInstructionUnchecked(dbgIntrinsic);
}
handleNullerInfo();
}
use of com.oracle.truffle.llvm.parser.model.symbols.instructions.ValueInstruction in project sulong by graalvm.
the class FunctionDefinition method exitLocalScope.
public void exitLocalScope() {
int symbolIndex = 0;
// in K&R style function declarations the parameters are not assigned names
for (final FunctionParameter parameter : parameters) {
if (LLVMIdentifier.UNKNOWN.equals(parameter.getName())) {
parameter.setName(String.valueOf(symbolIndex++));
}
}
final Set<String> explicitBlockNames = Arrays.stream(blocks).map(InstructionBlock::getName).filter(blockName -> !LLVMIdentifier.UNKNOWN.equals(blockName)).collect(Collectors.toSet());
for (final InstructionBlock block : blocks) {
if (block.getName().equals(LLVMIdentifier.UNKNOWN)) {
do {
block.setName(LLVMIdentifier.toImplicitBlockName(symbolIndex++));
// avoid name clashes
} while (explicitBlockNames.contains(block.getName()));
}
for (int i = 0; i < block.getInstructionCount(); i++) {
final Instruction instruction = block.getInstruction(i);
if (instruction instanceof ValueInstruction) {
final ValueInstruction value = (ValueInstruction) instruction;
if (value.getName().equals(LLVMIdentifier.UNKNOWN)) {
value.setName(String.valueOf(symbolIndex++));
}
}
}
}
}
Aggregations