use of org.robovm.compiler.llvm.Function in project robovm by robovm.
the class ClassCompiler method createAllocator.
private Function createAllocator() {
Function fn = FunctionBuilder.allocator(sootClass);
Value info = getInfoStruct(fn, sootClass);
Value result = call(fn, BC_ALLOCATE, fn.getParameterRef(0), info);
fn.add(new Ret(result));
return fn;
}
use of org.robovm.compiler.llvm.Function in project robovm by robovm.
the class TrampolineCompiler method createAnewarray.
private FunctionRef createAnewarray(Anewarray t) {
String fnName = Symbols.anewarraySymbol(t.getTarget());
if (!mb.hasSymbol(fnName)) {
Function fn = new FunctionBuilder(t).name(fnName).linkage(weak).build();
Value arrayClass = callLdcArray(fn, t.getTarget());
Value result = call(fn, BC_NEW_OBJECT_ARRAY, fn.getParameterRef(0), fn.getParameterRef(1), arrayClass);
fn.add(new Ret(result));
mb.addFunction(fn);
}
return new FunctionRef(fnName, t.getFunctionType());
}
use of org.robovm.compiler.llvm.Function in project robovm by robovm.
the class TrampolineCompiler method createInstanceofArray.
private FunctionRef createInstanceofArray(Instanceof t) {
String fnName = Symbols.arrayinstanceofSymbol(t.getTarget());
if (!mb.hasSymbol(fnName)) {
Function fn = new FunctionBuilder(t).name(fnName).linkage(weak).build();
Value arrayClass = callLdcArray(fn, t.getTarget());
Value result = call(fn, BC_INSTANCEOF_ARRAY, fn.getParameterRef(0), arrayClass, fn.getParameterRef(1));
fn.add(new Ret(result));
mb.addFunction(fn);
}
return new FunctionRef(fnName, t.getFunctionType());
}
use of org.robovm.compiler.llvm.Function in project robovm by robovm.
the class TrampolineCompiler method createLdcArray.
private FunctionRef createLdcArray(String targetClass) {
if (isPrimitiveComponentType(targetClass)) {
throw new IllegalArgumentException();
}
String fnName = Symbols.arrayldcSymbol(targetClass);
FunctionRef fnRef = new FunctionRef(fnName, new FunctionType(OBJECT_PTR, ENV_PTR));
if (!mb.hasSymbol(fnName)) {
Function fn = new FunctionBuilder(fnRef).name(fnName).linkage(weak).build();
Global g = new Global(Symbols.arrayPtrSymbol(targetClass), weak, new NullConstant(OBJECT_PTR));
if (!mb.hasSymbol(g.getName())) {
mb.addGlobal(g);
}
FunctionRef ldcArrayClassFn = BC_LDC_ARRAY_BOOT_CLASS;
if (!isPrimitiveBaseType(targetClass)) {
Clazz baseType = config.getClazzes().load(getBaseType(targetClass));
if (!baseType.isInBootClasspath()) {
ldcArrayClassFn = BC_LDC_ARRAY_CLASS;
}
}
Value arrayClass = call(fn, ldcArrayClassFn, fn.getParameterRef(0), g.ref(), mb.getString(targetClass));
fn.add(new Ret(arrayClass));
mb.addFunction(fn);
}
return fnRef;
}
use of org.robovm.compiler.llvm.Function in project robovm by robovm.
the class TrampolineCompiler method createCheckcastArray.
private FunctionRef createCheckcastArray(Checkcast t) {
String fnName = Symbols.arraycheckcastSymbol(t.getTarget());
if (!mb.hasSymbol(fnName)) {
Function fn = new FunctionBuilder(t).name(fnName).linkage(weak).build();
Value arrayClass = callLdcArray(fn, t.getTarget());
Value result = call(fn, BC_CHECKCAST_ARRAY, fn.getParameterRef(0), arrayClass, fn.getParameterRef(1));
fn.add(new Ret(result));
mb.addFunction(fn);
}
return new FunctionRef(fnName, t.getFunctionType());
}
Aggregations