Пример #1
0
        /// <summary>
        /// Helps int and ptr casting to a destination type.
        /// </summary>
        /// <param name="builder">The builder.</param>
        /// <param name="data">The data (int or pointer).</param>
        /// <param name="dataType">The data type.</param>
        /// <param name="destType">The destination type.</param>
        /// <param name="name">The name of the cast.</param>
        public static void HelpIntAndPtrCast(BuilderRef builder, ref ValueRef data, ref TypeRef dataType, TypeRef destType, string name)
        {
            // Two cases: int to different size, or int to pointer.
            TypeKind kind = LLVM.GetTypeKind(destType);

            // Convert to pointer.
            if (kind == TypeKind.PointerTypeKind)
            {
                // Two cases: pointer to pointer, or int to ptr.
                if (LLVM.GetTypeKind(dataType) == TypeKind.PointerTypeKind)
                {
                    data = LLVM.BuildPointerCast(builder, data, destType, name);
                }
                else
                {
                    data = LLVM.BuildIntToPtr(builder, data, destType, name);
                }
            }
            // Convert to int of different size.
            else
            {
                data = LLVM.BuildIntCast(builder, data, destType, name);
            }

            dataType = destType;
        }
Пример #2
0
        /// <summary>
        /// Emits a stind instruction.
        /// </summary>
        /// <param name="instruction">The instruction.</param>
        /// <param name="context">The context.</param>
        /// <param name="builder">The builder.</param>
        public void Emit(Instruction instruction, MethodContext context, BuilderRef builder)
        {
            StackElement value   = context.CurrentStack.Pop();
            StackElement pointer = context.CurrentStack.Pop();

            ValueRef val         = value.Value;
            ValueRef ptr         = pointer.Value;
            TypeRef  destType    = TypeHelper.GetTypeRefFromStOrLdind(instruction.OpCode.Code);
            TypeRef  destPtrType = LLVM.PointerType(destType, 0);

            if (destPtrType != pointer.Type)
            {
                // There is no instruction for a Stind to store a boolean, so we need to check manually.
                if (pointer.Type == LLVM.PointerType(TypeHelper.Boolean, 0))
                {
                    destType = TypeHelper.Boolean;
                }
                // We treat char as 8-bit.
                else if (pointer.Type == LLVM.PointerType(TypeHelper.Int8, 0))
                {
                    destType = TypeHelper.Int8;
                }

                val = LLVM.BuildIntCast(builder, val, destType, "stindcast");

                // If the pointer is a native int, convert to a pointer of the appropriate type.
                if (pointer.Type == TypeHelper.NativeIntType)
                {
                    ptr = LLVM.BuildIntToPtr(builder, ptr, destPtrType, "int2ptr");
                }
            }

            LLVM.BuildStore(builder, val, ptr);
        }
Пример #3
0
        public VALUE(ValueRef v)
        {
            _value_ref = v;
            TypeRef t = LLVM.TypeOf(v);

            _type = new TYPE(t);
        }
Пример #4
0
        /// <summary>
        /// Emits a localloc instruction.
        /// </summary>
        /// <param name="instruction">The instruction.</param>
        /// <param name="context">The context.</param>
        /// <param name="builder">The builder.</param>
        public void Emit(Instruction instruction, MethodContext context, BuilderRef builder)
        {
            StackElement size   = context.CurrentStack.Pop();
            ValueRef     result = LLVM.BuildArrayAlloca(builder, TypeHelper.Int8, size.Value, "stackalloc");

            context.CurrentStack.Push(new StackElement(result, typeof(byte[]).GetTypeReference()));
        }
