use of com.oracle.truffle.llvm.runtime.types.Type in project sulong by graalvm.
the class Function method createInsertElement.
private void createInsertElement(long[] args) {
int i = 0;
int vector = getIndex(args[i++]);
Type type;
if (scope.isValueForwardRef(vector)) {
type = types.get(args[i++]);
} else {
type = scope.getValueType(vector);
}
int value = getIndex(args[i++]);
int index = getIndex(args[i]);
emit(InsertElementInstruction.fromSymbols(scope.getSymbols(), type, vector, index, value));
}
use of com.oracle.truffle.llvm.runtime.types.Type in project sulong by graalvm.
the class Function method createAtomicReadModifyWrite.
private void createAtomicReadModifyWrite(long[] args) {
int i = 0;
final int ptr = getIndex(args[i++]);
final Type ptrType;
if (scope.isValueForwardRef(ptr)) {
ptrType = types.get(args[i++]);
} else {
ptrType = scope.getValueType(ptr);
}
final int value = getIndex(args[i++]);
final int opcode = (int) args[i++];
final boolean isVolatile = args[i++] != 0;
final long atomicOrdering = args[i++];
final long synchronizationScope = args[i];
final Type type = ((PointerType) ptrType).getPointeeType();
emit(ReadModifyWriteInstruction.fromSymbols(scope.getSymbols(), type, ptr, value, opcode, isVolatile, atomicOrdering, synchronizationScope));
}
use of com.oracle.truffle.llvm.runtime.types.Type in project sulong by graalvm.
the class Function method createExtractValue.
private void createExtractValue(long[] args) {
int i = 0;
int aggregate = getIndex(args[i++]);
Type aggregateType = null;
if (scope.isValueForwardRef(aggregate)) {
aggregateType = types.get(args[i++]);
}
int index = (int) args[i++];
if (aggregateType == null) {
aggregateType = scope.getValueType(aggregate);
}
if (i != args.length) {
throw new UnsupportedOperationException("Multiple indices are not yet supported!");
}
final Type elementType = ((AggregateType) aggregateType).getElementType(index);
emit(ExtractValueInstruction.fromSymbols(scope.getSymbols(), elementType, aggregate, index));
}
use of com.oracle.truffle.llvm.runtime.types.Type 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.runtime.types.Type in project sulong by graalvm.
the class Module method createGlobalAliasNew.
private void createGlobalAliasNew(long[] args) {
final int recordOffset = useStrTab() ? STRTAB_RECORD_OFFSET : 0;
final Type type = new PointerType(types.get(args[GLOBALALIAS_TYPE + recordOffset]));
// idx = 1 is address space information
final int value = (int) args[GLOBALALIAS_NEW_VALUE + recordOffset];
final long linkage = args[GLOBALALIAS_NEW_LINKAGE + recordOffset];
final GlobalAlias global = GlobalAlias.create(type, linkage, Visibility.DEFAULT.ordinal(), scope.getSymbols(), value);
if (useStrTab()) {
readNameFromStrTab(args, global);
}
module.addGlobalSymbol(global);
scope.addSymbol(global, global.getType());
}
Aggregations