Search in sources :

Example 1 with Attribute

use of com.oracle.truffle.llvm.parser.model.attributes.Attribute in project sulong by graalvm.

the class LLVMBitcodeInstructionVisitor method capsuleAddressByValue.

private LLVMExpressionNode capsuleAddressByValue(LLVMExpressionNode child, Type type, AttributesGroup paramAttr) {
    final Type pointee = ((PointerType) type).getPointeeType();
    final int size = runtime.getContext().getByteSize(pointee);
    int alignment = runtime.getContext().getByteAlignment(pointee);
    for (Attribute attr : paramAttr.getAttributes()) {
        if (attr instanceof Attribute.KnownIntegerValueAttribute && ((Attribute.KnownIntegerValueAttribute) attr).getAttr() == Attribute.Kind.ALIGN) {
            alignment = ((Attribute.KnownIntegerValueAttribute) attr).getValue();
        }
    }
    return nodeFactory.createVarArgCompoundValue(runtime, size, alignment, child);
}
Also used : LLVMConversionType(com.oracle.truffle.llvm.parser.instructions.LLVMConversionType) PrimitiveType(com.oracle.truffle.llvm.runtime.types.PrimitiveType) StructureType(com.oracle.truffle.llvm.runtime.types.StructureType) ArrayType(com.oracle.truffle.llvm.runtime.types.ArrayType) AggregateType(com.oracle.truffle.llvm.runtime.types.AggregateType) LLVMArithmeticInstructionType(com.oracle.truffle.llvm.parser.instructions.LLVMArithmeticInstructionType) Type(com.oracle.truffle.llvm.runtime.types.Type) PointerType(com.oracle.truffle.llvm.runtime.types.PointerType) FunctionType(com.oracle.truffle.llvm.runtime.types.FunctionType) Attribute(com.oracle.truffle.llvm.parser.model.attributes.Attribute) PointerType(com.oracle.truffle.llvm.runtime.types.PointerType)

Aggregations

LLVMArithmeticInstructionType (com.oracle.truffle.llvm.parser.instructions.LLVMArithmeticInstructionType)1 LLVMConversionType (com.oracle.truffle.llvm.parser.instructions.LLVMConversionType)1 Attribute (com.oracle.truffle.llvm.parser.model.attributes.Attribute)1 AggregateType (com.oracle.truffle.llvm.runtime.types.AggregateType)1 ArrayType (com.oracle.truffle.llvm.runtime.types.ArrayType)1 FunctionType (com.oracle.truffle.llvm.runtime.types.FunctionType)1 PointerType (com.oracle.truffle.llvm.runtime.types.PointerType)1 PrimitiveType (com.oracle.truffle.llvm.runtime.types.PrimitiveType)1 StructureType (com.oracle.truffle.llvm.runtime.types.StructureType)1 Type (com.oracle.truffle.llvm.runtime.types.Type)1