Пример #5
0
        /// <summary>
        /// Emits a stfld instruction.
        /// </summary>
        /// <param name="instruction">The instruction.</param>
        /// <param name="context">The context.</param>
        /// <param name="builder">The builder.</param>
        public void Emit(Instruction instruction, MethodContext context, BuilderRef builder)
        {
            StackElement   value = context.CurrentStack.Pop();
            StackElement   obj   = context.CurrentStack.Pop();
            FieldReference field = (FieldReference)instruction.Operand;

            uint index = context.Compiler.Lookup.GetFieldIndex(field);

            ValueRef ptr = LLVM.BuildInBoundsGEP(builder, obj.Value, new ValueRef[] { LLVM.ConstInt(TypeHelper.Int32, 0, false), LLVM.ConstInt(TypeHelper.Int32, index, false) }, "field");

            // Possible cast needed.
            TypeRef destType = TypeHelper.GetTypeRefFromType(field.FieldType);

            if (value.Type != destType)
            {
                CastHelper.HelpIntAndPtrCast(builder, ref value.Value, ref value.Type, destType, "stfldcast");
            }

            ValueRef store = LLVM.BuildStore(builder, value.Value, ptr);

            if (instruction.HasPrefix(Code.Volatile))
            {
                LLVM.SetVolatile(store, true);
            }
        }
Пример #6
0
        private void PInvokeEmitGlobals()
        {
            // Add ThunkPointers global, which contains the addresses of our thunk functions
            var thunkPointers = LLVM.AddGlobal(module, LLVM.ArrayType(intPtrLLVM, 4096), "ThunkPointers");

            if (TestMode)
            {
                LLVM.SetInitializer(thunkPointers, LLVM.ConstNull(LLVM.GetElementType(LLVM.TypeOf(thunkPointers))));
                return;
            }

            ValueRef[] thunkPointersData = new ValueRef[PInvokeThunkCount];
            for (int i = 0; i < PInvokeThunkCount; ++i)
            {
                thunkPointersData[i] = LLVM.AddGlobal(module, LLVM.GetElementType(intPtrLLVM), string.Format("thunk{0}", i));
            }
            LLVM.SetInitializer(thunkPointers, LLVM.ConstArray(intPtrLLVM, thunkPointersData));

            // Add TLS variable for storing current thunk ID
            var thunkCurrentId = LLVM.AddGlobal(module, int32LLVM, "ThunkCurrentId");

            LLVM.SetThreadLocal(thunkCurrentId, true);

            var pinvokeThunks = PInvokeEmitThunks();

            LLVM.SetModuleInlineAsm(module, pinvokeThunks.ToString());
        }
Пример #7
0
        /// <summary>
        /// Emits a not instruction.
        /// </summary>
        /// <param name="instruction">The instruction.</param>
        /// <param name="context">The context.</param>
        /// <param name="builder">The builder.</param>
        public void Emit(Instruction instruction, MethodContext context, BuilderRef builder)
        {
            StackElement value  = context.CurrentStack.Pop();
            ValueRef     result = LLVM.BuildNot(builder, value.Value, "not");

            context.CurrentStack.Push(new StackElement(result, value.ILType, value.Type));
        }
Пример #8
0
        /// <summary>
        /// Emits a Ldind instruction.
        /// </summary>
        /// <param name="instruction">The instruction.</param>
        /// <param name="context">The context.</param>
        /// <param name="builder">The builder.</param>
        public void Emit(Instruction instruction, MethodContext context, BuilderRef builder)
        {
            Code         code    = instruction.OpCode.Code;
            StackElement pointer = context.CurrentStack.Pop();

            ValueRef ptr     = pointer.Value;
            TypeRef  ptrType = LLVM.PointerType(TypeHelper.GetTypeRefFromStOrLdind(code), 0);

            if (pointer.Type != ptrType)
            {
                CastHelper.HelpIntAndPtrCast(builder, ref ptr, ref pointer.Type, ptrType, "ldindcast");
            }

            ValueRef res = LLVM.BuildLoad(builder, ptr, "elem");

            // Some need to be pushed as an int32 on the stack.
            if (code == Code.Ldind_I1 || code == Code.Ldind_I2 || code == Code.Ldind_I4 ||
                code == Code.Ldind_U1 || code == Code.Ldind_U2 || code == Code.Ldind_U4)
            {
                res = LLVM.BuildIntCast(builder, res, TypeHelper.Int32, "tmp");
            }

            TypeRef type = LLVM.TypeOf(res);

            context.CurrentStack.Push(new StackElement(res, TypeHelper.GetBasicTypeFromTypeRef(type), type));
        }
Пример #9
0
        /// <summary>
        /// Emits a ldfld instruction.
        /// </summary>
        /// <param name="instruction">The instruction.</param>
        /// <param name="context">The context.</param>
        /// <param name="builder">The builder.</param>
        public void Emit(Instruction instruction, MethodContext context, BuilderRef builder)
        {
            StackElement   obj   = context.CurrentStack.Pop();
            FieldReference field = (FieldReference)instruction.Operand;

            uint index = context.Compiler.Lookup.GetFieldIndex(field);

            // Create pointer if not yet a pointer.
            if (obj.ILType.IsValueType && !obj.ILType.IsPointer)
            {
                ValueRef objPtr = LLVM.BuildAlloca(builder, obj.Type, "objptr");
                LLVM.BuildStore(builder, obj.Value, objPtr);
                obj.Value = objPtr;
            }

            ValueRef ptr    = LLVM.BuildInBoundsGEP(builder, obj.Value, new ValueRef[] { LLVM.ConstInt(TypeHelper.Int32, 0, false), LLVM.ConstInt(TypeHelper.Int32, index, false) }, "field");
            ValueRef result = LLVM.BuildLoad(builder, ptr, "field");

            if (instruction.HasPrefix(Code.Volatile))
            {
                LLVM.SetVolatile(result, true);
            }

            context.CurrentStack.Push(new StackElement(result, field.FieldType));
        }
        /// <summary>
        /// Creates the System.String::get_Chars(int32) function.
        /// </summary>
        /// <param name="builder">The builder.</param>
        private void createStringGetCharsFunction(BuilderRef builder)
        {
            const string funcName = "System_Char_System_String_get_Chars_System_Int32";

            // Create function and set linkage.
            TypeRef  type = LLVM.FunctionType(TypeHelper.Int8, new TypeRef[] { TypeHelper.String, TypeHelper.Int32 }, false);
            ValueRef func = LLVM.AddFunction(mCompiler.Module, funcName, type);

            LLVM.SetLinkage(func, Linkage.LinkOnceAnyLinkage);
            LLVM.AddAttributeAtIndex(func, (uint)LLVM.AttributeFunctionIndex, LLVM.CreateEnumAttribute(mCompiler.ModuleContext, LLVM.GetEnumAttributeKindForName("alwaysinline", 12), 1));

            // Arguments.
            ValueRef str   = LLVM.GetParam(func, 0);
            ValueRef index = LLVM.GetParam(func, 1);

            // Create function body.
            BasicBlockRef entry = LLVM.AppendBasicBlock(func, string.Empty);

            LLVM.PositionBuilderAtEnd(builder, entry);
            ValueRef ch        = LLVM.BuildGEP(builder, str, new ValueRef[] { index }, "charptr");
            ValueRef returnVal = LLVM.BuildLoad(builder, ch, "character");

            LLVM.BuildRet(builder, returnVal);

            mCompiler.Lookup.AddFunction(funcName, func);
        }
