use of com.oracle.truffle.llvm.nodes.asm.support.LLVMAMD64Target in project sulong by graalvm.
the class AsmFactory method getTarget.
private LLVMAMD64Target getTarget(Type type, AsmOperand operand) {
if (operand instanceof AsmRegisterOperand) {
AsmRegisterOperand op = (AsmRegisterOperand) operand;
FrameSlot frame = getRegisterSlot(op.getBaseRegister());
int shift = op.getShift();
assert type == op.getType();
switch(((PrimitiveType) op.getType()).getPrimitiveKind()) {
case I8:
return new LLVMAMD64Target(frame, shift);
case I16:
case I32:
case I64:
return new LLVMAMD64Target(frame);
default:
throw new AsmParseException("unsupported operand type: " + op.getType());
}
} else if (operand instanceof AsmArgumentOperand) {
AsmArgumentOperand op = (AsmArgumentOperand) operand;
Argument info = argInfo.get(op.getIndex());
if (info.isMemory()) {
LLVMExpressionNode address = info.getAddress();
if (type instanceof PointerType) {
return new LLVMAMD64Target(address);
}
switch(((PrimitiveType) type).getPrimitiveKind()) {
case I8:
case I16:
case I32:
case I64:
return new LLVMAMD64Target(address);
default:
throw new AsmParseException("unsupported operand type: " + type);
}
} else if (info.isRegister()) {
FrameSlot frame = getRegisterSlot(info.getRegister());
if (type instanceof PointerType || info.getType() instanceof PointerType) {
return new LLVMAMD64Target(frame);
}
switch(((PrimitiveType) type).getPrimitiveKind()) {
case I8:
case I16:
case I32:
case I64:
return new LLVMAMD64Target(frame);
default:
throw new AsmParseException("unsupported operand type: " + type);
}
} else {
throw new AssertionError("this should not happen; " + info);
}
}
throw new AsmParseException("unsupported operand type: " + operand);
}
use of com.oracle.truffle.llvm.nodes.asm.support.LLVMAMD64Target in project sulong by graalvm.
the class AsmFactory method getRegisterTarget.
private LLVMAMD64Target getRegisterTarget(Type type, String name) {
AsmRegisterOperand op = new AsmRegisterOperand(name);
FrameSlot frame = getRegisterSlot(name);
switch(((PrimitiveType) type).getPrimitiveKind()) {
case I8:
return new LLVMAMD64Target(frame, op.getShift());
case I16:
case I32:
case I64:
return new LLVMAMD64Target(frame);
default:
throw new AsmParseException("unsupported operand type");
}
}
Aggregations