Displaying 20 results from an estimated 2000 matches similar to: "[LLVMdev] Printing Function Arguments"
2009 Sep 28
3
[LLVMdev] Printing Function Arguments
Hi Nick,
Thanks, that seemed to work.
Nick Lewycky wrote:
>
> ivtm wrote:
>> I am processing the LLVM instructions and right now I am at the 'call'
>> instruction.
>> For now I just want to print the argument type.
>>
>> For example in the following:
>>
>> %0 = tail call i32 (...)* @__FFF (i32 8) nounwind; <i32> [#uses=1]
2009 Sep 28
0
[LLVMdev] Printing Function Arguments
ivtm wrote:
> I am processing the LLVM instructions and right now I am at the 'call'
> instruction.
> For now I just want to print the argument type.
>
> For example in the following:
>
> %0 = tail call i32 (...)* @__FFF (i32 8) nounwind; <i32> [#uses=1]
>
> I need to get access to 'i32' and '8' separately.
>
> I do:
>
>
2009 Sep 28
0
[LLVMdev] Printing Function Arguments
Another question, I need to get the "%0" below in the:
%0 = tail call i32 (...)* @__FFF (i32 8) nounwind; <i32> [#uses=1]
that is, the return register.
I am wondering in general, where should I look in the llvm codebase for
parsing instructions ?
I am looking at existing passes and also the header files like Function.h,
etc to see what methods they have, but it takes a while
2009 Sep 28
3
[LLVMdev] Printing Function Arguments
ivtm <martinaide1 at yahoo.com> writes:
> Another question, I need to get the "%0" below in the:
>
> %0 = tail call i32 (...)* @__FFF (i32 8) nounwind; <i32> [#uses=1]
>
> that is, the return register.
What information do you want, exactly?
In your example, %0 is the CallInst. So if you have
CallInst *ci = CallInst::Create(...
then use `ci' whenever
2009 Sep 28
0
[LLVMdev] Printing Function Arguments
Hey Oscar,
I want to extract information from the instruction.
Think writing a simple interpreter.
I already have the CallInst instance (described above in the message).
Via ci->getOperand(1) say I can get the 'i32 8' parameter and I can get the
'i32' and '8' separately as Nick described.
But I need to extract the %0 from the CallInst instance somehow. I am not
sure
2009 Sep 28
4
[LLVMdev] Printing Function Arguments
ivtm wrote:
> Hey Oscar,
>
> I want to extract information from the instruction.
>
> Think writing a simple interpreter.
>
> I already have the CallInst instance (described above in the message).
>
> Via ci->getOperand(1) say I can get the 'i32 8' parameter and I can get the
> 'i32' and '8' separately as Nick described.
>
> But I
2009 Sep 28
0
[LLVMdev] Printing Function Arguments
Hi Nick,
I parsed your message again carefully and did some experiments.
I guess the:
for (User::op_iterator i = I->op_begin(), e = I->op_end(); i != e; ++i)
{
}
iterates over the operands of the instruction "I", which are as you said,
*other* instructions.
But if I want to get other information about the instruction, say the type
of the operands,
then I still need to figure
2009 Sep 28
0
[LLVMdev] Printing Function Arguments
Hi Nick,
Perhaps I am confused. What is the best way to extract information from
instructions ?
Is it via the, say:
for (User::op_iterator i = I->op_begin(), e = I->op_end(); i != e; ++i)
....
I am not sure what happens next, e.g. to the variable 'i', you should know
what part of the instruction this is and cast it to the necessary type.
For example, I am parsing the
2017 May 26
2
Printing out a 128 bit decimal
Hi,
I was wondering how I can print out the result of some arithmetic on 128 bit integers.
After having a look at the API , it seems it is possible to get the integer value from the
"ConstantInt::getSextValue() " but the return value is only a int64_t.
I wish to print it on the console output and printing as a string or decimal ( using C standard library printf )
My Question :
2010 Jun 23
1
[LLVMdev] LLVM help
Sir I am trying to get the constant 2 in instruction y=x+2;
Its intermediate representaton is like %y=add nsw i32 %x , 2
If I use getOperand(2).getName() then I get null string.
How can I get the value 2 ?
Regards
Rahul Goyal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100623/21222621/attachment.html>
2009 Sep 26
2
[LLVMdev] LLVM SSA
Hi,
I am wondering if there are options that can be given to LLVM can be used to
generate code that is not in SSA, but in plain 3-address form ? (for
example, if there is an existing pass that does the register allocation and
dead variable elimination)
For example, if I have:
int x = 0;
void main()
{
x++;
x++;
}
I guess, if that is not the case, then, one needs to write their own pass.
2017 Jun 12
2
How to know the sub-class of a Value class?
On 11 June 2017 at 23:03, Craig Topper <craig.topper at gmail.com> wrote:
> Try value->dump() assuming you're using a debug build.
>
>
The information displayed is non-uniform. There are two different cases
based on my sample program:
(1) dump() shows the Type and *some* value which I don't
understand what it is
(2) dump() shows the instruction that
2009 Sep 26
0
[LLVMdev] LLVM SSA
ivtm <martinaide1 at yahoo.com> writes:
> I am wondering if there are options that can be given to LLVM can be used to
> generate code that is not in SSA, but in plain 3-address form ? (for
> example, if there is an existing pass that does the register allocation and
> dead variable elimination)
>
> For example, if I have:
>
> int x = 0;
>
> void main()
> {
2020 Feb 19
2
i1 true ^= -1 in DAG matcher?
A constant i1 is stored as a one bit APInt wrapped in a ConstantInt which
is then wrapped in ConstantSDNode for SelectionDAG. The BUILD_VECTOR will
just point to the same ConstantSDNode for each element. There is no concept
of a sign in the storage. It's just a bit. Whether or not its treated as 1
or negative 1 is going to depend on the code looking at the value including
printing code. And
2009 Sep 26
3
[LLVMdev] LLVM SSA
I am familiar with the LLVM IR a little bit and I am parsing much more
complex examples. I just gave this example, to show that I would like to
have only 1 variable, not 2, the way SSA would generate it.
I am actually using LLVM purely as a front end to translate to .bc files and
then I have my own parser from there.
At any rate, is there an option to the llvm-gcc --emit-llvm to tell it to
2009 Sep 26
1
[LLVMdev] LLVM SSA
LLVM IR is always in SSA form. If you *really* don't want it to be,
use allocas for everything and then don't run the mem2reg optimization
pass. This will represent all of your variables as stack locations
instead of registers, and it will not be SSA.
Reid
On Sat, Sep 26, 2009 at 3:55 PM, ivtm <martinaide1 at yahoo.com> wrote:
>
> I tried the -O0 option and I am still
2010 Mar 15
3
[LLVMdev] [patch] Writing ConstantUnions
Hello,
I noticed a bit of a gap in the current code for unions: a
ConstantUnion cannot be written out to .ll.
Hopefully I'm not stepping on Talin's toes by posting this, it's a
fairly straightforward adaptation of the code for structs just above.
Tim.
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
--------------
2009 Sep 26
1
[LLVMdev] LLVM SSA
I tried using the mem2reg pass with opt,
e.g. opt -reg2mem x.bc > x2.bc
where x.bc was produced with:
llvm-gcc -O2 -emit-llvm -c x.c -o x.bc
This did not reduce the # of variables in x2.bc
I use -O2 because it produces the least # of instructions and hence the
least # of new SSA virtual registers.
Do you have a set of options to give to llvm-gcc or opt in mind ?
My goal is to take a .c
2020 Feb 19
2
i1 true ^= -1 in DAG matcher?
The vnot PatFrag uses ImmAllOnesV which should put an OPC_CheckImmAllOnesV
in the matcher table. And the matcher table should call
ISD::isBuildVectorAllOnes. I believe we use vnot with vXi1 vectors on X86
and I haven't seen any issues.
The FIXME you pointed to seems related to a scalar patcher not a vector
pattern. In that case the issue is that the immediate matcher for scalars
calls
2020 Jan 19
3
Instruction arguments
Hello,
I am loop over the arguments of a call instruction :
---->
for (Value *arg: c->args()){
errs() << *arg << "\n";
arg->print(llvm::errs(), false);
errs()<<"\n";
}
----->
How can I convert the arg for binary comparison(== etc.)? If I am correct,
it is not a string. If the argument is "i32 1",