Пример #11
0
        public Function(Type declaringType, MethodReference methodReference, TypeRef functionType, ValueRef generatedValue, FunctionSignature signature)
        {
            Signature       = signature;
            DeclaringType   = declaringType;
            MethodReference = methodReference;
            FunctionType    = functionType;
            GeneratedValue  = generatedValue;
            VirtualSlot     = -1;

            MethodDefinition = methodReference.Resolve();

            ParameterTypes = signature.ParameterTypes.Select(x => x.Type).ToArray();

            // Generate function type when being called from vtable/IMT (if it applies)
            // If declaring type is a value type, needs to unbox "this" for virtual method
            if (DeclaringType.TypeDefinitionCecil.IsValueType &&
                (MethodDefinition.Attributes & MethodAttributes.Virtual) != 0)
            {
                bool hasStructValueReturn = signature.ReturnType.ABIParameterInfo.Kind == ABIParameterInfoKind.Indirect;

                // Create function type with boxed "this"
                var argumentCount = LLVM.CountParamTypes(FunctionType);
                var argumentTypes = new TypeRef[argumentCount];
                LLVM.GetParamTypes(FunctionType, argumentTypes);
                // Change first type to boxed "this"
                var thisIndex = hasStructValueReturn ? 1 : 0;
                argumentTypes[thisIndex] = LLVM.PointerType(DeclaringType.ObjectTypeLLVM, 0);
                VirtualFunctionType      = LLVM.FunctionType(LLVM.GetReturnType(FunctionType), argumentTypes, LLVM.IsFunctionVarArg(FunctionType));
            }
            else
            {
                VirtualFunctionType = FunctionType;
            }
        }
Пример #12
0
        /// <summary>
        /// Emits a stloc instruction
        /// </summary>
        /// <param name="instruction">The instruction.</param>
        /// <param name="context">The context.</param>
        /// <param name="builder">The builder.</param>
        public void Emit(Instruction instruction, MethodContext context, BuilderRef builder)
        {
            Code code = instruction.OpCode.Code;

            int index;

            if (code >= Code.Stloc_0 && code <= Code.Stloc_3)
            {
                index = instruction.OpCode.Code - Code.Stloc_0;
            }
            else
            {
                VariableDefinition def = (VariableDefinition)instruction.Operand;
                index = def.Index;
            }

            StackElement element  = context.CurrentStack.Pop();
            ValueRef     data     = element.Value;
            TypeRef      destType = context.LocalTypes[index];

            // Possible cast needed.
            if (element.Type != destType)
            {
                CastHelper.HelpIntAndPtrCast(builder, ref data, ref element.Type, destType, "stloccast");
            }

            LLVM.BuildStore(builder, data, context.LocalValues[index]);
        }
Пример #13
0
        /// <summary>
        /// Emits an add instruction.
        /// </summary>
        /// <param name="instruction">The instruction.</param>
        /// <param name="context">The context.</param>
        /// <param name="builder">The builder.</param>
        public void Emit(Instruction instruction, MethodContext context, BuilderRef builder)
        {
            StackElement value2 = context.CurrentStack.Pop();
            StackElement value1 = context.CurrentStack.Pop();

            if (TypeHelper.IsFloatingPoint(value1) || TypeHelper.IsFloatingPoint(value2))
            {
                ValueRef result = LLVM.BuildFAdd(builder, value1.Value, value2.Value, "addfp");
                context.CurrentStack.Push(new StackElement(result, value1.ILType, value1.Type));
            }
            else
            {
                bool isPtrVal1, isPtrVal2;
                CastHelper.HelpPossiblePtrCast(builder, ref value1, ref value2, out isPtrVal1, out isPtrVal2, "addcast");

                // If one of the two values is a pointer, then the result will be a pointer as well.
                if (isPtrVal1 || isPtrVal2)
                {
                    ValueRef      result          = LLVM.BuildAdd(builder, value1.Value, value2.Value, "addptr");
                    TypeRef       resultingType   = (isPtrVal1 ? value1.Type : value2.Type);
                    TypeReference resultingILType = (isPtrVal1 ? value1.ILType : value2.ILType);
                    ValueRef      ptr             = LLVM.BuildIntToPtr(builder, result, resultingType, "ptr");
                    context.CurrentStack.Push(new StackElement(ptr, resultingILType, resultingType));
                }
                // Cast to different int size.
                else
                {
                    CastHelper.HelpIntCast(builder, ref value1, ref value2);
                    ValueRef result = LLVM.BuildAdd(builder, value1.Value, value2.Value, "addi");
                    context.CurrentStack.Push(new StackElement(result, value1.ILType, value1.Type));
                }
            }
        }
