Displaying 20 results from an estimated 5000 matches similar to: "[LLVMdev] How to get the name and argument of a function"
2011 Jan 19
0
[LLVMdev] How to get the name and argument of a function
Thanks a lot!
I finally fix my problem.
My code is like this:
//CallInst* pCall pCall is a printf called in my situation
if( ConstantExpr * pCE = dyn_cast<ConstantExpr>( pCall->getArgOperand(0))){
if( GlobalVariable * pGV = dyn_cast<GlobalVariable>( pCE->getOperand(0))){
if( ConstantArray * pCA = dyn_cast<ConstantArray>(
2011 Jan 18
0
[LLVMdev] How to get the name and argument of a function
songlh at cs.wisc.edu wrote:
> Hi everyone:
>
> The code I am analyzing is :
>
> int main()
> {
> int i = 0;
> printf("hello world!");
> printf( "%d" , i );
> }
>
>
>
> I want to get each place where printf is called, and the argument used
> during that call.
>
> so I write llvm
2011 Jan 26
2
[LLVMdev] [LLVMDEV]How could I get function name in this situation?
> On 1/26/11 2:40 PM, songlh at cs.wisc.edu wrote:
>> 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
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
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
2011 Jan 26
0
[LLVMdev] [LLVMDEV]How could I get function name in this situation?
On 1/26/11 3:00 PM, songlh at cs.wisc.edu wrote:
>> On 1/26/11 2:40 PM, songlh at cs.wisc.edu wrote:
>>> 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
2011 Jan 26
0
[LLVMdev] [LLVMDEV]How could I get function name in this situation?
On 1/26/11 2:40 PM, songlh at cs.wisc.edu wrote:
> 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
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(
2011 Jan 26
2
[LLVMdev] [LLVMDEV]How could I get function name in this situation?
> On 1/26/11 3:00 PM, songlh at cs.wisc.edu wrote:
>>> On 1/26/11 2:40 PM, songlh at cs.wisc.edu wrote:
>>>> 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
2014 Oct 15
2
[LLVMdev] how to choose which alias analysis used in my pass?
----- Original Message -----
> From: "Jingyue Wu" <jingyue at google.com>
> To: "songlh" <songlh at cs.wisc.edu>, llvmdev at cs.uiuc.edu
> Sent: Wednesday, October 15, 2014 2:50:12 PM
> Subject: Re: [LLVMdev] how to choose which alias analysis used in my pass?
>
>
> Isn't -basicaa the default alias analysis already?
No, -basicaa is added
2014 Oct 15
2
[LLVMdev] how to choose which alias analysis used in my pass?
Hi,
I want to use memory dependence analysis in my pass, but I feel the
default alias analysis is not precise enough. How could I choose to use
another alias analysis algorithm? I have tried opt -load mypass.so
-basicaa xx.bc > /dev/null. But I feel the alias analysis algorithm does
not change. Do I need to add something in my codes?
Thanks a lot!
Best,
2014 Apr 29
2
[LLVMdev] how to identify basic blocks added for switch instruction without default?
Hi,
I just notice that front-end will add an extra block for switch
instruction without default. How could I identify basic blocks added due
to this reason?
The added codes looks like:
sw.default.i625: ; preds = %if.end512
tail call void @fancy_abort(i8* getelementptr inbounds ([38 x i8]*
@.str, i64 0, i64 0), i32 3045, i8* getelementptr inbounds
2015 Feb 11
3
[LLVMdev] question about licm
----- Original Message -----
> From: "Ashutosh Nema" <Ashutosh.Nema at amd.com>
> To: "songlh" <songlh at cs.wisc.edu>, llvmdev at cs.uiuc.edu
> Sent: Wednesday, February 11, 2015 3:20:27 AM
> Subject: Re: [LLVMdev] question about licm
>
> Hi,
>
> LICM can only hoist instructions which dominates all loop exit
> blocks.
> In this case
2015 Feb 11
2
[LLVMdev] question about licm
hi,
I applied licm with basicaa on the following codes:
int j = atoi(argc[1]);
int lower[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
int upper[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
for(i = lower[j]; a[i] < 100 && i < upper[j]; i ++);
I notice that upper[j] is not hoisted out from the loop. Is this
because j could be larger than 10?
Thanks a lot!
Best,
2013 Jan 31
2
[LLVMdev] Could I explicitly tell clang not inline some functions?
Hi,
I am wondering whether there are some ways I can tell clang not
inline some or all functions.
Thanks a lot!
Linhai
2011 Jan 26
1
[LLVMdev] [LLVMDEV]How could I get function name in this situation?
> On 1/26/11 3:06 PM, songlh at cs.wisc.edu wrote:
>>> [snip]
>>> -- John T.
>> Sorry, I am asking the second question.
>> "
>> how to determine, within an LLVM pass, what the
>> possible target(s) of an indirect function call might be?
>
> There are at least two solutions.
>
> The first is to use the CallGraph analysis pass. It
2011 Sep 16
2
[LLVMdev] How to duplicate a function?
Hi all,
Sorry for the inconvenient about the previous post. The files were not
attached. So I put them here again.
I am a newbie in LLVM and I am trying to replace the function like:
old function || new function
==============================
=========
int haha(int a) { int haha(int a, char* ID) {
===>
}
2018 Mar 23
3
Change function call name in a CallInst only in certain functions
Hello,
In my module I have functions:
a
b
c
f3 calls "a"
f2 calls "a"
f1 calls "b"
I would like to modify a CallInst in the f2. Now it calls "a", but I want
changed it to "c".
When loop over the instructions of the f2, I can get a CallInst to be
modified, then I use "setName" to changed it to "c".
Problem is, since
2015 Mar 25
2
[LLVMdev] Instruction::mayThrow not handling invoke's?
While improving ADCE, i notice that for
declare i32 @strlen(i8*) readnone
define i32 @test() {
; invoke of pure function should not be deleted!
invoke i32 @strlen( i8* null ) readnone
to label %Cont unwind label %Other ; <i32>:1 [#uses=0]
Cont: ; preds = %0
ret i32 0
Other: ; preds = %0
%exn = landingpad {i8*, i32} personality i32 (...)*
@__gxx_personality_v0
2018 May 17
15
RFC: Removing TerminatorInst, simplifying calls
Going to keep this RFC short and to the point:
TerminatorInst doesn't pull its weight in the type system. There is
essentially a single relevant API -- iterating successors. There is no
other interesting aspect shared -- the interface itself just dispatches to
specific instructions to be implemented.
On the flip side, CallInst and InvokeInst have *massive* amounts of code
shared and struggle