similar to: [LLVMdev] questions about llvm

Displaying 20 results from an estimated 6000 matches similar to: "[LLVMdev] questions about llvm"

2018 Apr 01
0
Custom Binary Format Challenges
Hi, You can write it as if you are writing an optimization pass: http://llvm.org/docs/ProgrammersManual.html It sounds like your highest level is a module, hence you should write a module pass. There is example code on LLVM Programmer's Manual on how to do a function pass: Function* targetFunc = ...; class OurFunctionPass : public FunctionPass { public: OurFunctionPass():
2018 Apr 01
0
Custom Binary Format Challenges
Hi Kenneth, Can you elaborate what you mean by instruction pointer value? Like the actual instruction with opcode and operands? With the sample code that I showed you, the instrucrtion pointer in the innermost for loop will have access to the following functions: http://llvm.org/doxygen/classllvm_1_1Instruction.html Alternatively, you can use the dump() operation to dump the instructions out.
2018 Apr 01
2
Custom Binary Format Challenges
Thank you so much! What about discovering the instruction pointer value? Also, does anybody know how to embed an artifact as a resource in a binary? I'd like to have two text sections, and have one copied in from another binary. On Sun, Apr 1, 2018 at 2:15 PM, Brenda So <sogun3 at gmail.com> wrote: > Hi, > > You can write it as if you are writing an optimization pass: >
2018 Apr 02
0
Custom Binary Format Challenges
If you can write what you want to output in C with asm statements, clang can show you what the IR should look like. On Mon, Apr 2, 2018 at 7:35 AM, Kenneth Adam Miller via llvm-dev < llvm-dev at lists.llvm.org> wrote: > Program counter - EIP, RIP for x86/64. I need to obtain it and pass it as > an argument to the function that calculates an ordinal from it. > > I think that
2018 Apr 01
2
Custom Binary Format Challenges
Program counter - EIP, RIP for x86/64. I need to obtain it and pass it as an argument to the function that calculates an ordinal from it. I think that there must be some way to use the bitcode language to place byte values at a designated offset. Or use the command line to specify the section and offset for the data. On Sun, Apr 1, 2018 at 6:00 PM, Brenda So <sogun3 at gmail.com> wrote:
2018 Apr 02
1
Custom Binary Format Challenges
The bitcode is only a representation of the IR, which is in SSA form. And SSA form assumes an infinite amount of registers, which is not offered by x86. When bitcode gets assembled/compiled to machine language, it breaks down the SSA form into non-SSA format. Personally I don't know how to use bitcode language to achieve what you want to do. The closest thing I can think of is the llvm-MC
2018 Apr 01
2
Custom Binary Format Challenges
Hello, I hope you are all doing well and thanks in advance. I need to program a transformation of a set of llvm bitcode to have some various techniques woven in. In particular, I need to resolve a given computed target address to one of several in the same way that the function of a dynamic library is resolved, but I need this resolution to happen in the binary target of my choice where I tell
2012 Apr 10
0
[LLVMdev] How to explain this weird phenomenon????????
I figured that my opt command is wrong! How to specify the output file anyway?? if I want hello.bc to be input file and newhello.bc to be output file, is the opt command go like this? opt -load ../../../Debug+Asserts/lib/Hello.so -hello <hello.bc> -o newhello.bc ?? -- 祝好! 甄凯
2012 Apr 10
4
[LLVMdev] How to explain this weird phenomenon????????
My friends, I ran a function pass on a .bc file, intending to insert a CallInst to my self-made check function. The compilation is successful. BUT after I ran that pass on the .bc file, the size of the file didn't get any bigger!! Does this mean my instrumentation work failed?? BTW the opt command I use is "opt -load ../../../Debug+Asserts/lib/Hello.so -hello <hello.bc> -o
2012 Apr 07
1
[LLVMdev] How to insert a self-written function to a piece of programme
Hi all, I wrote a function pass. In the pass, it ran through all the instruction that call to functions. When arriving at the exact function that I m interested in, it would insert a self-made function. Now I've finished the pass, the compilation is successful. The pass can find the function I like and can insert the CallInst to call my check function. BUT, when running the
2012 Apr 09
0
[LLVMdev] How to instrument a this function using insertBefore instruction???
Hi, I got upset.. What does “Broken module found, compilation aborted!” mean really?? what‘s “broken module“?? -- 祝好! 甄凯 ------------------------------------------------------------------------------------------------------ 2012-04-09 ------------------------------------------------------------------------------------------------------ Name: 甄凯(ZhenKai)
2012 Apr 09
3
[LLVMdev] How to instrument a this function using insertBefore instruction???
Hi all, Im trying to instrument this hello function right before the instruction that call the "puts" function(the source code is as follow). Now I can compile the pass without errors, but when run the pass with opt tool, it broke down. The diagnose is something like Referencing function in another module! %CallCheck = call i32 @fib() Broken module found, compilation aborted! Does
2012 Apr 09
0
[LLVMdev] How to instrument a this function using insertBefore instruction???
Thank you very much! To make it simpler, I may as well just implement the self-written "check function" in C language instead of wrapping it in LLVM module. According to the hint you give me, all I need to do is as follow(?) 1. Implement the "Check function" in the check.c file; 2. Add the check function into the module(the Hello1.bc file which I will run the functionPass on)
2012 Apr 09
1
[LLVMdev] How to instrument a this function using insertBefore instruction???
That sounds like a good general plan, yes! Joey 2012/4/9 15102925731 <zhenkaixd at 126.com> > Thank you very much! > > To make it simpler, I may as well just implement the self-written "check > function" in C language instead of wrapping it in LLVM module. *According > to the hint you give me, all I need to do is as follow(?)* > > 1. Implement the
2011 Jan 26
2
[LLVMdev] [LLVMDEV]How could I get function name in this situation?
Hi: My llvm code is: for( BasicBlock::iterator i = b->begin() , ie = b->end(); b != be ; b ++ ){ if( CallInst * pCall = dyn_cast<CallInst>(i)){ pCall->dump(); // Function * pFunction = pCall->getCalledFunction(); if( !pFunction ){ } std::string fname = pFunction->getName(); } } The dump result
2012 Apr 09
2
[LLVMdev] How to instrument a this function using insertBefore instruction???
Hi, I don't think the code you pasted can be the correct code, where does FibF come from? Anyway, the problem is that you're calling the FibF from Module A, however you defined it for Module B. You need to insert the FibF function into the Module that you're running. To do this override "virtual bool doInitialization(Module &M);" and insert FibF into M. Joey 2012/4/9
2012 Jan 06
2
[LLVMdev] How to duplicate a CallInst
Hi, I have the following piece of code: %34 = fptosi float %33 to i32 %35 = call i32 @function(i32 %34) nounwind I would like of know how can I duplicate the statement %35 ? , as follows: %34 = fptosi float %33 to i32 %35 = call i32 @function(i32 %34) nounwind *%36 = **call i32 @function(i32 %34) nounwind* * * i.e, two instructions exactly equal. Using clone, results in badref. Moreover, how
2005 Aug 29
1
[LLVMdev] getCalledFunction
Hi, The getCalledFunction on CallInst is returning NULL, although it is (directly) calling a function, which is defined in the same file. ---------------------- if (CallInst* callInst = dyn_cast<CallInst>(&inst)) { std::cerr<<callInst->getCalledFunction(); } ----------------------- When ------------------ std::cerr<<*callInst ---------------- the
2011 Jan 26
2
[LLVMdev] [LLVMDEV]How could I get function name in this situation?
thanks! After I check the ll file, I find this: %1 = load %struct.nsAString** %aBuf_addr, align 4, !dbg !2048 %2 = getelementptr inbounds %struct.nsAString* %1, i32 0, i32 0, !dbg !2048 %3 = getelementptr inbounds %struct.nsISupports* %2, i32 0, i32 0, !dbg !2048 %4 = load i32 (...)*** %3, align 4, !dbg !2048 %5 = getelementptr inbounds i32 (...)** %4, i32 10, !dbg !2048 %6 = load i32 (...)**
2011 Jan 26
0
[LLVMdev] [LLVMDEV]How could I get function name in this situation?
On 1/26/11 2:07 PM, songlh at cs.wisc.edu wrote: > Hi: > > My llvm code is: > > for( BasicBlock::iterator i = b->begin() , ie = b->end(); > b != be ; b ++ ){ > if( CallInst * pCall = dyn_cast<CallInst>(i)){ > > pCall->dump(); // > Function * pFunction = pCall->getCalledFunction(); > if(