Пример #14
0
            private object CreateModelValue <T>(object parentModel, int index) where T : struct
            {
                ValueRef <T> refmodel = new ValueRef <T>();

                ((TVirtualStringTree)TreeView).RaiseInitModelValue((T?)parentModel, refmodel, index);
                return(refmodel.Value);
            }
Пример #15
0
        /// <summary>
        /// Emits a ldftn instruction.
        /// </summary>
        /// <param name="instruction">The instruction.</param>
        /// <param name="context">The context.</param>
        /// <param name="builder">The builder.</param>
        public void Emit(Instruction instruction, MethodContext context, BuilderRef builder)
        {
            MethodDefinition method  = (MethodDefinition)instruction.Operand;
            ValueRef         result  = LLVM.BuildIntToPtr(builder, context.Compiler.Lookup.GetFunction(NameHelper.CreateMethodName(method)).Value, TypeHelper.NativeIntType, "ldftn");
            StackElement     element = new StackElement(result, typeof(IntPtr).GetTypeReference(), TypeHelper.NativeIntType);

            context.CurrentStack.Push(element);
        }
Пример #16
0
        public VALUE(ValueRef v, TYPE t)
        {
            _value_ref = v;
            TypeRef tt = LLVM.TypeOf(v);

            // Fails. Debug.Assert(t.IntermediateType == tt);
            _type = t;
        }
Пример #17
0
 public Function(Type declaringType, MethodReference methodReference, TypeRef functionType, ValueRef generatedValue, Type returnType, Type[] parameterTypes)
 {
     Signature       = new FunctionSignature(returnType, parameterTypes);
     DeclaringType   = declaringType;
     MethodReference = methodReference;
     FunctionType    = functionType;
     GeneratedValue  = generatedValue;
     VirtualSlot     = -1;
 }
Пример #18
0
 /// <summary>
 /// Emits a Ldc_I8 instruction.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="builder">The builder.</param>
 public void Emit(Instruction instruction, MethodContext context, BuilderRef builder)
 {
     TypeRef type = TypeHelper.Int64;
     unchecked
     {
         ValueRef result = LLVM.ConstInt(type, (ulong)(long)instruction.Operand, true);
         context.CurrentStack.Push(new StackElement(result, typeof(long).GetTypeReference(), type));
     }
 }
Пример #19
0
 public Function(Type declaringType, MethodReference methodReference, TypeRef functionType, ValueRef generatedValue, FunctionSignature signature)
 {
     Signature       = signature;
     DeclaringType   = declaringType;
     MethodReference = methodReference;
     FunctionType    = functionType;
     GeneratedValue  = generatedValue;
     VirtualSlot     = -1;
 }
Пример #20
0
        /// <summary>
        /// Emits a ldelema instruction.
        /// </summary>
        /// <param name="instruction">The instruction.</param>
        /// <param name="context">The context.</param>
        /// <param name="builder">The builder.</param>
        public void Emit(Instruction instruction, MethodContext context, BuilderRef builder)
        {
            StackElement index = context.CurrentStack.Pop();
            StackElement array = context.CurrentStack.Pop();

            ValueRef gep = LLVM.BuildGEP(builder, array.Value, new ValueRef[] { index.Value }, "arrayelemptr");

            context.CurrentStack.Push(new StackElement(gep, array.ILType, array.Type));
        }
Пример #21
0
        public void InitModelValue <T>(InitModelValueDelegate <T> initializer) where T : struct
        {
            if (!modelIsValueRef || refmodel == null)
            {
                throw new InvalidCastException();
            }
            ValueRef <T> modelref = (ValueRef <T>)refmodel;

            initializer(ref modelref.Value);
        }
