Exemple #1
0
        public void MachineTest()
        {
            LLVM.InitializeX86TargetInfo();
            LLVM.InitializeX86Target();
            LLVM.InitializeX86TargetMC();

            LLVMTypeRef       pointerType = LLVMTypeRef.CreatePointer(LLVMTypeRef.Int32, 0);
            LLVMTargetDataRef x86         = TargetDataFromTriple("i386-unknown-unknown");
            LLVMTargetDataRef x86_64      = TargetDataFromTriple("amd64-unknown-unknown");

            Assert.AreEqual(4, x86.ABISizeOfType(pointerType));
            Assert.AreEqual(8, x86_64.ABISizeOfType(pointerType));
        }
Exemple #2
0
        public void SizeTest()
        {
            LLVMModuleRef          m          = LLVMModuleRef.CreateWithName("netscripten");
            LLVMExecutionEngineRef engineRef  = m.CreateExecutionEngine();
            LLVMTargetDataRef      target     = engineRef.TargetData;
            LLVMTypeRef            testStruct = LLVMTypeRef.CreateStruct(
                new[]
            {
                LLVMTypeRef.Int16,
                LLVMTypeRef.Int32
            }, true);

            Assert.AreEqual(48, target.SizeOfTypeInBits(testStruct));
            Assert.AreEqual(6, target.StoreSizeOfType(testStruct));
            Assert.AreEqual(6, target.ABISizeOfType(testStruct));
        }