Пример #1
0
        public Value(LLVMValueRef* handle)
        {
            if(handle == null)
                throw new ArgumentNullException("handle");

            m_handle = handle;
        }
Пример #2
0
        public static bool Used(LLVMValueRef* value)
        {
            if(value == null)
                throw new ArgumentNullException("value");

            return Native.GetFirstUse(value) != null;
        }
Пример #3
0
        public static string GetName(LLVMValueRef* value)
        {
            if(value == null)
                throw new ArgumentNullException("value");

            IntPtr name = Native.GetValueName(value);
            if(name == null)
                return null;

            return System.Runtime.InteropServices.Marshal.PtrToStringAnsi(name);
        }
Пример #4
0
        public static int GetUseCount(LLVMValueRef* value)
        {
            if(value == null)
                throw new ArgumentNullException("value");

            LLVMUseRef* use = Native.GetFirstUse(value);
            int count = 0;

            while(use != null)
            {
                count++;
                use = Native.GetNextUse(use);
            }

            return count;
        }
Пример #5
0
        public Function(string name, LLVMValueRef* handle)
        {
            m_name = name;
            m_handle = handle;
            m_funcType = Native.GetElementType(Native.TypeOf(handle));
            m_returnType = new TypeRef(Native.GetReturnType(m_funcType));

            uint paramCount = Native.CountParamTypes(m_funcType);
            m_paramTypes = new TypeRef[paramCount];

            if(paramCount > 0)
            {
                IntPtr[] types = new IntPtr[paramCount];
                Native.GetParamTypes(m_funcType, types);

                for(int i = 0; i < paramCount; ++i)
                {
                    m_paramTypes[i] = new TypeRef((LLVMTypeRef*)types[i]);
                }
            }
        }
Пример #6
0
 internal ConstantPointerNull(LLVMValueRef valueRef)
     : base(valueRef)
 {
 }
Пример #7
0
 private static extern void LLVMSetOperand(LLVMValueRef @User, uint @Index, LLVMValueRef @Val);
Пример #8
0
 public static extern void ViewFunctionCFGOnly(LLVMValueRef* Fn);
Пример #9
0
 /// <summary>
 /// Emits LLVM IR instructions that test if the type corresponding
 /// to a type metadata handle is a subtype of another type.
 /// </summary>
 /// <param name="subtypeMetadata">
 /// A type metadata handle of a potential subtype.
 /// </param>
 /// <param name="supertype">
 /// A potential supertype.
 /// </param>
 /// <param name="module">
 /// The LLVM module to generate the instructions in.
 /// </param>
 /// <param name="builder">
 /// An instruction builder to use for emitting instructions.
 /// </param>
 /// <param name="name">
 /// A suggested name for the resulting Boolean value.
 /// </param>
 /// <returns>
 /// A Boolean value that is <c>true</c> if the type corresponding
 /// to <paramref name="subtypeMetadata"/> is a subtype of <paramref name="supertype"/>;
 /// otherwise, <c>false</c>.
 /// </returns>
 public abstract LLVMValueRef EmitIsSubtype(
     LLVMValueRef subtypeMetadata,
     IType supertype,
     ModuleBuilder module,
     IRBuilder builder,
     string name);
Пример #10
0
 public static extern LLVMGenericValueRef* RunFunction(LLVMExecutionEngineRef* EE, LLVMValueRef* F, uint NumArgs, System.IntPtr[] Args);
Пример #11
0
 public static extern void AddGlobalMapping(LLVMExecutionEngineRef* EE, LLVMValueRef* Global, System.IntPtr Addr);
Пример #12
0
 protected abstract LLVMValueRef ProcessFloating(MethodCompiler compiler, LLVMValueRef lhs, LLVMValueRef rhs, LLVMBuilderRef builder);
Пример #13
0
 public static extern LLVMValueRef* BuildIsNotNull(LLVMBuilderRef* LLVMBuilderRef, LLVMValueRef* Val, [In][MarshalAs(UnmanagedType.LPStr)] string Name);