Пример #22
0
        /// <summary>
        /// Emits a newobj instruction.
        /// </summary>
        /// <param name="instruction">The instruction.</param>
        /// <param name="context">The context.</param>
        /// <param name="builder">The builder.</param>
        public void Emit(Instruction instruction, MethodContext context, BuilderRef builder)
        {
            MethodReference ctor    = (MethodReference)instruction.Operand;
            TypeDefinition  objType = ctor.DeclaringType.Resolve();
            TypeRef         type    = TypeHelper.GetTypeRefFromType(ctor.DeclaringType);

            ValueRef objPtr;
            bool     ptr = (objType.IsClass && !objType.IsValueType);

            if (ptr)
            {
                // This type is a class, therefor we have a specialised "newobj" method.
                objPtr = LLVM.BuildCall(builder, context.Compiler.Lookup.GetNewobjMethod(ctor.DeclaringType.Resolve()), new ValueRef[0], "newobj");
            }
            else
            {
                // Not a class, allocate on stack.
                objPtr = LLVM.BuildAlloca(builder, type, "newobj");
            }

            // Constructor.
            ValueRef?ctorFunc = context.Compiler.Lookup.GetFunction(NameHelper.CreateMethodName(ctor));

            if (!ctorFunc.HasValue)
            {
                throw new Exception("Constructor not found: " + ctor);
            }

            // Get .ctor parameters.
            int paramCount = 1 + ctor.Parameters.Count;

            ValueRef[] values = new ValueRef[paramCount];
            values[0] = objPtr;
            for (int i = paramCount - 1; i >= 1; i--)
            {
                StackElement element = context.CurrentStack.Pop();
                values[i] = element.Value;

                // Cast needed?
                TypeRef paramType = TypeHelper.GetTypeRefFromType(ctor.Parameters[i - 1].ParameterType);
                if (element.Type != paramType)
                {
                    CastHelper.HelpIntAndPtrCast(builder, ref values[i], ref element.Type, paramType, "ctorcallcast");
                }
            }

            // Call .ctor.
            LLVM.BuildCall(builder, ctorFunc.Value, values, string.Empty);

            // Load and push object on stack.
            ValueRef obj = (ptr) ? objPtr : LLVM.BuildLoad(builder, objPtr, "obj");

            context.CurrentStack.Push(new StackElement(obj, ctor.DeclaringType, type));
        }
Пример #23
0
        /// <summary>
        /// Emits a starg instruction.
        /// </summary>
        /// <param name="instruction">The instruction.</param>
        /// <param name="context">The context.</param>
        /// <param name="builder">The builder.</param>
        public void Emit(Instruction instruction, MethodContext context, BuilderRef builder)
        {
            StackElement value = context.CurrentStack.Pop();

            ParameterDefinition def = (ParameterDefinition)instruction.Operand;
            int index = def.Index;

            ValueRef arg = context.ArgumentValues[index];

            CastHelper.HelpIntAndPtrCast(builder, ref value.Value, ref value.Type, TypeHelper.GetTypeRefFromType(context.ArgumentILTypes[index]), "stargcast");
            LLVM.BuildStore(builder, value.Value, arg);
        }
Пример #24
0
        /// <summary>
        /// Verifies and optimizes a function.
        /// </summary>
        /// <param name="function">The function.</param>
        public void VerifyAndOptimizeFunction(ValueRef function)
        {
            if (LLVM.VerifyFunction(function, VerifierFailureAction.ReturnStatusAction))
            {
                Console.ForegroundColor = ConsoleColor.Red;
                LLVM.VerifyFunction(function, VerifierFailureAction.PrintMessageAction);
                Console.ForegroundColor = ConsoleColor.Gray;
                throw new Exception("Compiling of function failed.");
            }

            LLVM.RunFunctionPassManager(mFunctionPassManager, function);
        }
