search for: castinst

Displaying 20 results from an estimated 71 matches for "castinst".

2017 Jun 04
2
need more information about the two classes of CallInst and CastInst
Hello, everyone. I want to know more about the classes of CallInst and CastInst, but i can just find some information of them in the InstrTypes.h file. Can you offer me more materials about the two important classes? If there are some cases, that is better. Thank you! 2017/6/4 Jay -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lis...
2007 Feb 24
3
[LLVMdev] cast instruction
I need to create a cast instruction that casts an sbyte* to another pointer type. Previously I was using the CastInst::createInferredCast() function to do that; however, that function has been removed. Which of the create() functions from CastInst should I use to do that? It seems like the obdvious answer should be createPointerCast(). However, the documentation for createPointerCast says, "Create a Bi...
2010 Jun 12
1
[LLVMdev] Memory leak?
...llvm::Instruction::Instruction(llvm::Type const*, unsigned int, llvm::Use*, unsigned int, llvm::Instruction*) + 109 5 opt 0x083d208b llvm::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 cod...
2010 May 16
1
[LLVMdev] How to access the return value of a CallInst
...ying to get the return value of a call instruction that I inserted during the optimization pass I wrote. I have something like the following: CallInst *InitCall = CallInst::Create(InitFn, Args.begin(), Args.end(), "log_load_addr_ret", LI); CastInst *InsertedCast = CastInst::CreateTruncOrBitCast(InitCall.getCalledValue(), LI->getType(), "return_load", LI); I assume that getCalledValue() will give me the return value of the InitCall CallInst. This compiles fine. But the CastInst cannot be created. The runtime error is : o...
2014 Sep 01
2
[LLVMdev] Instrumenting Various Types Using Single Instrumentation Function
...l not have to create different instrumentation functions for different data types. Can I cast say i32 value to NumericType value in my instrumentation code, without inserting additional instructions in my benchmark code. I tried inserting bitcast instructions and it doesn't work for me... if(!CastInst::isCastable(Lvals[j]->getType(), UnionVar->getType())){ errs()<<"CAST TO NumericType NOT POSSIBLE\n"; exit(0); } CastInst *I = CastInst::CreateZExtOrBitCast(Lvals[j], UnionVar->getType(), "", F); Is this even possible or some other method wil...
2015 Jan 05
3
[LLVMdev] should AlwaysInliner inline this case?
...cast (i32 (i32*)* @g to i32 (i64)*)(i64 %a) ret i32 %call } > > The idea of improving the inliner is also great, but you may find that > it's needed for cases other than this one if i'm right about the > instcombine. > Sadly, the combine fails because InstCombine queries CastInst::isBitCastable to determine the castable-ness of the parameter type and the argument type. It isn't bitcastable though, it's ptrtoint/inttoptr castable. The following patch opens up the optimization: --- a/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/lib/Transforms/InstCombine/In...
2012 Dec 21
2
[LLVMdev] assert in InnerLoopVectorizer::createEmptyLoop
...ing because it is trying to zero-extend an i64 (type Count->getType() returns i64) to an i32 (IdxTy). if (Count->getType() != IdxTy) { // The exit count can be of pointer type. Convert it to the correct // integer type. if (ExitCount->getType()->isPointerTy()) Count = CastInst::CreatePointerCast(Count, IdxTy, "ptrcnt.to.int", Loc); else Count = CastInst::CreateZExtOrBitCast(Count, IdxTy, "zext.cnt", Loc); // <= this line } -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail...
2008 May 22
2
[LLVMdev] Latest SVN head (gcc front end) build failed
...lvm.org/svn/llvm-project/llvm-gcc-4.2/trunk configure option: ../dst-directory/configure --prefix=/usr/local/ --enable-llvm=/home/rajika/project/llvm/llvm-objects it gave me the following errors ../../dst-directory/gcc/llvm-convert.cpp:1163: error: 'Create' is not a member of 'llvm::CastInst' ../../dst-directory/gcc/llvm-convert.cpp: In member function 'llvm::AllocaInst* TreeToLLVM::CreateTemporary(const llvm::Type*)': ../../dst-directory/gcc/llvm-convert.cpp:1250: error: 'Create' is not a member of 'llvm::CastInst' make[3]: *** [llvm-convert.o] Error 1 make...
2012 Dec 21
0
[LLVMdev] assert in InnerLoopVectorizer::createEmptyLoop
...xtend an i64 (type > Count->getType() returns i64) to an i32 (IdxTy). > > if (Count->getType() != IdxTy) { > // The exit count can be of pointer type. Convert it to the correct > // integer type. > if (ExitCount->getType()->isPointerTy()) > Count = CastInst::CreatePointerCast(Count, IdxTy, "ptrcnt.to.int", > Loc); > else > Count = CastInst::CreateZExtOrBitCast(Count, IdxTy, "zext.cnt", > Loc); // <= this line > } > > > > _______________________________________________ > LLVM Developers m...
2019 Oct 30
2
pointer arithmetic with address space attribute not working
...ash-4.4$ cat test.c #define __user __attribute__((address_space(1))) void __user * test(void __user *arg) { #ifdef ADD return arg + 4; #else return arg; #endif } -bash-4.4$ -bash-4.4$ clang -g -c test.c -bash-4.4$ clang -g -c -DADD test.c clang-10: ../lib/IR/Instructions.cpp:2749: static llvm::CastInst *llvm::CastInst::Create(Instruction::CastOps, llvm::Value *, llvm::Type *, const llvm::Twine &, llvm::Instruction *): Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed. Stack dump: 0. Program arguments: /data/users/yhs/work/llvm-project/llvm/build/install/b...
2009 Sep 28
0
[LLVMdev] Printing Function Arguments
...{ } 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 out how to do that, e.g. via the I->getSrcTy() methods for say CastInst's instructions. My goal with this exercise was to write a small interpreter for the SSA IR, so I still need to associate some state with all the Instructions, for example, if I have a loop in the SSA, then the concrete values of the virtual registers (represented as Instruction * here) can cha...
2011 Aug 19
1
[LLVMdev] LLVM: Very simple question
Hi, guys. I'm a newbie to LLVM and have a very simple question. Which instructions should I use (in terms of IRBuilder calls) to allocate an array of bytes in stack (alloca?), then to work with it (from a given offset) as with integer (bitcast?). I mean something like that: unsigned char var[8]; unsigned int offset = 3; int val = *(int*)(&var+offset); /* read */ *(int*)(&var+offset)
2008 May 22
0
[LLVMdev] Latest SVN head (gcc front end) build failed
...nk > > configure option: ../dst-directory/configure --prefix=/usr/local/ > --enable-llvm=/home/rajika/project/llvm/llvm-objects > > it gave me the following errors > > ../../dst-directory/gcc/llvm-convert.cpp:1163: error: 'Create' is > not a member of 'llvm::CastInst' > ../../dst-directory/gcc/llvm-convert.cpp: In member function > 'llvm::AllocaInst* TreeToLLVM::CreateTemporary(const llvm::Type*)': > ../../dst-directory/gcc/llvm-convert.cpp:1250: error: 'Create' is > not a member of 'llvm::CastInst' > make[3]: ***...
2019 Oct 31
2
pointer arithmetic with address space attribute not working
...ash-4.4$ cat test.c #define __user __attribute__((address_space(1))) void __user * test(void __user *arg) { #ifdef ADD return arg + 4; #else return arg; #endif } -bash-4.4$ -bash-4.4$ clang -g -c test.c -bash-4.4$ clang -g -c -DADD test.c clang-10: ../lib/IR/Instructions.cpp:2749: static llvm::CastInst *llvm::CastInst::Create(Instruction::CastOps, llvm::Value *, llvm::Type *, const llvm::Twine &, llvm::Instruction *): Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed. Stack dump: 0. Program arguments: /data/users/yhs/work/llvm-project/llvm/build/install/b...
2019 Oct 31
2
pointer arithmetic with address space attribute not working
...pace(1))) > void __user * test(void __user *arg) { > #ifdef ADD > return arg + 4; > #else > return arg; > #endif > } > -bash-4.4$ > > -bash-4.4$ clang -g -c test.c > -bash-4.4$ clang -g -c -DADD test.c > clang-10: ../lib/IR/Instructions.cpp:2749: static llvm::CastInst > *llvm::CastInst::Create(Instruction::CastOps, llvm::Value *, > llvm::Type *, const llvm::Twine > &, llvm::Instruction *): Assertion `castIsValid(op, S, Ty) && "Invalid > cast!"' failed. > Stack dump: > 0. Program arguments: > /data/users/yhs/wor...
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 May 21
3
[LLVMdev] Passing a pointer to a function
I recently began hacking around with my first LLVM pass. The big picture is that I would like to insert function calls for each instruction type, and pass some parameters based on the instruction 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
2009 May 21
0
[LLVMdev] Passing a pointer to a function
On Wed, May 20, 2009 at 7:31 PM, Scott Ricketts <sricketts at maxentric.com> wrote: > 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 work, as long as there are no floating
2012 Jun 19
0
[LLVMdev] Cast Pointer Address to Functions
> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Xin Tong > Subject: [LLVMdev] Cast Pointer Address to Functions > I have a function address held in an uint64_t. I would like to cast > the function address to a function prototype and create a call to the > function in LLVM. How could I do this ? This is what works for us:
2012 Dec 21
0
[LLVMdev] assert in InnerLoopVectorizer::createEmptyLoop
...ing because it is trying to zero-extend an i64 (type Count->getType() returns i64) to an i32 (IdxTy). if (Count->getType() != IdxTy) { // The exit count can be of pointer type. Convert it to the correct // integer type. if (ExitCount->getType()->isPointerTy()) Count = CastInst::CreatePointerCast(Count, IdxTy, "ptrcnt.to.int", Loc); else Count = CastInst::CreateZExtOrBitCast(Count, IdxTy, "zext.cnt", Loc); // <= this line } -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail...