use of com.oracle.truffle.llvm.runtime.types.Type in project sulong by graalvm.
the class Function method createInsertValue.
private void createInsertValue(long[] args) {
int i = 0;
int aggregate = getIndex(args[i++]);
Type type;
if (scope.isValueForwardRef(aggregate)) {
type = types.get(args[i++]);
} else {
type = scope.getValueType(aggregate);
}
int value = getIndex(args[i++]);
if (scope.isValueForwardRef(value)) {
i++;
}
int index = (int) args[i++];
if (args.length != i) {
throw new UnsupportedOperationException("Multiple indices are not yet supported!");
}
emit(InsertValueInstruction.fromSymbols(scope.getSymbols(), type, aggregate, index, value));
}
use of com.oracle.truffle.llvm.runtime.types.Type in project sulong by graalvm.
the class Function method createSelect.
private void createSelect(long[] args) {
int i = 0;
Type type;
int trueValue = getIndex(args[i++]);
if (scope.isValueForwardRef(trueValue)) {
type = types.get(args[i++]);
} else {
type = scope.getValueType(trueValue);
}
int falseValue = getIndex(args[i++]);
int condition = getIndex(args[i]);
emit(SelectInstruction.fromSymbols(scope.getSymbols(), type, condition, trueValue, falseValue));
}
use of com.oracle.truffle.llvm.runtime.types.Type in project sulong by graalvm.
the class Function method createAlloca.
private void createAlloca(long[] args) {
int i = 0;
final long typeRecord = args[i++];
// type of count
i++;
final int count = getIndexAbsolute(args[i++]);
final long alignRecord = args[i];
final int align = getAlign(alignRecord & ~ALLOCA_FLAGSMASK);
Type type = types.get(typeRecord);
if ((alignRecord & ALLOCA_EXPLICITTYPEMASK) != 0L) {
type = new PointerType(type);
} else if (!(type instanceof PointerType)) {
throw new AssertionError("Alloca must have PointerType!");
}
emit(AllocateInstruction.fromSymbols(scope.getSymbols(), type, count, align));
}
use of com.oracle.truffle.llvm.runtime.types.Type in project sulong by graalvm.
the class Function method createGetElementPointer.
private void createGetElementPointer(long[] args) {
int i = 0;
boolean isInbounds = args[i++] != 0;
// we do not use this parameter
i++;
int pointer = getIndex(args[i++]);
Type base;
if (scope.isValueForwardRef(pointer)) {
base = types.get(args[i++]);
} else {
base = scope.getValueType(pointer);
}
List<Integer> indices = getIndices(args, i);
Type type = new PointerType(getElementPointerType(base, indices));
emit(GetElementPointerInstruction.fromSymbols(scope.getSymbols(), type, pointer, indices, isInbounds));
}
use of com.oracle.truffle.llvm.runtime.types.Type in project sulong by graalvm.
the class Function method setupScope.
public void setupScope() {
scope.startLocalScope(function);
final FunctionType functionType = function.getType();
for (Type argType : functionType.getArgumentTypes()) {
scope.addSymbol(function.createParameter(argType), argType);
}
}
Aggregations