Пример #25
0
 private static void SetInstructionFlags(ValueRef instruction, InstructionFlags instructionFlags)
 {
     // Set instruction flags (if necessary)
     if ((instructionFlags & InstructionFlags.Volatile) != 0)
     {
         LLVM.SetVolatile(instruction, true);
     }
     if ((instructionFlags & InstructionFlags.Unaligned) != 0)
     {
         LLVM.SetAlignment(instruction, 1);
     }
 }
Пример #26
0
        public Collidable(int w, int h, MovementController mc, LifeController lc, DamageController dc)
        {
            ID = -1;
            _width = w;
            _height = h;
            CollidedAt = new Vector2();            
            _bounds = new Rectangle(Convert.ToInt32(mc.Position.X), Convert.ToInt32(mc.Position.Y), _width, _height);
            MovementController = mc;
            LifeController = lc;
            DamageController = dc;
            Controllable = new ValueRef<bool>(true);

            _serverID = Interlocked.Increment(ref _itemCount);
        }
Пример #27
0
 public unsafe static void SetOperand(ValueRef User, uint Index, ValueRef Val) {
   LLVMPINVOKE.SetOperand(User.Value, Index, Val.Value);
 }
Пример #28
0
 public unsafe static UseRef GetOperandUse(ValueRef Val, uint Index) {
   UseRef ret = new UseRef(LLVMPINVOKE.GetOperandUse(Val.Value, Index));
   return ret;
 }
Пример #29
0
 public unsafe static ValueRef ConstStringInContext(ContextRef C, string Str, uint Length, bool DontNullTerminate) {
   ValueRef ret = new ValueRef(LLVMPINVOKE.ConstStringInContext(C.Value, Str, Length, DontNullTerminate));
   return ret;
 }
Пример #30
0
 public unsafe static ValueRef ConstRealOfString(TypeRef RealTy, string Text) {
   ValueRef ret = new ValueRef(LLVMPINVOKE.ConstRealOfString(RealTy.Value, Text));
   return ret;
 }
Пример #31
0
 public unsafe static ValueRef ConstIntOfStringAndSize(TypeRef IntTy, string Text, uint SLen, byte Radix) {
   ValueRef ret = new ValueRef(LLVMPINVOKE.ConstIntOfStringAndSize(IntTy.Value, Text, SLen, Radix));
   return ret;
 }
Пример #32
0
 public unsafe static ValueRef ConstPointerNull(TypeRef Ty) {
   ValueRef ret = new ValueRef(LLVMPINVOKE.ConstPointerNull(Ty.Value));
   return ret;
 }
Пример #33
0
 public unsafe static ValueRef GetUndef(TypeRef Ty) {
   ValueRef ret = new ValueRef(LLVMPINVOKE.GetUndef(Ty.Value));
   return ret;
 }
Пример #34
0
 public unsafe static ValueRef IsAUnaryInstruction(ValueRef Val) {
   ValueRef ret = new ValueRef(LLVMPINVOKE.IsAUnaryInstruction(Val.Value));
   return ret;
 }
Пример #35
0
 public unsafe static ValueRef IsAShuffleVectorInst(ValueRef Val) {
   ValueRef ret = new ValueRef(LLVMPINVOKE.IsAShuffleVectorInst(Val.Value));
   return ret;
 }
Пример #36
0
 public unsafe static ValueRef IsAPHINode(ValueRef Val) {
   ValueRef ret = new ValueRef(LLVMPINVOKE.IsAPHINode(Val.Value));
   return ret;
 }
Пример #37
0
 public unsafe static ValueRef IsAInsertElementInst(ValueRef Val) {
   ValueRef ret = new ValueRef(LLVMPINVOKE.IsAInsertElementInst(Val.Value));
   return ret;
 }
Пример #38
0
 public unsafe static ValueRef IsADbgInfoIntrinsic(ValueRef Val) {
   ValueRef ret = new ValueRef(LLVMPINVOKE.IsADbgInfoIntrinsic(Val.Value));
   return ret;
 }