Пример #14
0
 public BuiltinFunction(FunctionType type, LLVMValueRef function) : this(type)
 {
     this.function = function;
 }
Пример #15
0
 protected abstract LLVMValueRef ProcessIntegral(MethodCompiler compiler, LLVMValueRef lhs, LLVMValueRef rhs, LLVMBuilderRef builder);
Пример #16
0
 /// <summary>
 /// Emits instructions that load an object's metadata handle.
 /// </summary>
 /// <param name="objectPointer">An object to inspect for its metadata handle.</param>
 /// <param name="module">The module that defines the metadata-loading instructions.</param>
 /// <param name="builder">An instruction builder to use for emitting instructions.</param>
 /// <param name="name">A suggested name for the value that refers to the metadata.</param>
 /// <returns>A handle to the metadata.</returns>
 public abstract LLVMValueRef EmitLoadMetadata(
     LLVMValueRef objectPointer,
     ModuleBuilder module,
     IRBuilder builder,
     string name);
Пример #17
0
 /// <summary>
 /// Emits instructions that allocate a GC-managed instance of a type.
 /// </summary>
 /// <param name="type">A type to instantiate.</param>
 /// <param name="tailRoom">A number of bytes to allocate after the end of the object.</param>
 /// <param name="module">The module that defines the object-allocating instructions.</param>
 /// <param name="builder">An instruction builder to use for emitting instructions.</param>
 /// <param name="name">A suggested name for the value that refers to the allocated object.</param>
 /// <returns>A pointer to the allocated object.</returns>
 public abstract LLVMValueRef EmitAllocObject(
     IType type,
     LLVMValueRef tailRoom,
     ModuleBuilder module,
     IRBuilder builder,
     string name);
Пример #18
0
 private static extern int LLVMGetNumOperands(LLVMValueRef @Val);
Пример #19
0
 public static extern LLVMValueRef* BuildVAArg(LLVMBuilderRef* LLVMBuilderRef, LLVMValueRef* List, LLVMTypeRef* Ty, [In][MarshalAs(UnmanagedType.LPStr)] string Name);
Пример #20
0
 /// <summary>
 /// Initializes new instance of ExpressionEntry
 /// </summary>
 /// <param name="kind">Kind of entry</param>
 /// <param name="name">String representation of entry</param>
 /// <param name="type">Type if any of entry</param>
 public ExpressionEntry(StackValueKind kind, string name, LLVMValueRef llvmValue, TypeDesc type = null) : base(kind, type)
 {
     Name         = name;
     RawLLVMValue = llvmValue;
 }
Пример #21
0
 public static extern LLVMValueRef* BuildShuffleVector(LLVMBuilderRef* LLVMBuilderRef, LLVMValueRef* V1, LLVMValueRef* V2, LLVMValueRef* Mask, [In][MarshalAs(UnmanagedType.LPStr)] string Name);
Пример #22
0
 /// <summary>
 /// Initializes new instance of ExpressionEntry
 /// </summary>
 /// <param name="kind">Kind of entry</param>
 /// <param name="name">String representation of entry</param>
 /// <param name="type">Type if any of entry</param>
 public AddressExpressionEntry(StackValueKind kind, string name, LLVMValueRef llvmValue, TypeDesc type = null) : base(kind, name, llvmValue, type)
 {
 }
Пример #23
0
 public static extern int RunFunctionPassManager(LLVMPassManagerRef* FPM, LLVMValueRef* F);
Пример #24
0
 internal ConstantVector(LLVMValueRef valueRef)
     : base(valueRef)
 {
 }
Пример #25
0
 public static extern int FindFunction(LLVMExecutionEngineRef* EE, [In][MarshalAs(UnmanagedType.LPStr)] string Name, ref LLVMValueRef * OutFn);
Пример #26
0
 internal FPExt(LLVMValueRef valueRef)
     : base(valueRef)
 {
 }
