search for: getelementptrconstantexpr

Displaying 20 results from an estimated 22 matches for "getelementptrconstantexpr".

2012 Dec 29
2
[LLVMdev] GetElementPtrConstantExpr question
Hi all, I just come across an IR instruction like this: %0 = getelementptr i32* getelementptr inbounds ([42 x i32]* @aaa, i32 0, i32 0), i32 %2 What does the part "i32* getelementptr inbounds ([42 x i32]* @aaa, i32 0, i32 0)" mean? As far as I could understand this is a GetElementPtrConstantExpr, isn't it? My question is: how can I instantiate a class that represents that instruction part so that I can perform some changes in it? I tried the class GetElementPtrConstantExpr but it seems to be a private class to Constants.cpp (I saw a comment in lib/VMCore/ConstantsContext.h about that)...
2013 Aug 02
1
[LLVMdev] replacing GetElementPtrConstantExpr with GetElementPtrInst ... sometimes
Hi During a pass, the XCore target lowers thread local global variables by turning them into global variable arrays indexed by the (max 8) thread ID. (see XCoreLowerThreadLocal.cpp) This works fine for instructions e.g. GetElementPtrInst But can't be done for constants e.g. GetElementPtrConstantExpr Thus I would like to replace GetElementPtrConstantExpr with GetElementPtrInst when it is accessing a thread local global variable. (Other constant expression ignored for now). My attempt (example code below) has revealed my lack of understanding of llvm. For one thing I need to distinguish when t...
2009 Apr 30
2
[LLVMdev] Pulling line number/file/path information from DbgStopPointInst instructions
Hmm... if I do a print() on the result of getFileName(), I get i8 * getelementptr ([9 x i8]* @.str, i32 0, i32 0) back, but if I try to dyn_cast this to GetElementPtrInst it fails (returning null), so presumably I'm seeing a GetElementPtrConstantExpr... so how can I get at that constant i8 array without casting to a GetElementPtrInst, and with GetElementPtrConstantExpr being inaccessible to user code? [s] On Apr 29, 2009, at 6:29 PM, Bill Wendling wrote: > On Wed, Apr 29, 2009 at 6:04 PM, Sarah Thompson <sarah at findatlantis.com...
2011 Feb 10
0
[LLVMdev] ConstantExpr::replaceUsesOfWithOnConstant() function for llvm::GetElementPtrConstantExpr
Hi LLVMdev members I found something strange in ConstantExpr::replaceUsesOfWithOnConstant() function. in lib/VMCore/Constants.cpp file 2118 if (getOpcode() == Instruction::GetElementPtr) { 2119 SmallVector<Constant*, 8> Indices; 2120 Constant *Pointer = getOperand(0); 2121 Indices.reserve(getNumOperands()-1); 2122 if (Pointer == From) Pointer = To; 2123 2124 for
2012 Dec 18
2
[LLVMdev] GetElementPtrConstantExpr
Hi to all, I need the class in object, but the file ConstantsContext,h isn't installed. What can I do? Copy that header under include? It's an installation bug? Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121218/e1130d0a/attachment.html>
2012 Dec 18
0
[LLVMdev] GetElementPtrConstantExpr
Alessio Giovanni Baroni <alessiogiovanni.baroni at gmail.com> writes: > I need the class in object, but the file ConstantsContext,h isn't installed. > > What can I do? Copy that header under include? It's an installation bug? That's an internal header, not part of the public API. Why do you need the classes declared on that header?
2012 Dec 18
0
[LLVMdev] GetElementPtrConstantExpr
Alessio Giovanni Baroni <alessiogiovanni.baroni at gmail.com> writes: > Because I need to convert an [4 x i8] type to i8* in the instantiation of a > GlobalVariable. > I have the follow declaration: %xxx = type { i8* } and I must emit the > following variable: > @yyy = linkonce_odr constant %xxx { [4 x i8] c"hello\00" }, but it's wrong. > > How do I do?
2012 Dec 18
2
[LLVMdev] GetElementPtrConstantExpr
Because I need to convert an [4 x i8] type to i8* in the instantiation of a GlobalVariable. I have the follow declaration: %xxx = type { i8* } and I must emit the following variable: @yyy = linkonce_odr constant %xxx { [4 x i8] c"hello\00" }, but it's wrong. How do I do? 2012/12/18 Óscar Fuentes <ofv at wanadoo.es> > Alessio Giovanni Baroni <alessiogiovanni.baroni at
2012 Dec 19
0
[LLVMdev] GetElementPtrConstantExpr
On 19/12/12 10:25, Alessio Giovanni Baroni wrote: > Ok, now it's arising another problem. IR code that I obtain is the following: > > i8* bitcast ([5 x i8] c"hello\00" to i8*) You need to put your "hello" in a (constant) global variable. You can then bitcast the address of the global to i8*. I suggest you compile some C code that makes use of the address of a
2012 Dec 19
2
[LLVMdev] GetElementPtrConstantExpr
Ok, now it's arising another problem. IR code that I obtain is the following: i8* bitcast ([5 x i8] c"hello\00" to i8*) generated from instructions: ConstantExpr::getBitCast (ConstantDataArray::getString (getGlobalContext (), "hello"), PointerType::get (Type::getInt8Ty (getGlobalContext ()), 0)) but the LLC tool says: invalid cast opcode for cast from '[5 x i8]'
2014 Nov 22
3
[LLVMdev] How to get the indices in an getelementptr Value?
On Sat, Nov 22, 2014 at 11:09 AM, Sanjoy Das <sanjoy at playingwithpointers.com > wrote: > Hi Qiuping, > > If I'm reading the IR correctly, what you have is a > GetElementPtrConstantExpr [1]. It subclasses from llvm::Constant. > If you want the same code to handle GetElementPtrConstantExpr *and* GetElementPtrInst, you can use GEPOperator. > > Thanks, > -- Sanjoy > > [1]: > http://llvm.org/docs/doxygen/html/classllvm_1_1GetElementPtrConstantExpr.html > &g...
2019 Jul 23
2
Accessing global variables arrays result in inlined getelementptrs
Hello, Using LLVM+clang to do some static analysis, I face some issues due to the fact that when manipulating arrays that are global variables, IR getelementptr instructions seem to be somehow inlined. For example: int a[256]; int main() {     a[0] = 1; } gives as a result the following IR code (with clang+llvm 8, without any flag). @a = common dso_local global [256 x i32]
2014 Nov 22
2
[LLVMdev] How to get the indices in an getelementptr Value?
Hi Michael, Thank you very much. But idx_begin/idx_end iterators can only be used through a getelementptr instruction, right? However, I think value "i32* getelementptr inbounds (%struct.Args* @globalArg, i64 0, i32 2)" itself is not a getelementptr instruction, so? Or could you tell me how can I get a getelementptr instruction first from this value?
2009 Apr 30
0
[LLVMdev] Pulling line number/file/path information from DbgStopPointInst instructions
On Wed, Apr 29, 2009 at 6:04 PM, Sarah Thompson <sarah at findatlantis.com> wrote: > Hi folks, > > I had some code that used to work fine in earlier versions of LLVM, > but is now failing. I have some code that expands DbgStopPointInst > instructions to my own entry points in an opt pass, but it's currently > failing to get the file name and path back, though it is
2019 Mar 09
2
Cast a function parameter to GEP
Hi all, I'm still working on the Interpreter class and I would like to understand why an operand cannot be cast to GetElementPtrInst. My code is something like: void MyInterpreter::visitCallInst(CallInst& I) { for(int i = 0; i < I.getNumArgOperands(); i++) { operand = I.getOperand(i); if(GetElementPtrInst* CI = dyn_cast<GetElementPtrInst>(operand)) {
2009 Apr 30
2
[LLVMdev] Pulling line number/file/path information from DbgStopPointInst instructions
Hi folks, I had some code that used to work fine in earlier versions of LLVM, but is now failing. I have some code that expands DbgStopPointInst instructions to my own entry points in an opt pass, but it's currently failing to get the file name and path back, though it is still correctly getting line numbers. If you happen to have a code fragment that is known to work, it would be
2008 Jun 17
4
[LLVMdev] Transforming ConstantExprs to Instructions
Hi, I've been struggling with constantexprs for a bit. I'm working on a pass that transforms global variables to local variables, and in particular the GetElementPtrConstantExpr is a bit troublesome. For my transformation to properly work, a global value should only be used by Instructions, not by ConstantExprs. I was thinking to add a ConstantExpr::replaceWithInstr() virtual method, which translates all of the uses of a constantexpr with their Instruction equivalents, wh...
2019 Mar 09
2
Cast a function parameter to GEP
...> wrote: > Hi Alberto, > > On Sat, 9 Mar 2019 at 05:50, Alberto Barbaro via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str1, i32 0, i32 0) > > Because all of its inputs are Constants, this is actually a > GetElementPtrConstantExpr instead of a GetElementPtrInst (the easiest > way to tell on sight without context is the extra parens, which the > instruction variant never has). > > The main practical difference between the two is that instances of > Constant don't live in a BasicBlock independently, but are...
2013 Aug 19
4
[LLVMdev] Generating GetElementPtr inlined in a function argument list programmatically
Hello LLVMDev List, It's my first time sending a message to the List - I have been working on a tool for my research project using LLVM. Thanks for your awesome work! I have come across some bytecode like the following with an GetElementPtr instruction in brackets: Bytecode:%3 = call i32 @_Z4funcPKc(i8* getelementptr inbounds ([5 x i8]* @.str2, i32 0, i32 0)) C++ code:func("bleh");
2016 Dec 30
3
Avoiding during my pass the optimization (copy propagation) of my LLVM IR code (at generation)
Hello. I'm writing an LLVM pass that is working on LLVM IR. To my surprise the following LLVM pass code generates optimized code - it does copy propagation on it. Value *vecShuffleOnePtr = Builder.CreateGEP(ptr_B, vecShuffleOne, "VectorGep"); ... packed_gather_params.push_back(vecShuffleOnePtr); CallInst *callGather =