Displaying 20 results from an estimated 70000 matches similar to: "[LLVMdev] How to get the operand value in the instruction"
2012 May 09
2
[LLVMdev] How can I get the destination operand of an instruction?
Sorry, I have typo in my question.
I will be careful next time.
This is how I obtain the source operands of an instruction.
// -----------------------------------------------------------------
BasicBlock::iterator it;
...
for(int k=0; k<OpNum; k++){
errs()<<it->getOperand(k)<<" ";
}
...
// --------------------------------------------------------------------
Also I
2016 Apr 24
2
Retrieving numeric value of instruction operand
Hello Everyone,
I need some help in retrieving the numeric value of an instruction operand
from LLVM IR.
this is what the IR looks like for a simple add function that adds two i32
integers
define i32 @summ(i32 %a, i32 %b) #0 {
entry:
%add = add nsw i32 %b, %a
ret i32 %add
}
i would like to know the integer value of %a and %b.
I've tried
-i->getOpcodeName() which gives me the
2012 May 09
0
[LLVMdev] How can I get the destination operand of an instruction?
Launcher <st.liucheng at gmail.com> writes:
> I am able to access the source operands of an instruction using either
> getOperand() or op_iterator, However, I can't find any method available for
> destination operand. Someone suggests that instruction itself can represent
> the destination operand.
> http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-January/037518.html
2012 May 09
4
[LLVMdev] How can I get the destination operand of an instruction?
I am able to access the source operands of an instruction using either
getOperand() or op_iterator, However, I can't find any method available for
destination operand. Someone suggests that instruction itself can represent
the destination operand.
http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-January/037518.html
The getOperand() returns an unsigned value like 0x9063498, while I can't
2012 May 09
0
[LLVMdev] How can I get the destination operand of an instruction?
Hi,
> Sorry, I have typo in my question.
> I will be careful next time.
>
> This is how I obtain the source operands of an instruction.
> // -----------------------------------------------------------------
> BasicBlock::iterator it;
> ...
> for(int k=0; k<OpNum; k++){
> errs()<<it->getOperand(k)<<" ";
try this:
2016 Apr 24
2
Retrieving numeric value of instruction operand
hey john,
yes indeed, that's what I'm trying, retreiving the values of %a and %b in
an LLVM pass, sorry about the confusion.
On Apr 24, 2016 7:18 AM, "John Criswell" <jtcriswel at gmail.com> wrote:
> Dear Ammar,
>
> It is not clear what you are asking. %a and %b in your code below are not
> constants; there is no way, at compile time, to determine what
2016 Apr 24
2
Retrieving numeric value of instruction operand
Hi John,
Thank you so much for the valuable answer! :)
However, i have one tough issue that i need to solve, in my pass :
let's say here
%s = add %a, %b
I need to check if the value of %a or %b is 2 or 4 and then apply a
transformation to the other operand accordingly,
for example if the value of %a = 2 the i'll multiply %b by 2 in my
transform pass.
I'm having a hard time
2016 Apr 26
2
Writing a pass to retrieve instruction operand value
Hi Everyone,
I asked a question on the dev list related to the topic to which John
Criswell and Jeremy Lakeman kindly provided some valuable insight.
I'm still stuck on the issue and i'm hoping i didn't phrase the question
well enough.
I have a *foo.c* file that is :
*#include <stdio.h>*
*int foo(int a, int b){*
* return a+b;*
*}*
*int main() {*
*int x=foo(3,1); *
2009 Feb 11
0
[LLVMdev] Operand, instruction
Nipun Arora wrote:
> Hi,
>
> How can one extract the operand of an instruction in an LLVM pass?
> Like I can get the opcode bt I'd like to get the operands as well
>
Use the getOperand() method of class Instruction (which I think is
inherited from Value or User or some other LLVM class). It takes a
single parameter that is an index specifying which operand to return.
The
2010 Apr 22
0
[LLVMdev] Operand, instruction
if (ConstantInt *c = (ConstantInt *) dyn_cast<ConstantInt>(index)){
errs() << "And it's a constant!!!!!!1111oneone!! (" <<c->getZExtValue()
<< ")\n";
}
--
"Believe you can, believe you can't; either way you're right." -Henry Ford
-----Original Message-----
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at
2011 Jun 02
0
[LLVMdev] LLVM Instruction Operands
On Jun 2, 2011, at 9:46 AM, Griffin Wright wrote:
>
> Hello all:
>
> I apologize for what I imagine is a rather silly question, but I'm still
> somewhat new to LLVM and am stuck. I am reworking some code that was
> originally in the backend involving MachineInstructions and
> MachineOperands, and I now need for it to function as an LLVM IR pass,
> using just
2010 Apr 22
3
[LLVMdev] Operand, instruction
Hello, how to get the numerical value of an constant operand? For ex. %tmp =
mul i32 %indvar, 6 , in this instruction second operand is a numerical
constant with value 6. But i am only able to print it by using
getOperand(1), not able to store it in any integer variable. Using getName()
returns a empty string. Is there any way to solve this problem?
Thank you.
John Criswell-2 wrote:
>
>
2012 May 10
1
[LLVMdev] How to get the label field of PHI instruction?
Typical PHI instruction in LLVM goes like this:
%P = phi i32* [%A, %BB1], [%B, %BB2]
When I try to access all the source operands, only %A and %B are included. I
checked the methods in instruction.h, but I didn't find any methods
obtaining the label fields i.e. %BB1, %BB2.
I notice that each label of a basic block is related with a value which can
be referenced in 'br'
2010 Apr 22
2
[LLVMdev] Operand, instruction
Thanks for the quick reply.
I am able to get the numerical value. But i also need the numerical value to
be in value type, so that it can be used as operand of other instruction.
For that i am trying to create a new ConstantInt, but i am unable to find
create() function for ConstantInt.
Thanks again for the quick and helpful reply.
Ben Perry-3 wrote:
>
> if (ConstantInt *c = (ConstantInt
2010 Jul 01
0
[LLVMdev] [HEADSUP] Another attempt at CallInst operand rotation
Gabor Greif wrote:
> Am 30.06.2010 um 23:31 schrieb John Criswell:
>
>
>> Stupid question: is making the getOperand() method of CallInst
>> going to work? For example, if I have the following code:
>>
>> void
>> method (Instruction * I) {
>> I->getOperand(2);
>> ...
>> }
>>
>> void method2 (CallInst * CI) {
2010 Mar 26
4
[LLVMdev] Operand, instruction
Can anyone tell how to get the result name or instruction name of all
instruction? For example if the instruction is "x=add y,z", here i need "x".
Using getName(), i am getting some instructions result name, but llvm
produces some instruction like "%0=add i32 tmp, 1", here getName() shows
empty string as result name.
So please help.
John Criswell wrote:
>
>
2011 Jul 01
0
[LLVMdev] Operand name missing
On Fri, Jul 1, 2011 at 12:35 AM, ankur deshwal <a.s.deshwal at gmail.com> wrote:
> Hi,
>
> I was trying to use the following code in a if condition
> I->getOperand(0)->hasName()
>
> where I is an instruction with following condition already true -
> I->getOpcode() == Instruction::Call
>
> When I compiled a C code with llvm-2.9, I see a function call with
2013 Jan 11
2
[LLVMdev] LLVM Instruction*->getOperand() not working properly for ICMP
Hi Duncan,
Thank you for your response! Now it works.
But I have another problem: Do you know how can I iterate through a Value*?
For instance, I have :
Instruction *I1; // I take only I1 that are ICmp
errs()<<"\n "<<*I1->getOperand(0)<<" \n";
// %3 = load i32* %c, align 4
As expected. Now I want to get %c from the previous to use "%c" in
2010 Jul 15
1
[LLVMdev] Figuring out the parameters of the Call Instruction
Hi Duncan,
Thanks for pointing out my mistake. I will reword my questions.
//C code
int var1; //global
int a, b;
foo(a, b);
bar(c);
generates following
//LLVM IR
%1 = load a;
%2 = load b;
call foo(%1, %2)
call bar(@var1)
CallInst.getOperand(1).getNameStr() on foo, returns null,
but on bar returns var1.
Similarly, for
call void @p_ptr(i64 ptrtoint (%struct.my_struct* @abc to i64))
nounwind,
2009 Feb 11
3
[LLVMdev] Operand, instruction
Hi,
How can one extract the operand of an instruction in an LLVM pass?
Like I can get the opcode bt I'd like to get the operands as well
Thanks
Nipun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090211/3a073512/attachment.html>