Пример #27
0
 public static extern uint PreferredAlignmentOfGlobal(LLVMTargetDataRef* LLVMTargetDataRef, LLVMValueRef* GlobalVar);
Пример #28
0
 internal Trunc(LLVMValueRef valueRef)
     : base(valueRef)
 {
 }
Пример #29
0
 public static extern LLVMValueRef* GetNextFunction(LLVMValueRef* Fn);
Пример #30
0
 public static extern LLVMValueRef* BuildFPCast(LLVMBuilderRef* LLVMBuilderRef, LLVMValueRef* Val, LLVMTypeRef* DestTy, [In][MarshalAs(UnmanagedType.LPStr)] string Name);
Пример #31
0
 internal UIToFP(LLVMValueRef valueRef)
     : base(valueRef)
 {
 }
Пример #32
0
 public static extern LLVMValueRef* BuildCall(LLVMBuilderRef* LLVMBuilderRef, LLVMValueRef* Fn, System.IntPtr[] Args, uint NumArgs, [In][MarshalAs(UnmanagedType.LPStr)] string Name);
Пример #33
0
 internal AtomicCmpXchg(LLVMValueRef valueRef)
     : base(valueRef)
 {
 }
Пример #34
0
 private static extern LLVMValueRef LLVMGetOperand(LLVMValueRef @Val, uint @Index);
Пример #35
0
 public static extern void SetVolatile(LLVMValueRef* MemoryAccessInst, int IsVolatile);
Пример #36
0
 public Number()
 {
     this.State = NumberState.Ok;
     this.Kind  = Semantics.DefaultKind;
     this.Value = LLVM.ConstInt(GetLLVMType(), 0, new LLVMBool(0));
 }
Пример #37
0
 public static extern LLVMValueRef* BuildFCmp(LLVMBuilderRef* LLVMBuilderRef, LLVMRealPredicate Op, LLVMValueRef* LHS, LLVMValueRef* RHS, [In][MarshalAs(UnmanagedType.LPStr)] string Name);
Пример #38
0
 void LoadZeroExternalValue()
 {
     this.ExternalValue = LLVM.ConstInt(GetLLVMType(internalType: false), 0, new LLVMBool(0));
 }
Пример #39
0
 public static extern LLVMValueRef* BuildSelect(LLVMBuilderRef* LLVMBuilderRef, LLVMValueRef* If, LLVMValueRef* Then, LLVMValueRef* Else, [In][MarshalAs(UnmanagedType.LPStr)] string Name);
Пример #40
0
 protected TerminatorInst(LLVMValueRef instance)
     : base(instance)
 {
 }
Пример #41
0
 public static extern LLVMValueRef* BuildInsertElement(LLVMBuilderRef* LLVMBuilderRef, LLVMValueRef* VecVal, LLVMValueRef* EltVal, LLVMValueRef* Index, [In][MarshalAs(UnmanagedType.LPStr)] string Name);
Пример #42
0
 internal IntToPointer(LLVMValueRef valueRef)
     : base(valueRef)
 {
 }
Пример #43
0
 public static extern LLVMValueRef* BuildInsertValue(LLVMBuilderRef* LLVMBuilderRef, LLVMValueRef* AggVal, LLVMValueRef* EltVal, uint Index, [In][MarshalAs(UnmanagedType.LPStr)] string Name);
Пример #44
0
 internal FNeg(LLVMValueRef instance)
     : base(instance)
 {
 }
Пример #45
0
 public static extern LLVMValueRef* BuildPtrDiff(LLVMBuilderRef* LLVMBuilderRef, LLVMValueRef* LHS, LLVMValueRef* RHS, [In][MarshalAs(UnmanagedType.LPStr)] string Name);
Пример #46
0
 public static LLVMValueRef IppExp(this CodeGenerator g, LLVMValueRef a, string name = "")
 => g.Call(FunctionNames.Exp64FI, new[] { a, g.NPaths }, name);
