search for: bitcastinst

Displaying 20 results from an estimated 69 matches for "bitcastinst".

2015 Jun 18
3
[LLVMdev] problem with replacing an instruction
...at* noalias %arg0, float* noalias %arg1, float* noalias %arg2) { entrypoint: %0 = getelementptr float* %arg1, i64 0 %1 = bitcast float* %0 to <4 x float>* I must be close but the final instruction replacement results in a segfault. for (Instruction& I : BB) { if (isa<BitCastInst>(I)) { BitCastInst* BCI = dyn_cast<BitCastInst>(&I); for (Use& U : I.operands()) { Value* V = U.get(); if (!dyn_cast<Instruction>(V)) { // must be a function's argument std::vector<llvm::Value*> vect_1;...
2011 Oct 19
2
[LLVMdev] dyn_cast<BitCastInst> fails?
I am trying to dyn_cast a Value* to a BitCastInst. The dump of what I want casted is "i8* bitcast (i32 (i32)* @f1 to i8*)", so it is a BitCastInst. For someone my dyn_cast always fails, does anyone see why? arg->dump(); BitCastInst *bitcast = dyn_cast<BitCastInst>(arg); assert(bitcast != NULL); Thank yo...
2011 Oct 12
1
[LLVMdev] getting object from BitCastInst?
...ion pointers. From these StoreInsts I would like to get useful information(the function used if a direct assignment, function pointer used, etc) from the getValueOperand() method. Looking through several examples I see that this can return several things like: GlobalVariable, Function, LoadInst or BitCastInst depending on how much "indirection" is used. In the case of BitCastInst my dump shows "%ptr.addr = alloca i8*, align 8", I would like to isolate this just to "ptr". Ive tried doing another dyn_cast to AllocaInt, but I couldn't find any relevant methods. How Can I...
2010 Jun 12
1
[LLVMdev] Memory leak?
...::UnaryInstruction::UnaryInstruction(llvm::Type const*, unsigned int, llvm::Value*, llvm::Instruction*) + 75 6 opt 0x0873e46b llvm::CastInst::CastInst(llvm::Type const*, unsigned int, llvm::Value*, llvm::Twine const&, llvm::Instruction*) + 57 7 opt 0x0873124d llvm::BitCastInst::BitCastInst(llvm::Value*, llvm::Type const*, llvm::Twine const&, llvm::Instruction*) + 65 I insert extra two instructions to a byte code, the corresponding code is quite simple: LoadInst* ptrVal = new LoadInst(ptr, "foobar", false, next); CastInst* ptrCast = new BitCastInst(ptrVal...
2013 Apr 16
1
[LLVMdev] Instruction does not dominate all uses
...to relation. For this I'm inserting a function call of external function with the following type profile(int,int,int,void*,void*,...) I'm trying to pass the dereferenced pointer's memory address and the address of the location who are in alias set of the pointer. For this i'm using BitCastInst BitCastInst *init1= new BitCastInst(arg1,PointerType::getInt8PtrTy(Context),"bitcast",li2); But every time i have a dereferenced pointer inside a for loop I get an Instruction does not dominate all uses error. Instruction does not dominate all uses! %9 = load i32** %x2, align 4 %bi...
2013 Oct 10
0
[LLVMdev] Illegal BitCast assertion failed
...oid* data, unsigned b); // write b bytes starting, at address "data", to an internal queue void* read(unsigned b); // read and return b bytes from an internal queue Since I would like to be able to use variables of any type as arguments for these two functions, I thought I could create a BitCastInst, in order to cast a pointer from any type to void*, and then back, and insert it before calling write, or after calling read. And so I did like the example below // Let Func be an llvm::Function* that represents read, CArgs contain an integer constant, and // typeInFrontOfTheStream be an llvm::Typ...
2008 Nov 17
1
[LLVMdev] Assertion `InReg && "Value not in map!"' failed
Ah! I get it now. Thanks a lot ! I changed it to BitCastInst(AI,VoidPtrTy,"",j); And now I am getting the following error :(. I have been stuck with this error before also. I know I am missing out something silly. What is the cause of this error and Please let me know how to fix it. /home/bhavani/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp...
2011 Oct 20
3
[LLVMdev] common type at compile time?
...mmediately create a new GlobalVariable(that will be in its own section). I'm doing this so I have these address stored. In order to create this ConstantArray I need a valid ArrayType, but I'm not sure what to use for the element type. I want this to be done at compile time, so I cant use a BitCastInst to make them all generic pointers. What else can I do? In other words * I built up a vector id like to eventually store as a GlobalVariable array: vector<Constant *> v_elements; * Turned it into something for the ConstantArray::get can use: ArrayRef<Constant *> a_elements(v_elements);...
2011 Oct 20
2
[LLVMdev] common type at compile time?
...will be in its own section). I'm doing this so I >> have these address stored. In order to create this ConstantArray I >> need a valid ArrayType, but I'm not sure what to use for the element >> type. >> >> I want this to be done at compile time, so I cant use a BitCastInst to >> make them all generic pointers. What else can I do? > > You can use a ConstantExpr (constant expression) for Function  and > GlobalVariable objects.  The ArrayType can be an array of pointers to 8-byte > characters (basically a void pointer type). > > -- John T. > &...
2008 Nov 17
2
[LLVMdev] Assertion `castIsValid(getOpcode(), S, Ty) && "Illegal BitCast"' failed.
...ion pointer to a function which takes char * parameter and writes it to file. Value *Ten = ConstantInt::get(Type::Int32Ty, 10); const Type *VoidPtrTy = PointerType::getUnqual(Type::Int8Ty); AllocaInst *AI = new AllocaInst(Type::Int32Ty); Value *ST = new StoreInst(Ten,AI,false,4,j); Value *BT = new BitCastInst(ST,VoidPtrTy,"",j); CallInst *CallPrint = CallInst::Create(myprint, BT, "", j); CallPrint->setTailCall(true); I am getting the following error while executing. Assertion `castIsValid(getOpcode(), S, Ty) && "Illegal BitCast"' failed. What am I doing wr...
2015 Apr 15
1
[LLVMdev] How to do bitcast for double to <2 x double>
...ouble identical double values that is same as the one in the previous > instruction > > Instruction* ScalarToVectorLoad(Instruction* pInst) { > Value *loadValue = pInst->getOperand(0); > Instruction *newLoad; //this one should be 2% = load < 2 x double>* %1 > > BitCastInst *scalarToVector = new BitCastInst(loadValue, > VectorType::get(Type::getDoubleTy(currF->getContext()), 2), > "vectorizedLoad", pInst); > newLoad = new LoadInst(); //to be implemented... > return newLoad; > } > > On Wed, Apr 15, 2015 at 1:03 PM, mats petersson &...
2011 Oct 20
0
[LLVMdev] common type at compile time?
...antArray, so I'm > not sure how I could use this instead. What I meant here is that each element (Function *, GlobalVariable *) that you want to put into the ConstantArray will need to be casted to an i8 * type. To do the casting, you will need to use a bitcast ConstantExpr instead of a BitCastInst since you can't use instructions. -- John T. > > Thanks > > On Thu, Oct 20, 2011 at 12:04 PM, John Criswell<criswell at illinois.edu> wrote: >> On 10/20/11 10:43 AM, ret val wrote: >>> I'm trying to create a ConstantArray(whose contents will be of types &...
2008 Nov 17
1
[LLVMdev] Assertion `InReg && "Value not in map!"' failed
...uot;Value not in map!"' failed > To: bhavi63 at yahoo.com > Cc: "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu> > Date: Monday, November 17, 2008, 6:17 AM > bhavani krishnan wrote: > > Ah! I get it now. Thanks a lot ! > > I changed it to > BitCastInst(AI,VoidPtrTy,"",j); > > > > And now I am getting the following error :(. I have > been stuck with this error before also. I know I am missing > out something silly. What is the cause of this error and > Please let me know how to fix it. > > > > > /hom...
2013 Nov 23
2
[LLVMdev] GVN fails with bitcasts
Hi, i have the following code: define internal %"struct.dexter::ConditionConstant"* @_ZN6dexter18BinaryConditionAdd8evaluateEv5(%"class.dexter::BinaryConditionAdd"*) { entry: %1 = getelementptr inbounds %"class.dexter::BinaryConditionAdd"* %0, i32 0, i32 0, i32 1 %2 = load %"class.dexter::BaseCondition"** %1, align 8 %3 = bitcast
2011 Mar 14
2
[LLVMdev] How to load a data from the address of unsiged long type
...varaible. I tried the following three kind of code: 1. Code: Value* addr = CONST(0xc0008000); Value* data = new LoadInst(addr, "", false, bb); Error: Segmentation fault 2. Code( use BotVastInst to vern): Value* addr = CONST(0xc0008000); a = new BitCastInst(a, PointerType::get(XgetType(Int32Ty), 0), "", bb); Value* data = new LoadInst(addr, "", false, bb); Error: Bitcast requires types of same width 3. Code: Type const *intptr_type = cpu->dyncom_engine->exec_engine->getTargetData()->getIntPtr...
2015 Apr 16
3
[LLVMdev] double* to <2 x double>*
...ptyVec, loadValue, index0, ""); InsertVal = InsertElementInst::Create(emptyVec, loadValue, index1, ""); InsertVal->insertBefore(pInst); It turned out that the way I am doing is not right because the output is <2 x double*>. Any help will be appreciated! BTW, can I use bitcastInst (*if so, how?*) or I have to use insertelementInst? Thanks, Zhi -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150416/1e4dd80f/attachment.html>
2010 Sep 30
2
[LLVMdev] strange code behavior when non-prototyped user function are called
...; preds = %entry ret void } Notice there is now a bitcast operator embedded inside the call instruction. The problem, however, is that the 2nd flavor of LLVM IR breaks my code, which tries to detect all Call Instructions inside all Functions: ... if (BitCastInst *BCI = dyn_cast<BitCastInst>(II)){ errs() <<"find BitCastInst\n"; ... } if (CallInst *CI = dyn_cast<CallInst>(II)){ errs() <<"find CallInst\n"; ... } ... As a result, neither of the above two cases can trigger. I...
2015 Nov 13
5
How to efficiently extract the calledFunction from a complex CallInst?
Hi all, Usually if we want to get the called Function we can directly use CallInst->getCalledFunction(), however, today i encounter an unusual CallInst as follows: %call11 = call double (...)* bitcast (double ()* @quantum_frand to double (...)*)() the original C source involve type cast: float u,v; extern double quantum_frand(); u = 2 * quantum_frand() - 1; v = 2 * quantum_frand() -
2011 Aug 29
2
[LLVMdev] insertions with inst_iterators?
When I'm iterating through I only directly add BitCastInsts and a single CallInst(Im assuming the functions I also created are elsewhere). Unfortunately it doesnt look like theres is a good way to convert between the the iterator I and a CallInst *. Am I missing something? Thanks On Mon, Aug 29, 2011 at 3:59 PM, David Blaikie <dblaikie at gmail.com&gt...
2016 Jan 13
2
[GlobalISel] A Proposal for global instruction selection
...x i32>* %x > > is still fine. I should go and check that DSE doesn't do bad things for big-endian NEON actually... I just had a quick look and I think we're ok for this case at least. DSE is checking that the value operand of the StoreInst is a LoadInst. In this case it will be a BitCastInst and therefore the StoreInst won't be deleted.