Esempio n. 1
0
        public TypeRef(LLVMTypeRef* handle)
        {
            if(handle == null)
                throw new ArgumentNullException("handle");

            m_handle = handle;
        }
Esempio n. 2
0
        public TypeRef(LLVMTypeRef* handle, LLVMTypeRef* pointed = null)
        {
            if(handle == null)
                throw new ArgumentNullException("handle");

            m_handle = handle;
            m_pointedType = pointed;
        }
Esempio n. 3
0
        public TypeRef(LLVMTypeRef *handle, LLVMTypeRef *pointed = null)
        {
            if (handle == null)
            {
                throw new ArgumentNullException("handle");
            }

            m_handle      = handle;
            m_pointedType = pointed;
        }
Esempio n. 4
0
        /// <summary>
        /// Create a function with arguments and a return type.
        /// </summary>
        /// <param name="module"></param>
        /// <param name="name"></param>
        /// <param name="returnType"></param>
        /// <param name="paramTypes"></param>
        public Function(Module module, string name, TypeRef returnType, TypeRef[] paramTypes)
        {
            m_name = name;
            m_returnType = returnType;
            m_paramTypes = paramTypes;

            IntPtr[] paramArray = LLVMHelper.MarshallPointerArray(paramTypes);

            m_funcType = Native.FunctionType(returnType.Handle, paramArray, (uint)paramArray.Length, 0);
            m_handle = Native.AddFunction(module.Handle, name, m_funcType);
        }
Esempio n. 5
0
        /// <summary>
        /// Create a function with arguments and a return type.
        /// </summary>
        /// <param name="module"></param>
        /// <param name="name"></param>
        /// <param name="returnType"></param>
        /// <param name="paramTypes"></param>
        public Function(Module module, string name, TypeRef returnType, TypeRef[] paramTypes)
        {
            m_name       = name;
            m_returnType = returnType;
            m_paramTypes = paramTypes;

            IntPtr[] paramArray = LLVMHelper.MarshallPointerArray(paramTypes);

            m_funcType = Native.FunctionType(returnType.Handle, paramArray, (uint)paramArray.Length, 0);
            m_handle   = Native.AddFunction(module.Handle, name, m_funcType);
        }
Esempio n. 6
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]);
                }
            }
        }
Esempio n. 7
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]);
                }
            }
        }
Esempio n. 8
0
        public string GetLLVMType()
        {
            LLVMTypeRef *type = Native.TypeOf(this.Handle);

            return(Native.GetTypeKind(type).ToString());
        }
Esempio n. 9
0
        public static String GetType(Value val)
        {
            LLVMTypeRef *type = Native.TypeOf(val.Handle);

            return(Native.GetTypeKind(type).ToString());
        }