Пример #39
0
 public unsafe static ValueRef IsABinaryOperator(ValueRef Val) {
   ValueRef ret = new ValueRef(LLVMPINVOKE.IsABinaryOperator(Val.Value));
   return ret;
 }
Пример #40
0
 public unsafe static int GetNumOperands(ValueRef Val) {
   int ret = LLVMPINVOKE.GetNumOperands(Val.Value);
   return ret;
 }
Пример #41
0
 public unsafe static ValueRef IsAAddrSpaceCastInst(ValueRef Val) {
   ValueRef ret = new ValueRef(LLVMPINVOKE.IsAAddrSpaceCastInst(Val.Value));
   return ret;
 }
Пример #42
0
 public unsafe static ValueRef ConstAllOnes(TypeRef Ty) {
   ValueRef ret = new ValueRef(LLVMPINVOKE.ConstAllOnes(Ty.Value));
   return ret;
 }
Пример #43
0
 public unsafe static ValueRef IsAVAArgInst(ValueRef Val) {
   ValueRef ret = new ValueRef(LLVMPINVOKE.IsAVAArgInst(Val.Value));
   return ret;
 }
Пример #44
0
 public unsafe static bool IsNull(ValueRef Val) {
   bool ret = LLVMPINVOKE.IsNull(Val.Value);
   return ret;
 }
Пример #45
0
 public unsafe static ValueRef IsAMDString(ValueRef Val) {
   ValueRef ret = new ValueRef(LLVMPINVOKE.IsAMDString(Val.Value));
   return ret;
 }
Пример #46
0
 public unsafe static ValueRef ConstInt(TypeRef IntTy, ulong N, bool SignExtend) {
   ValueRef ret = new ValueRef(LLVMPINVOKE.ConstInt(IntTy.Value, N, SignExtend));
   return ret;
 }
Пример #47
0
 public unsafe static UseRef GetFirstUse(ValueRef Val) {
   UseRef ret = new UseRef(LLVMPINVOKE.GetFirstUse(Val.Value));
   return ret;
 }
Пример #48
0
 public unsafe static ValueRef ConstReal(TypeRef RealTy, double N) {
   ValueRef ret = new ValueRef(LLVMPINVOKE.ConstReal(RealTy.Value, N));
   return ret;
 }
Пример #49
0
 public unsafe static ValueRef GetUsedValue(UseRef U) {
   ValueRef ret = new ValueRef(LLVMPINVOKE.GetUsedValue(U.Value));
   return ret;
 }
Пример #50
0
 public unsafe static ValueRef ConstRealOfStringAndSize(TypeRef RealTy, string Text, uint SLen) {
   ValueRef ret = new ValueRef(LLVMPINVOKE.ConstRealOfStringAndSize(RealTy.Value, Text, SLen));
   return ret;
 }
Пример #51
0
 public unsafe static long ConstIntGetSExtValue(ValueRef ConstantVal) {
   long ret = LLVMPINVOKE.ConstIntGetSExtValue(ConstantVal.Value);
   return ret;
 }
Пример #52
0
 public unsafe static double ConstRealGetDouble(ValueRef ConstantVal, out bool losesInfo) {
   double ret = LLVMPINVOKE.ConstRealGetDouble(ConstantVal.Value, out losesInfo);
   return ret;
 }
Пример #53
0
 public unsafe static ValueRef IsAConstantVector(ValueRef Val) {
   ValueRef ret = new ValueRef(LLVMPINVOKE.IsAConstantVector(Val.Value));
   return ret;
 }
Пример #54
0
 public Boost(ShipMovementController movementController, ValueRef<bool> controllable)
     : base(NAME, movementController)
 {
     _controllable = controllable;
 }
Пример #55
0
 public unsafe static ValueRef IsAGlobalVariable(ValueRef Val) {
   ValueRef ret = new ValueRef(LLVMPINVOKE.IsAGlobalVariable(Val.Value));
   return ret;
 }