similar to: [LLVMdev] LLVM help

Displaying 20 results from an estimated 3000 matches similar to: "[LLVMdev] LLVM help"

2010 Jun 03
3
[LLVMdev] Distinguish Global variables from functions
Hey all... I was writing a Function pass to print all the functions using runonFunction() method .but it is printing one global variable "x" at the same time which i just dont know how is getting there.how can i avoid "x" from printing?? . Here is the framgment of code of my pass namespace { // Hello - The first implementation, without getAnalysisUsage. struct Test2 :
2012 Nov 16
5
[LLVMdev] Assert with getZExtValue()?
Was hoping it might get some help or a better explanation of this: /ADT/APInt.h:1217: uint64_t llvm::APInt::getZExtValue() const: Assertion `getActiveBits() <= 64 && "Too many bits for uint64_t"' failed. Program received signal SIGABRT, Aborted. 0x00007ffff6eb4d05 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 64
2010 Jun 03
2
[LLVMdev] Getting rid of the dangling names of functions
Hi all, I am a beginner in llvm trying to write some basic passes like printing the name of all the functions in "Hello.cpp" file attached underneath. Also find attached "hello.cpp" on which i am testing the pass .When i run the command: "opt -load $HOME/llvm/src/Debug/lib/TEMP.so -hello < hello.bc > /dev/null" .The output shown is Hello: _GLOBAL__I_x Hello:
2019 Mar 22
2
Understand if a condition was true or false
Hi all, I have the condition of an ICmpInst in a variable called condition obtained doing GenericValue condition = getOperandValue(&I, SF); Now I would like to understand if the comparison was true or false. Is it correct to use condition.IntVal.getSExtValue() and if the value is 0 consider the true and if the value is -1 consider the condition false? I'm not sure because I was expecting
2012 Nov 16
2
[LLVMdev] Assert with getZExtValue()?
Eli, Thanks for responding. Yes, I read the error message but it seems odd that it would be trying to use more than 64 bits. It compiles and executes in gcc on 32 bit arch just fine. I'll probably take your suggestion and file a bug with a reduced testcase. Thanks again, Ryan On Fri, Nov 16, 2012 at 3:10 PM, Eli Friedman <eli.friedman at gmail.com>wrote: > On Fri, Nov 16, 2012
2010 Jun 03
0
[LLVMdev] Distinguish Global variables from functions
hii Please find attached herewith the "hello.cpp" file. also one interesting point is that if i declare the global variable "x" after any function declaration then it is not printed . Rahul On Thu, Jun 3, 2010 at 11:14 PM, RAHUL GOYAL <rahulgoyal34 at gmail.com> wrote: > Hey all... > > I was writing a Function pass to print all the functions using >
2018 Mar 09
2
[SelectionDAG] [TargetOp] How to get sub-half of immediate?
Hi all, This seems like a dumb question but while setting up a pattern in TD file, I got stuck on trying to get each half of an immediate as the half-sized type (ie. i64 imm -> pair of i32 imm's). Is there an existing way to do it? I've tried the 'EXTRACT_SUBREG' but that seems to error at the end of scheduling. Looking at Target.td, I'm not sure which opcode is meant
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",
2008 Jul 07
2
[LLVMdev] (GEP) Index validity
Hi all, I'm fiddling around a bit with programmatically created GEP instructions, which is failing when using i64 for any indix, except the first. The reason behind this, is that StructureType::indexValid only accepts Value* that are constant ints of width 32. I can't really see why this limitation is here. SequentialType solves this slightly differently, it allows for both 32 and 64
2013 Sep 06
2
[LLVMdev] How to get the exact integer from a Value
Hi,all I have a Value* type named indexValue, and the type is i32. I think "indexValue" must hold a number which type is int. Now I want to use the exact number which pointed by indexValue , so I do like this: ConstantInt* CI = llvm::cast<llvm::ConstantInt>(indexValue); //This is wrong, so is dyn_cast. uint64_t index = indexValue->getZExtValue(); uint64_t size = index + 1; I
2008 Jul 07
0
[LLVMdev] (GEP) Index validity
Hi all, I just found that TargetData also contains a similar assert, and that I forgot a "return" in my previous patch. Here's an updated patch, which allows to use any integer to index a CompositeType. It seems this enables GEP to work with any integer value as well, I tested indexing a struct with a i16 an i64 (also through llc). This should still be adressed somewhere, unless we
2018 Mar 09
0
[SelectionDAG] [TargetOp] How to get sub-half of immediate?
Hi Kevin, To get some portion of a constant immediate you can use SDNodeXForms to transform constant SDNodes into other values. For a worked example, in the MIPS backend we use this for constant synthesis by materializing the value into a register: (From lib/Target/MipsInstrInfo.td): // Transformation Function - get the lower 16 bits. def LO16 : SDNodeXForm<imm, [{ return getImm(N,
2008 Jul 10
2
[LLVMdev] (GEP) Index validity
Hi all, any comments about this patch? I'd like to get it out of my working copy :-) Gr. Matthijs > Index: lib/VMCore/Type.cpp > =================================================================== > --- lib/VMCore/Type.cpp (revision 53136) > +++ lib/VMCore/Type.cpp (working copy) > @@ -394,9 +394,8 @@ > > bool StructType::indexValid(const Value *V) const { >
2016 Jul 21
2
FreeBSD user willing to try fix a unit test?
Hi all In unittests/ADT/APIntTest.cpp I came across this test: // XFAIL this test on FreeBSD where the system gcc-4.2.1 seems to miscompile it. #if defined(__llvm__) || !defined(__FreeBSD__) TEST(APIntTest, i33_Count) { APInt i33minus2(33, static_cast<uint64_t>(-2), true); EXPECT_EQ(0u, i33minus2.countLeadingZeros()); EXPECT_EQ(32u, i33minus2.countLeadingOnes()); EXPECT_EQ(33u,
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: > >
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
2009 Sep 28
2
[LLVMdev] Printing Function Arguments
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: CallInst *CI = dyn_cast<CallInst>(I); Value *v = CI->getOperand(1)
2013 Sep 06
0
[LLVMdev] How to get the exact integer from a Value
> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] > On Behalf Of weixuegong > Subject: [LLVMdev] How to get the exact integer from a Value > I have a Value* type named indexValue, and the type is i32. > I think "indexValue" must hold a number which type is int. Correct, but it might not be a constant. > ConstantInt* CI =
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]
2016 Nov 14
2
getting the value back from metadata
Hello, I'm trying to extract the value out of my MDNode, but for some reason I can't. For example, if one part of the code gets an MDNode that was created as follows: Metadata* vals[2] = { ValueAsMetadata::get(&F), ValueAsMetadata::get(ConstantInt::get(context, 135)) }; MDNode* mdnode = MDNode::get(context, vals); Is it possible to extract the value of the constant int