search for: llvmaddfunction

Displaying 16 results from an estimated 16 matches for "llvmaddfunction".

2012 Mar 28
0
[LLVMdev] GSoC 2012 Proposal: Python bindings for LLVM
...). So let’s take a look at what this constructor is? It is also defined in the file *core.py* in llvm-py as the following: *class Function(GlobalValue): @staticmethod def new(module, func_ty, name): check_is_module(module) check_is_type(func_ty) return _make_value(_core.LLVMAddFunction(module.ptr, name, func_ty.ptr))* The most important statement in the above constructor is: *_core.LLVMAddFunction(module.ptr, name, func_ty.ptr) * If you are familiar with C extensions for Python, you could guess that LLVMAddFunction should be defined in the low-level wrapper file *_c...
2015 Feb 19
4
[LLVMdev] Parameter names in IR and debug info
...the formal parameters? To create a function in llvm IR and give names to its formal parameters, I must: 1. Build a LLVMTypeRef for the type of each formal and the function result. 2. Build a function type using LLVMFunctionType, from the results of 1. 3. Build a function (an LLVMValueRef), using LLVMAddFunction, from the result of 2. 4. Get the LLVMValueRef for each formal (apparently, these are constructed inside LLVMAddFunction), using LLVMGetParam, from the result of 3. 5. Set the formal name using LLVMSetValueName, from each result of 5. Which appears to imply that the formal names are part of th...
2010 Aug 12
3
[LLVMdev] LLVM-C: Calling functions contained in other libraries
...To add some code to my previous question: LLVMTypeRef i8Ptr(void) { return LLVMPointerType(LLVMInt8Type(), 0); } LLVMValueRef d(LLVMModuleRef module) { LLVMValueRef result; LLVMBasicBlockRef block; LLVMBuilderRef builder = LLVMCreateBuilder(); LLVMValueRef fullUsername = LLVMAddFunction(module, "NSFullUserName", LLVMFunctionType(LLVMPointerType(LLVMInt8Type(), 0), NULL, 0, 0)); LLVMSetLinkage(fullUsername, LLVMExternalLinkage); result = LLVMAddFunction(module, "MyFunction", LLVMFunctionType(i8Ptr(), NULL, 0, 0)); block = LLVMAppendBasicBlock(re...
2012 Sep 27
0
[LLVMdev] Possible bug or misunderstanding of feature LLVMConstIntOfString
...main" function type definition: LLVMTypeRef ppInt8 = LLVMPointerType(LLVMPointerType(LLVMInt8Type(), 0), 0); LLVMTypeRef vpMainFuncTypes[] = { LLVMInt32Type(), ppInt8 }; LLVMTypeRef rMainFuncType = LLVMFunctionType(LLVMInt32Type(), vpMainFuncTypes, 2, 0); LLVMValueRef vFnMain = LLVMAddFunction(modCEx, "main", rMainFuncType); LLVMSetFunctionCallConv(vFnMain, LLVMCCallConv); LLVMBasicBlockRef bEntry = LLVMAppendBasicBlock(vFnMain, "entry"); LLVMBuilderRef bldr = LLVMCreateBuilder(); LLVMPositionBuilderAtEnd(bldr, bEntry); // "C" printf f...
2009 Nov 05
2
[LLVMdev] Strange error for libLLVMCore.a
...ned reference to `LLVMModuleCreateWithName' c:\Work\llvm//fac.c:21: undefined reference to `LLVMInt32Type' c:\Work\llvm//fac.c:22: undefined reference to `LLVMInt32Type' c:\Work\llvm//fac.c:22: undefined reference to `LLVMFunctionType' c:\Work\llvm//fac.c:22: undefined reference to `LLVMAddFunction' c:\Work\llvm//fac.c:23: undefined reference to `LLVMSetFunctionCallConv' c:\Work\llvm//fac.c:24: undefined reference to `LLVMGetParam' c:\Work\llvm//fac.c:26: undefined reference to `LLVMAppendBasicBlock' c:\Work\llvm//fac.c:27: undefined reference to `LLVMAppendBasicBlock' c:\...
2017 Aug 17
3
How do set 'nest' addribute in an indirect call?
...set the 'next' attribute on a parameter. If the function is to be directly called, i.e., a function constant, I am getting what I want as follows (using the C 'Core.h' binding) 1) Build a function type, using LLVMFunctionType. 2) Build a function value, passing the result of 1) to LLVMAddFunction 3) Go through the formal parameters of 2), using LLVMGet[First|Next]Param, which give me a value for each formal 4) For the desired formal, pass it to LLVMAddAttribute. This results in compiled code that passes my parameter in the same way as gcc, giving the interoperability I need. For an in...
2015 Feb 19
2
[LLVMdev] Beginner GCRoot Questions
...dly, if this is true, does it then mean that this variable is only accessible to C/C++ land? In turn I'll have some sort of main.cpp that will then be linked with llc output? My second question is about GCRoot intrinsic and ShadowStack? I've read up about intrinsics and it seems if I call LLVMAddFunction("llvm.*") .. it will be treated in special way by the code generator? If I set my GC to Shadowstack and mark all object pointers as GCroots, will this be 100% correct? Or do I need to myself in my code gen phase spill registers? Or does ShadowStack essentially do that for me? I guess my...
2012 Apr 25
2
[LLVMdev] Crash in JIT
...LLVMSetTarget(module, "i686-apple-darwin11"); LLVMTypeRef int32 = LLVMInt32TypeInContext(llvm); LLVMTypeRef funcType; LLVMTypeRef threeInts[] = {int32, int32, int32}; funcType = LLVMFunctionType(int32, threeInts, 3, 0); LLVMValueRef func; func = LLVMAddFunction(module, "functionName", funcType); LLVMValueRef mParam = LLVMGetParam(func, 0); LLVMSetValueName(mParam, "m"); LLVMValueRef xParam = LLVMGetParam(func, 1); LLVMSetValueName(xParam, "x"); LLVMValueRef bParam = LLVMGetParam(func, 2); LL...
2009 Nov 05
0
[LLVMdev] Strange error for libLLVMCore.a
you want to use the execution engine and JIT but do not put them in the llvm-config line?? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091106/d26a0a02/attachment.html>
2012 Apr 25
0
[LLVMdev] Crash in JIT
...correct? LLVMSetTarget(module, "i686-apple-darwin11"); LLVMTypeRef int32 = LLVMInt32TypeInContext(llvm); LLVMTypeRef funcType; LLVMTypeRef threeInts[] = {int32, int32, int32}; funcType = LLVMFunctionType(int32, threeInts, 3, 0); LLVMValueRef func; func = LLVMAddFunction(module, "functionName", funcType); LLVMValueRef mParam = LLVMGetParam(func, 0); LLVMSetValueName(mParam, "m"); LLVMValueRef xParam = LLVMGetParam(func, 1); LLVMSetValueName(xParam, "x"); LLVMValueRef bParam = LLVMGetParam(func, 2); LLVMSetV...
2010 Sep 07
0
[LLVMdev] Intrinsic prototype has incorrect number of arguments!
On Sep 7, 2010, at 8:03 AM, F van der Meeren wrote: > Hello, > > I have a question, what is wrong with the following code? > > declare void @llvm.memcpy.p0i64.p0i64.i8(i64*, i64*, i8, i32, i1) nounwind > > ... > > call void @llvm.memcpy.p0i64.p0i64.i8(i64* %19, i64* %21, i8 %17, i32 0, i1 false) > > ... > > > According to the compiler this is the
2010 Sep 07
2
[LLVMdev] Intrinsic prototype has incorrect number of arguments!
...tType, srcType, lengthType, LLVMInt32TypeInContext(context), LLVMInt1TypeInContext(context), }; functionType = LLVMFunctionType(LLVMVoidTypeInContext(context), paramTypes, numberOfArguments, false); function = LLVMAddFunction(module, methodName, functionType); LLVMRemoveAttribute(LLVMGetParam(function, 0), LLVMNoCaptureAttribute); LLVMRemoveAttribute(LLVMGetParam(function, 1), LLVMNoCaptureAttribute); } And then invoked it with this: LLVMValueRef args[] = { sourcePtr, destinationPtr, le...
2017 Jan 25
2
mcjit C interface problems
...39;s example code: int main(int argc, char const* argv[]) { LLVMModuleRef mod = LLVMModuleCreateWithName("my_module"); LLVMTypeRef param_types[] = {LLVMInt32Type(), LLVMInt32Type()}; LLVMTypeRef ret_type = LLVMFunctionType(LLVMInt32Type(), param_types, 2, 0); LLVMValueRef sum = LLVMAddFunction(mod, "sum", ret_type); LLVMBasicBlockRef entry = LLVMAppendBasicBlock(sum, "entry"); LLVMBuilderRef builder = LLVMCreateBuilder(); LLVMPositionBuilderAtEnd(builder, entry); LLVMValueRef tmp = LLVMBuildAdd(builder, LLVMGetParam(sum, 0), LLVMGetParam(sum, 1), "tmp&q...
2011 Jun 18
1
[LLVMdev] loop only executes once
...rce of function Procedure CreateFibFunction(M.i,Context.i) intType = LLVMInt32Type() //Function returns an int And takes an int As the only parameter. FunctionReturnType = LLVMFunctionType(IntType, at IntType,1,0) //Create the fib function definition And insert it into the module M. Fib2 = LLVMAddFunction(M, "fib2",FunctionReturnType) //Set the function call convention To FastCall so it can utilize tail call LLVMSetFunctionCallConv(Fib2,#LLVMFastCallConv) //Get a pointer To the ArgX.i And add To function... ArgX = LLVMGetFirstParam(Fib2) // Get the arg. LLVMSetValueName(ArgX, "ArgX&...
2010 Sep 07
4
[LLVMdev] Intrinsic prototype has incorrect number of arguments!
Hello, I have a question, what is wrong with the following code? declare void @llvm.memcpy.p0i64.p0i64.i8(i64*, i64*, i8, i32, i1) nounwind ... call void @llvm.memcpy.p0i64.p0i64.i8(i64* %19, i64* %21, i8 %17, i32 0, i1 false) ... According to the compiler this is the error, but I seem to miss where exactly my fault is. Intrinsic prototype has incorrect number of arguments! void (i64*,
2013 Sep 30
1
[LLVMdev] RFC: llvm-shlib-test (Was: [llvm] r191029 - llvm-c: Make LLVMGetFirstTarget a proper prototype)
Attached is what I got thus far. What I'm struggling with is proper integration in build system. What is in there is just wild guesses from my side, both on autoconf and cmake variants. It would be great if someone with proper knowledge of the buildsystems could have a look. Also I'm not sure how to properly handle compilation on msvc - clearly "-std=c11 -Wstrict-prototypes" is