similar to: [LLVMdev] Adding a New Instruction to LLVM IR

Displaying 20 results from an estimated 3000 matches similar to: "[LLVMdev] Adding a New Instruction to LLVM IR"

2012 May 20
1
[LLVMdev] Error While Inserting New Instruction to LLVM IR
Hello; I wanted to insert two new terminator instructions in LLVM IR. I modified the necessary files (as mentioned in the tutorial in LLVM site and some more to meet the new structure of LLVM, (e.g no Lexer.l now, we have LLLexer.cpp. Again in the tutorial, files like LLVMBitCodes.h, include/llvm-c/core.h that need to be modified are not mentioned) But I am getting the error while building
2012 Jul 05
3
[LLVMdev] "symbol lookup error" while running a Simple Loop Pass
Hello; I wrote this simple loop pass to collect the number of instructions in each loop of the program. The code is as follows- #define DEBUG_TYPE "loopinst" #include "llvm/Pass.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Support/raw_ostream.h" #include "llvm/ADT/Statistic.h" #include "llvm/Instructions.h" #include
2012 Jul 05
1
[LLVMdev] "symbol lookup error" while running a Simple Loop Pass
Hi, > Problem solved. I was building llvm in a separate llvm-build directory. I > built it within the llvm-src directory (which kept all the llvm .so and my > pass' .so in the llvm-src/Release+Asserts/lib directory) to solve the > problem. I do not fully understand what you mean, there should be no difference on building out of source AFAIK. > Can anyone tell me what's
2012 Jul 05
0
[LLVMdev] "symbol lookup error" while running a Simple Loop Pass
Problem solved. I was building llvm in a separate llvm-build directory. I built it within the llvm-src directory (which kept all the llvm .so and my pass' .so in the llvm-src/Release+Asserts/lib directory) to solve the problem. Can anyone tell me what's the difference between writing a pass as a "struct" (as in the tutorial) and as a "class" (as most developers do)?
2013 Nov 05
2
[LLVMdev] Identifying the instructions that uses a pointer used as a function argument
Hello all; So here is my goal: *** If there is a Call instruction to myFunction(int * val), I need to identify all the instructions that uses val in the IR and replace the uses with a newly created pointer. I will also be changing the argument of myFunction to the new pointer. int * val = malloc/calloc; ... myFunction(val); .... *val = 45; becomes== int * val = malloc/calloc; int * val1 =
2012 Jun 20
3
[LLVMdev] Is Loop Dependence Analysis Printing Correct Stats?
Hi; I was playing with the -lda pass of LLVM on the following program- #include <stdio.h> void main() { int a[10]; int i; for(i = 0; i < 4; i ++) { a[i] = a[i-1]+1; } } I run the following commands - clang a.c -emit-llvm -S opt -analyze -stats -lda a.s The output is - Printing analysis 'Loop Dependence Analysis': Loop at depth 1, header block: %for.cond Load/store
2013 Nov 05
1
[LLVMdev] Identifying the instructions that uses a pointer used as a function argument
Thanks for the reply. For the source code: int main() { int a = 0; int *p; p = &a; call_arnamoy(p); int *p1; p1 = p; return 1; } The bit code: %retval = alloca i32, align 4 %a = alloca i32, align 4 %p = alloca i32*, align 8 %p1 = alloca i32*, align 8 store i32 0, i32* %retval store i32 0, i32* %a, align 4 store i32* %a, i32** %p, align 8 %0 = load i32** %p, align 8 %call = call i32
2012 Sep 07
1
[LLVMdev] Get the filename on which a pass is running?
Hi; I was wondering how can I get the name of the bitcode file on which I am running the pass. I am making my pass as a loadable module. And if I run my pass like this - opt -S -loops -load /home/arnie/llvm-clang/llvm/Release+Asserts/lib/XYZ.so -xyz <b.bc> b1.bc I want to get b.bc in the pass. Thank you; -- Arnamoy Bhattacharyya Athabasca Hall 143 Department of Computing Science -
2012 Sep 05
2
[LLVMdev] llvm::ConstantArray::get(llvm::LLVMContext&, llvm::StringRef, bool) deprecated?
Hi all; I have been trying to use the llvm::ConstantArray::get(llvm::LLVMContext&, llvm::StringRef, bool) function but seems it has been deprecated. ProfileDependence.cpp:68:73: error: no matching function for call to ‘llvm::ConstantArray::get(llvm::LLVMContext&, llvm::StringRef, bool)’ ProfileDependence.cpp:68:73: note: candidate is:
2013 Nov 05
0
[LLVMdev] Identifying the instructions that uses a pointer used as a function argument
I think I understood the problem you're trying to solve. I didn't, however, understand the problems you are having (maybe you're not running mem2reg?). I do have a little piece of code that I think does (more or less) what you want. Take a look at it, try understanding it, and see if it helps you out. You might have to change it a bit since you're replacing uses after an
2012 Jun 16
2
[LLVMdev] What's Going Wrong with GCC 4.6.3 + dragonegg 3.1
Hi all; Problem: Running a bitcode file produced by llvm-gcc (gcc 4.6.3 + dragonegg 3.1 + llvm 3.1) with lli (Ubuntu 12.04) *llvm-gcc:* llvm-gcc -c hello.c -emit-llvm -o hello.bc lli hello.bc output: lli: hello.bc:1:1: error: expected top-level entity ELF@4( *clang:* clang -c hello.c -emit-llvm -o hello.bc lli hello.bc output: hello world hello.c: #include <stdio.h> int main() {
2012 Jul 04
1
[LLVMdev] Correct Way to Build an LLVM Pass
Hi; I wrote an LLVM transformation pass and I put my code inside the llvm-src/lib/Transforms/my-pass directory. I want to know what is the correct method for compiling it and building my plugin for the pass. After reading the http://llvm.org/docs/WritingAnLLVMPass.html page, I felt that I have to keep my pass inside the above said directory. But when I run make from inside my-pass directory
2012 Aug 22
1
[LLVMdev] Insert Self Written Function Call from a FunctionPass?
Hello all; So my goal is to insert some (self-written) function calls in the LLVM IR. I can achieve it with a ModulePass and using the getOrInsertFunction() call. For a ModulePass I follow the steps- 1. Compile the code (in which call instructions are to be inserted) to LLVM IR 2. Compile the file (which contains the *called* external function ) to LLVM IR 3. Link them together and run the
2012 Sep 05
1
[LLVMdev] Calling a function with a pointer to a global char array as argument
Hello; Thanks to Eli for the pointer to the ConstantDataArray::getString() fucntion. Now I am trying to declare a global char array with the content "hi" and call a function "print" (which takes a char pointer and return an insteger. I am doing the following in the code - Function Creation: PointerType* array = PointerType::get(IntegerType::getInt8Ty(getGlobalContext())
2012 Jun 20
0
[LLVMdev] Is Loop Dependence Analysis Printing Correct Stats?
> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Arnamoy Bhattacharyya > Subject: [LLVMdev] Is Loop Dependence Analysis Printing Correct Stats? > for(i = 0; i < 4; i ++) > { > a[i] = a[i-1]+1; > } > Am I doing anything wrong or the code seems buggy? Your code is buggy. The first time through the loop, you're referencing
2013 Oct 25
3
[LLVMdev] Question About Function Cloning
Hello all; I have been writing this LLVM pass that extracts loops in a function and then duplicates the function so the loop is executed twice. The pass executes fine but the produced bit code does not behave correctly as it should (both the original and duplicated function in which the loop is extracted is called, but from the output it seems only one of them is executed.) Here is the source:
2013 Oct 25
0
[LLVMdev] Question About Function Cloning
Hi Arnamoy, > Any idea, why the output looks like - > Hello World > Hello World > val is 58 > > While the it should print 4 times? Both your loops are sharing the counter variable (%i1) without resetting it to 0 in between calls. I think that accounts for the behaviour. Cheers. Tim.
2012 Jun 18
1
[LLVMdev] Any Work Done/ Going on for OpenMP Support in Clang?
Hello; I saw a discussion went i the llvm mailing list about work on supporting OpenMP in Clang (llvm-gcc already supports that).( http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-January/046640.html) I just want to know, anybody has made any progress in it? It would be really helpful for me. Thanks a lot; -- Arnamoy Bhattacharyya Athabasca Hall 143 Department of Computing Science -
2013 Oct 29
1
[LLVMdev] Getting TargetData and TargetLibraryInfo for determining Malloc size
Hello; I was trying to use the computeArraySize() function from the MemoryBuiltins.cpp file. It requires two arguments DataLayout *TD and const TargetLibraryInfo *TLI. Can anyone tell me how to get the TargetLibraryInfo? I am getting the DataLayout using: DataLayout *TD; TD = new DataLayout(&M); I hope that's the right way of getting it. Thanks a lot; -- Arnamoy Bhattacharyya
2013 Oct 30
1
[LLVMdev] Setting called value for an indirect function call
Hello; I am trying to clone some call instructions in the IR and then set the call destination of those call instructions to my own library functions that happens to have the same arguments and return types of the original callee. It works perfectly for direct calls using setCalledFunction(). But when the function call is indirect, is there a way to set the callee? Something like