use of com.oracle.truffle.llvm.runtime.types.Type in project sulong by graalvm.
the class LLVMBitcodeInstructionVisitor method visit.
@Override
public void visit(StoreInstruction store) {
final LLVMExpressionNode pointerNode = symbols.resolve(store.getDestination());
final LLVMExpressionNode valueNode = symbols.resolve(store.getSource());
Type type = store.getSource().getType();
LLVMSourceLocation source = null;
if (!(store.getSource() instanceof CallInstruction)) {
// otherwise the debugger would stop on both the call and the store of the return value
source = sourceFunction.getSourceLocation(store);
}
final LLVMExpressionNode node = nodeFactory.createStore(runtime, pointerNode, valueNode, type, source);
addInstruction(node);
}
use of com.oracle.truffle.llvm.runtime.types.Type in project sulong by graalvm.
the class LLVMBitcodeInstructionVisitor method visit.
@Override
public void visit(SwitchInstruction zwitch) {
LLVMExpressionNode cond = symbols.resolve(zwitch.getCondition());
int[] successors = new int[zwitch.getCaseCount() + 1];
for (int i = 0; i < successors.length - 1; i++) {
successors[i] = zwitch.getCaseBlock(i).getBlockIndex();
}
successors[successors.length - 1] = zwitch.getDefaultBlock().getBlockIndex();
Type llvmType = zwitch.getCondition().getType();
LLVMExpressionNode[] cases = new LLVMExpressionNode[zwitch.getCaseCount()];
for (int i = 0; i < cases.length; i++) {
cases[i] = symbols.resolve(zwitch.getCaseValue(i));
}
LLVMControlFlowNode node = nodeFactory.createSwitch(runtime, cond, successors, cases, llvmType, getPhiWriteNodes(zwitch), sourceFunction.getSourceLocation(zwitch));
setControlFlowNode(node);
}
use of com.oracle.truffle.llvm.runtime.types.Type in project sulong by graalvm.
the class LLVMBitcodeInstructionVisitor method visit.
@Override
public void visit(CastInstruction cast) {
LLVMConversionType type = LLVMBitcodeTypeHelper.toConversionType(cast.getOperator());
LLVMExpressionNode fromNode = symbols.resolve(cast.getValue());
Type from = cast.getValue().getType();
Type to = cast.getType();
LLVMExpressionNode result = nodeFactory.createCast(runtime, fromNode, to, from, type);
createFrameWrite(result, cast);
}
use of com.oracle.truffle.llvm.runtime.types.Type in project sulong by graalvm.
the class LLVMBitcodeInstructionVisitor method visit.
@Override
public void visit(ReturnInstruction ret) {
LLVMControlFlowNode node;
if (ret.getValue() == null) {
node = nodeFactory.createRetVoid(runtime, sourceFunction.getSourceLocation(ret));
} else {
final Type type = ret.getValue().getType();
final LLVMExpressionNode value = symbols.resolve(ret.getValue());
node = nodeFactory.createNonVoidRet(runtime, value, type, sourceFunction.getSourceLocation(ret));
}
setControlFlowNode(node);
}
use of com.oracle.truffle.llvm.runtime.types.Type in project sulong by graalvm.
the class Function method createCast.
private void createCast(long[] args) {
int i = 0;
int value = getIndex(args[i++]);
if (scope.isValueForwardRef(value)) {
i++;
}
Type type = types.get(args[i++]);
int opcode = (int) args[i];
emit(CastInstruction.fromSymbols(scope.getSymbols(), type, opcode, value));
}
Aggregations