search for: getpointeroperand

Displaying 20 results from an estimated 105 matches for "getpointeroperand".

2018 Feb 06
2
6 separate instances of static getPointerOperand(). Time to consolidate?
LLVM friends, I'm currently trying to make LoopVectorizationLegality class in Transform/Vectorize/LoopVectorize.cpp more modular and eventually move it to Analysis directory tree. It uses several file scope helper functions that do not really belong to LoopVectorize. Let me start from getPointerOperand(). Within LLVM, there are five other similar functions defined. I think it's time to define/declare this function in one place. Define in include/llvm/IR/Instructions.h as an inline function? Declare in include/llvm/IR/Instructions.h and define in lib/IR/Instructions.cpp? New files? (e.g., IR...
2018 Feb 06
0
6 separate instances of static getPointerOperand(). Time to consolidate?
...gt; I'm currently trying to make LoopVectorizationLegality class in > Transform/Vectorize/LoopVectorize.cpp more modular and eventually move > it to Analysis directory tree. It uses several file scope helper > functions that do not really belong to LoopVectorize. Let me start > from getPointerOperand(). Within LLVM, there are five other similar > functions defined. > > I think it's time to define/declare this function in one place. > > Define in include/llvm/IR/Instructions.h as an inline function? > Declare in include/llvm/IR/Instructions.h and define in lib/IR/Instructio...
2018 Feb 06
1
6 separate instances of static getPointerOperand(). Time to consolidate?
What LoopVectorize.cpp has are the following. Each function may have to have a separate consolidation discussion. I'm bringing up getpointerOperand() since I actually found multiple instances defined/used. DependenceAnalysis.cpp has isLoadOrStore(). LoopAccessAnalysis.cpp has getAddressSpaceOperand(). I'm sure there are others that might be worth discussing within this thread or a follow up. File name could be IR/LoadStoreGEPUtils.h/.cpp s...
2012 Feb 14
1
[LLVMdev] How to get the array size of GetElementPtrInst->getPointerOperand() ?
If I dump the Value of GetElementPtrInst->getPointerOperand(), I got this: %a = alloca [10 x i32], align 16 Obviously, there should be a way to get the dimension and element type via the "Value" returned from GetElementPtrInst->getPointerOperand(), but how? What kind of "Value" is this? Thanks! Welson -------------- next part --...
2012 Nov 02
0
[LLVMdev] DependenceAnalysis and PR14241
Here's the current code (abstracted a bit) const Instruction *Src, const Instruction *Dst, // make sure they are loads and stores, then const Value *SrcPtr = getPointerOperand(Src); // hides a little casting, then Src->getPointerOperand const Value *DstPtr = getPointerOperand(Dst); // ditto // see how underlying objects alias, then const GEPOperator *SrcGEP = dyn_cast<GEPOperator>(SrcPtr); const GEPOperator *DstGEP = dyn_cast<GEPOperator>(D...
2014 Mar 29
2
[LLVMdev] Cast specific pointer type to generic one
Hi, Suppose I have a pointer to "something" (a structure I defined) and I want to pass the pointer to a generic function, that gets a 64-bit address pointer. How do I do that? For instance: The function is: void Foo (void *); I get the specific pointer using getPointerOperand() on a store instruction that store to it: inst->getPointerOperand()->getType() Now I want to call Foo with the pointer, but the types of the arguments are mismatches - one is specific (%"class.XXX::YYY"*) and the other generic. How should I cast it so there won't be a mis...
2012 Nov 02
2
[LLVMdev] DependenceAnalysis and PR14241
On 11/02/2012 11:02 AM, Hal Finkel wrote: > ----- Original Message ----- >> From: "Tobias Grosser" <tobias at grosser.es> >> To: "preston briggs" <preston.briggs at gmail.com> >> Cc: "Benjamin Kramer" <benny.kra at gmail.com>, "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu> >> Sent: Friday, November
2009 Jul 25
2
[LLVMdev] [PATCH] PR2218
...t the patch: > > + for(unsigned argI = 0; argI < CS.arg_size(); ++argI) { > + if(CS.getArgument(argI)->stripPointerCasts() == pointer) > > Please put spaces after if/for. You get this right in some places, > but wrong in others. > > + Value* pointer = L->getPointerOperand(); > > Please use "Value *pointer" style throughout. It looks like > MemCpyOpt is already really inconsistent about this :-/ but please > don't make it worse :). > > + /* Pointer must be a parameter (case 1) */ > > please use C++ style // comments. >...
2013 Jan 28
5
[LLVMdev] Value* to Instruction*/LoadInst* casting
...e* V2 = icmpInstrArray[i]->getOperand(1); if (isa<LoadInst>(V1) || isa<LoadInst>(V2)){ ... if(isa<LoadInst>(icmpInstrArray[i]->getOperand(0))) LoadInst *LD100 = cast<LoadInst>(icmpInstrArray[i]->getOperand(0)); Value *C100 = LD100->getPointerOperand(); //HERE COMPILATION ERROR Further, I just need to make `C100->getName()` and I will get the loaded variable. I don't think that I can use cast like that. Can you tell me a method to obtain the loaded variable from a Load instruction correspondent to my ICMP instructions? Or better how I c...
2013 Nov 15
4
[LLVMdev] Limit loop vectorizer to SSE
...ng like: index 6db7f68..68564cb 100644 --- a/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -1208,6 +1208,8 @@ void InnerLoopVectorizer::vectorizeMemoryInstruction(Instr Type *DataTy = VectorType::get(ScalarDataTy, VF); Value *Ptr = LI ? LI->getPointerOperand() : SI->getPointerOperand(); unsigned Alignment = LI ? LI->getAlignment() : SI->getAlignment(); + if (Alignment == 0) + Alignment = 1; unsigned AddressSpace = Ptr->getType()->getPointerAddressSpace(); unsigned ScalarAllocatedSize = DL->getTypeAllocSize(ScalarDataTy);...
2009 Jul 23
0
[LLVMdev] [PATCH] PR2218
...h has them!). Nit picky stuff about the patch: + for(unsigned argI = 0; argI < CS.arg_size(); ++argI) { + if(CS.getArgument(argI)->stripPointerCasts() == pointer) Please put spaces after if/for. You get this right in some places, but wrong in others. + Value* pointer = L->getPointerOperand(); Please use "Value *pointer" style throughout. It looks like MemCpyOpt is already really inconsistent about this :-/ but please don't make it worse :). + /* Pointer must be a parameter (case 1) */ please use C++ style // comments. Some other points: 1. I don't see...
2009 Aug 07
0
[LLVMdev] [PATCH] PR2218
...must-alias with our pointer. + if (S->isVolatile()) { + return false; + } else { no need for the 'else after return': http://llvm.org/docs/CodingStandards.html#hl_else_after_return + AliasAnalysis& AA = getAnalysis<AliasAnalysis>(); + if (AA.alias(S->getPointerOperand(), 1, pointer, 1) != + AliasAnalysis::MustAlias) + return false; Knowing that the loaded and stored pointer must alias is important, but you also need to check that the loaded and stored sizes equal each other. + // Look for a replacement for our pointer. If more than one found, exit. +...
2009 Jul 22
2
[LLVMdev] [PATCH] PR2218
Hello, This patch fixes PR2218. However, I'm not pretty sure that this optimization should be in MemCpyOpt. I think that GVN is good place as well. Regards -- Jakub Staszak -------------- next part -------------- A non-text attachment was scrubbed... Name: pr2218.patch Type: application/octet-stream Size: 6146 bytes Desc: not available URL:
2013 Jan 28
0
[LLVMdev] Value* to Instruction*/LoadInst* casting
...->getOperand(1); > if (isa<LoadInst>(V1) || isa<LoadInst>(V2)){ > ... > if(isa<LoadInst>(icmpInstrArray[i]->getOperand(0))) > LoadInst *LD100 = cast<LoadInst>(icmpInstrArray[i]->getOperand(0)); > Value *C100 = LD100->getPointerOperand(); //HERE COMPILATION > ERROR > Further, I just need to make `C100->getName()` and I will get the loaded > variable. > > I don't think that I can use cast like that. Can you tell me a method to > obtain the loaded variable from a Load instruction correspondent to my ICMP &g...
2019 Jul 17
2
Help to understand LoadValueFromMemory
...- %5 in my case ) and the fread() has been already called. I thought the correct approach to achieve what I need was: ExecutionContext& SF = ECStack.back(); GenericValue SRC = getOperandValue(source, SF); GenericValue* Ptr = (GenericValue*)GVTOP(SRC); GenericValue Result; source->getPointerOperand()->getType()->dump(); //[40 x i8]* LoadValueFromMemory(Result, Ptr, source->getPointerOperand()->getType()); and use Result.PointerVal ... In the end I have the first 4 bytes within Result.PointrVal but I cannot see the other bytes.. Unfortunately also Result.AggregateVal has size 0....
2013 Jan 28
1
[LLVMdev] Value* to Instruction*/LoadInst* casting
...>> if (isa<LoadInst>(V1) || isa<LoadInst>(V2)){ >> ... >> if(isa<LoadInst>(icmpInstrArray[i]->getOperand(0))) >> LoadInst *LD100 = cast<LoadInst>(icmpInstrArray[i]->getOperand(0)); >> Value *C100 = LD100->getPointerOperand(); //HERE COMPILATION >> ERROR >> Further, I just need to make `C100->getName()` and I will get the loaded >> variable. Looks like you meant to write if (isa<LoadInst>(icmpInstrArray[i]->getOperand(0))) { LoadInst *LD100 = cast<LoadInst>(icmpInstrArray[i]-&gt...
2011 Feb 17
2
[LLVMdev] Getting load/store byte size
...39;m reading a local variable 'a': %1 = load i32* %a, align 4 I need to know the address of the variable 'a' and the size. Of course, memory loads/stores could be from general GEP or global variables. Getting the address was easily doable by using "PtrToIntInst(load_inst->getPointerOperand(), ...)". However, getting load/store size wasn't that straight forward. In this example, it should be four bytes. I tried to get the Type* from the getPointerOperand() and tried to retrieve the size of the type, but failed. Question: [1] How can I retrieve the read/write size of load/sto...
2009 May 21
3
[LLVMdev] Passing a pointer to a function
...struction type. Then I will link the output to some C file that implements those functions. Things were going well until I started trying to make function calls with a pointer as a parameter. For example, I would like to do something like: void visitLoadInst(LoadInst &I) { Value *P; P = I.getPointerOperand(); CallInst::Create(load_fcall, P, "", &I); } Where load_fcall is build using a call to Module::getOrInsertFunction as in the example here: http://wiki.llvm.org/HowTo:_Insert_a_function_call My question is, what do I pass as the argument type for P above? The following seems to...
2013 Nov 15
0
[LLVMdev] Limit loop vectorizer to SSE
...cb 100644 > --- a/lib/Transforms/Vectorize/LoopVectorize.cpp > +++ b/lib/Transforms/Vectorize/LoopVectorize.cpp > @@ -1208,6 +1208,8 @@ void > InnerLoopVectorizer::vectorizeMemoryInstruction(Instr > Type *DataTy = VectorType::get(ScalarDataTy, VF); > Value *Ptr = LI ? LI->getPointerOperand() : > SI->getPointerOperand(); > unsigned Alignment = LI ? LI->getAlignment() : SI->getAlignment(); > + if (Alignment == 0) > + Alignment = 1; That may be conservatively correct, but I don't think it is really right. An alignment of 0 is supposed to mean the plat...
2013 Nov 15
2
[LLVMdev] Limit loop vectorizer to SSE
...a/lib/Transforms/Vectorize/LoopVectorize.cpp >> +++ b/lib/Transforms/Vectorize/LoopVectorize.cpp >> @@ -1208,6 +1208,8 @@ void >> InnerLoopVectorizer::vectorizeMemoryInstruction(Instr >> Type *DataTy = VectorType::get(ScalarDataTy, VF); >> Value *Ptr = LI ? LI->getPointerOperand() : >> SI->getPointerOperand(); >> unsigned Alignment = LI ? LI->getAlignment() : SI->getAlignment(); >> + if (Alignment == 0) >> + Alignment = 1; > > That may be conservatively correct, but I don't think it is really right. An alignment of 0 is s...