Пример #47
0
 public static extern int RunFunctionAsMain(LLVMExecutionEngineRef* EE, LLVMValueRef* F, uint ArgC, [MarshalAs(UnmanagedType.LPStr)] ref StringBuilder ArgV, [MarshalAs(UnmanagedType.LPStr)] ref StringBuilder EnvP);
Пример #48
0
 public static LLVMValueRef IppCpy(this CodeGenerator g, LLVMValueRef a, LLVMValueRef b, string name = "", LLVMValueRef?length = null)
 => g.Call(FunctionNames.Copy64F, new[] { a, b, length ?? g.NPaths }, name);
Пример #49
0
 public static extern void FreeMachineCodeForFunction(LLVMExecutionEngineRef* EE, LLVMValueRef* F);
Пример #50
0
 public static LLVMValueRef IppSet(this CodeGenerator g, double value, LLVMValueRef vector, string name = "", LLVMValueRef?length = null) =>
 value == 0.0 ? g.Call(FunctionNames.Zero64F,
                       new[] { vector, length ?? g.NPaths },
                       name) : g.Call(FunctionNames.Set64F, new[] { g.Const(value), vector, length ?? g.NPaths }, name);
Пример #51
0
 public static extern System.IntPtr RecompileAndRelinkFunction(LLVMExecutionEngineRef* EE, LLVMValueRef* Fn);
Пример #52
0
 public static IppMallocHandle Allocate(this CodeGenerator g, LLVMValueRef count, string name = "")
 => new IppMallocHandle(g, g.Call(FunctionNames.Malloc64F, new[] { count }, name));
Пример #53
0
 public static extern System.IntPtr GetPointerToGlobal(LLVMExecutionEngineRef* EE, LLVMValueRef* Global);
Пример #54
0
 public static LLVMValueRef IppAdd(this CodeGenerator g, LLVMValueRef a, LLVMValueRef b, string name = "")
 => g.Call(FunctionNames.Add64FI, new[] { a, b, g.NPaths }, name);
Пример #55
0
 public static extern int VerifyFunction(LLVMValueRef* Fn, LLVMVerifierFailureAction Action);
Пример #56
0
 internal Cast(LLVMValueRef valueRef)
     : base(valueRef)
 {
 }
Пример #57
0
 public static extern void AddNamedMetadataOperand(LLVMModuleRef* M, [In][MarshalAs(UnmanagedType.LPStr)] string name, LLVMValueRef* Val);
Пример #58
0
 public static LLVMValueRef BuildAtomicCmpXchg(this LLVMBuilderRef builder, LLVMValueRef ptr, LLVMValueRef cmp,
                                               LLVMValueRef @new, LLVMAtomicOrdering successOrdering, LLVMAtomicOrdering failureOrdering,
                                               bool singleThread) =>
 LLVM.BuildAtomicCmpXchg(builder, ptr, cmp, @new, successOrdering, failureOrdering, singleThread ? 1 : 0);
Пример #59
0
 public static extern LLVMValueRef* GetPreviousFunction(LLVMValueRef* Fn);
Пример #60
0
 /// <summary>
 /// Builds LLVM IR instructions that perform a virtual method lookup:
 /// loads the address of the implementation of a virtual method given
 /// a type metadata pointer for the 'this' type.
 /// </summary>
 /// <param name="callee">
 /// A virtual method to find an implementation for.
 /// </param>
 /// <param name="metadata">
 /// A handle to the type metadata of the 'this' type.
 /// </param>
 /// <param name="module">
 /// The LLVM module to generate the instructions in.
 /// </param>
 /// <param name="builder">
 /// An instruction builder to use for emitting instructions.
 /// </param>
 /// <param name="name">
 /// A suggested name for the value that refers to the method
 /// implementation address.
 /// </param>
 /// <returns>A pointer to a method implementation.</returns>
 public abstract LLVMValueRef EmitMethodAddress(
     IMethod callee,
     LLVMValueRef metadata,
     ModuleBuilder module,
     IRBuilder builder,
     string name);