search for: integertype

Displaying 20 results from an estimated 138 matches for "integertype".

2015 Jan 22
2
[LLVMdev] access IntegerType::getSignBit from Type *
Hi, I have a Type * which may come from an IntegerType as shown below: Type.getIntegerBitWidth() tells me numBits. But how to extract the IntegerType.getSignBit? If pType isIntegerType, I need to know if it is signed or unsigned... How to achieve this? Thx Alex llvm::Type * getRandomValid_IntegerType(llvm::LLVMContext &C) { using namesp...
2010 Apr 28
1
[LLVMdev] LLVM Tutorial 1: Something got wrong?
it seems the code snippit below cann't be compiled throuth. the compiler complains: error: no matching function for call to ‘llvm::IntegerType::get(int)’ /usr/local/include/llvm/DerivedTypes.h:108: note: candidates are: static const llvm::IntegerType* llvm::IntegerType::get(llvm::LLVMContext&, unsigned int) Module* makeLLVMModule() { // Module Construction Module* mod = new Module("test", getGlobalContext()); Consta...
2014 Jan 08
3
[LLVMdev] reference to non-static member function must be called
...is declared like this: void func(int a, unsigned chat *p); and in the Pass(a Function Pass ,and using the InstVistor template ), I wrote like this: void visitStoreInst(StoreInst &SI) { //Get the refference of the types Module *M = SI.getParent()->getParent()->getParent(); IntegerType* Int8Type = IntegerType::getInt8Ty(M->getContext()); IntegerType* Int32Type = IntegerType::getInt32Ty(M->getContext()); IntegerType* Int64Type = IntegerType::getInt64Ty(M->getContext()); PointerType* VoidPtrType = PointerType::getUnqual(Int8Type); Type* VoidType = Type::getVoi...
2011 Jan 24
2
[LLVMdev] How to create an IntegerType of the native word size
Hi all, I couldn't find any reasonable way to create the IntegerType that would match, say, intptr_t, that is the native word size of the machine I'm building on. More accurately defined, when compiling on a 64 bit Mac OS machine I want it to be Int64Ty, but if for example I'm using the "-arch i386" command line option on that machine during compil...
2013 Apr 16
1
[LLVMdev] creating and inserting a function with variable arguments
The code that I have written to get the function type is: const std::vector<Type *> ParamTys; ParamTys.push_back(IntegerType::getInt32Ty(Context)); ParamTys.push_back(IntegerType::getInt32Ty(Context)); ParamTys.push_back(IntegerType::getInt32Ty(Context)); ParamTys.push_back(PointerType::get(Type::getVoidTy(Context), 0)); ParamTys.push_back(PointerType::get(Type::getVoidTy(Context), 0)); FunctionType *ftype = FunctionTyp...
2009 Oct 03
1
[LLVMdev] LLVM-Kaleidoscope tutorial
Good morning everyone, It seems the LLVM tutorial is not up to date anymore and doesn't compile as is... The function makeLLVMModule() function doesn't compile at all. Here is a fix: Module *makeLLVMModule() { // Caches the global context to share it with new Module() and IntegerType::get() calls LLVMContext &context = getGlobalContext(); // Module Construction Module *mod = new Module("test", context); Constant *c = mod->getOrInsertFunction("mul_add", // IntegerType::get (context, 32)...
2011 Feb 15
3
[LLVMdev] Structure Types and ABI sizes
Hi all, We're hitting some walls here when generating the correct structure layout for specific C++ ABI requirements, and I was wondering how much StructLayout could help. For instance, the ABI has some complicated rules on the size of derived classes (http://www.codesourcery.com/public/cxx-abi/abi.html#class-types) and LLVM struct type cannot reflect that in full. Example: // CHECK:
2013 Apr 16
0
[LLVMdev] creating and inserting a function with variable arguments
Akshay Jain <jivan.molu at gmail.com> writes: > I have tried it, but I always end up with some kind of error. Can you > explain how can I get a function type for function which returns void > (nothing) and it's arguments are (int, int, int, void *, void *, ...) ?? Instead of getting something to cut&paste, you would be much more enriched if the problematic code and the
2011 May 13
3
[LLVMdev] IO intrinsics?
I found these lines in the BrainF example: //declare i32 @getchar() getchar_func = cast<Function>(module-> getOrInsertFunction("getchar", IntegerType::getInt32Ty(C), NULL)); //declare i32 @putchar(i32) putchar_func = cast<Function>(module-> getOrInsertFunction("putchar", IntegerType::getInt32Ty(C), IntegerType::getInt32Ty(C), NULL)); Since getchar and putchar are never defined, I'm assu...
2014 Jan 09
2
[LLVMdev] reference to non-static member function must be called
I'm using LLVM 3.3 Release. From the Class Reference Page. CallInst has a member function : static CallInst * Create (Value *Func, ArrayRef< Value * > Args, const Twine &NameStr="", Instruction *InsertBefore=0) This is what I want to use! the default name is "" and I also use that . Thanks! ----- Kind Regards! -JinHuang -- View this message in context:
2013 Jul 25
2
[LLVMdev] Error for AllocaInst and Instruction
Hi, For the following code const Type * Int32Type = IntegerType::getInt32Ty(getGlobalContext()); AllocaInst* newInst = new AllocaInst(Int32Type, 0, "flag", Bb); Bb->getInstList().push_back(newInst); It gives me the error " error: no matching constructor for initialization of 'llvm::AllocaInst' AllocaInst*...
2009 Oct 03
1
[LLVMdev] code generation goes into an infinite loop
..._, __LINE__); // Module* Mod = makeLLVMModule(); llvm::Module *mod = new llvm::Module("test"); // make a function object printf("%s:%d make function\n", __FILE__, __LINE__); // Constant* c = mod->getOrInsertFunction // ("mul_add", // /*ret type*/ IntegerType::get(32), // /*args*/ IntegerType::get(32), // IntegerType::get(32), // IntegerType::get(32), // /*varargs terminated with null*/ NULL); llvm::Constant *c = mod->getOrInsertFunction ("main", // function name llvm::IntegerType::get(32),...
2013 Apr 16
2
[LLVMdev] creating and inserting a function with variable arguments
I have tried it, but I always end up with some kind of error. Can you explain how can I get a function type for function which returns void (nothing) and it's arguments are (int, int, int, void *, void *, ...) ?? Thanks in advance. On Tue, Apr 16, 2013 at 7:22 AM, Óscar Fuentes <ofv at wanadoo.es> wrote: > Akshay Jain <jivan.molu at gmail.com> writes: > > > I am
2010 Nov 23
1
[LLVMdev] how to get a void type value in llvm
Hi, sivart Thanks for pointing it out. I used it, and it works. Thank you again. BTW, for any later reference, the function prototype declaration with no arguments is not what I wrote: fcall2 = M.getOrInsertFunction("foo", IntegerType::get(M.getContext(), 32), Type::getVoidTy(M.getContext())); INSTEAD, I changed to : fcall2 = M.getOrInsertFunction("foo", FunctionType::get( IntegerType::get(M.getContext(), 32), false)); combining with this, the insertion works finally. Thanks, --Shuying On Mon, Nov 22, 2010 at 6:...
2010 Sep 16
2
[LLVMdev] Check if an IntegerType is signed
How can I check if a particular Integer Type is signed/unsigned? Arushi -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100916/baea061d/attachment.html>
2010 Nov 23
2
[LLVMdev] how to get a void type value in llvm
Hi, I want to insert a function with a void type parameter, for example: int foo(void); OI declared fcall2 = M.getOrInsertFunction("foo", IntegerType::get(M.getContext(), 32), Type::getVoidTy(M.getContext())); then the question is how to get the void type value to make the CallInst inserted sucessfully? (what should be ********) CallInst::Create(fcall2, ******, "", insertPos); -- --Shuying
2011 Jul 11
2
[LLVMdev] type-system-rewrite branch landing tomorrow
Sorry, these IRBuilder methods are really in IRBuilderBase. Garrison On Jul 11, 2011, at 11:54, Garrison Venn wrote: > Are the get type methods for IRBuilder, such as const IntegerType *getInt32Ty(), going to have > their return type const qualifiers removed? Doing so would match the semi equivalent static > methods of Type, such as static IntegerType *getInt32Ty(LLVMContext &C). > > Thanks in advance > > Garrison > > On Jul 9, 2011, at 3:35, Chris...
2015 Nov 24
2
How to create a sprintf call in IR
...code, where length, a, b, c, are global variables. int length = 0; length += sprintf(buffer+length, "str%d", a); length += sprintf(buffer+length, "str%c", b); length += sprintf(buffer+length, "str%d", c); I did it in the following way. 1. Create the global array: IntegerType CHARTYPE = IntegerType::get(llvm::getGlobalContext(), 8); ArrayType* ty = ArrayType::get(CHARTYPE, 1024); GlobalVariable* buffer = new GlobalVariable(mod, ty, false, GlobalValue::ExternalLinkage, 0, "buffer"); 2. Create sprintf std::vector<Type*> agrs(2, Type::getInt8P...
2020 Jan 14
2
sizeof implementation: how to get size as a constantInt?
...ableSizedStructs.txt illuarstrated, and it works find, here's an example of my implementation: auto *p = builder.CreateGEP(structTy, llvm::ConstantPointerNull::get(pointerTy), constint1); auto *size = builder.CreatePtrToInt(p, llvm::IntegerType::get(context, 64)); and type definitions: auto *constint1 = llvm::ConstantInt::get(context, llvm::APInt(64, 1)); auto *int64Ty = llvm::IntegerType::get(context, 64); auto *doubleTy = llvm::Type::getDoubleTy(context); auto *structTy = llvm::StructType::create(context, "Foo"); structTy-&gt...
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)