search for: getint8ptrty

Displaying 20 results from an estimated 35 matches for "getint8ptrty".

2010 Nov 29
3
[LLVMdev] FunctionType as a function argument
Hi all. I would like to declare a function that takes a function pointer as an argument. In C, it would be : void execute(char (*func)(void*), void *param) So, in my compiler, I have : std::vector<const Type *> cbFPtrArgs(1, Type::getInt8PtrTy(C)); FunctionType * cbFPtrTy = FunctionType::get(Type::getInt8Ty(C), cbFPtrArgs, false); Function * func = cast<Function>(M->getOrInsertFunction(fName, Type::getInt32Ty(C), cbFPtrTy, Type::getInt8PtrTy(C), (Type *)0)); But then I get an error form LLVM : /home/salomon/AppSRC/LLVM/releas...
2009 Nov 05
5
[LLVMdev] llvm-gcc-4.2-2.6 build failed,
...ckend.cpp: In function ‘void createPerFunctionOptimizationPasses()’: ../../llvm-gcc-4.2/gcc/llvm-backend.cpp:671: error: ‘Less’ is not a member of ‘llvm::CodeGenOpt’ ../../llvm-gcc-4.2/gcc/llvm-backend.cpp: In function ‘void llvm_asm_file_end()’: ../../llvm-gcc-4.2/gcc/llvm-backend.cpp:874: error: ‘getInt8PtrTy’ is not a member of ‘llvm::Type’ ../../llvm-gcc-4.2/gcc/llvm-backend.cpp:893: error: ‘getInt8PtrTy’ is not a member of ‘llvm::Type’ ../../llvm-gcc-4.2/gcc/llvm-backend.cpp: In function ‘void AddAnnotateAttrsToGlobal(llvm::GlobalValue*, tree_node*)’: ../../llvm-gcc-4.2/gcc/llvm-backend.cpp:1171: err...
2010 Nov 29
0
[LLVMdev] FunctionType as a function argument
...il.com>wrote: > Hi all. > I would like to declare a function that takes a function pointer as an > argument. > In C, it would be : > > void execute(char (*func)(void*), void *param) > > So, in my compiler, I have : > std::vector<const Type *> cbFPtrArgs(1, Type::getInt8PtrTy(C)); > FunctionType * cbFPtrTy = FunctionType::get(Type::getInt8Ty(C), > cbFPtrArgs, false); > Function * func = cast<Function>(M->getOrInsertFunction(fName, > Type::getInt32Ty(C), cbFPtrTy, Type::getInt8PtrTy(C), (Type *)0)); > > But then I get an error form LLVM : &gt...
2009 Nov 06
1
[LLVMdev] llvm-gcc-4.2-2.6 build failed,
...ckend.cpp: In function ‘void createPerFunctionOptimizationPasses()’: ../../llvm-gcc-4.2/gcc/llvm-backend.cpp:671: error: ‘Less’ is not a member of ‘llvm::CodeGenOpt’ ../../llvm-gcc-4.2/gcc/llvm-backend.cpp: In function ‘void llvm_asm_file_end()’: ../../llvm-gcc-4.2/gcc/llvm-backend.cpp:874: error: ‘getInt8PtrTy’ is not a member of ‘llvm::Type’ ../../llvm-gcc-4.2/gcc/llvm-backend.cpp:893: error: ‘getInt8PtrTy’ is not a member of ‘llvm::Type’ ../../llvm-gcc-4.2/gcc/llvm-backend.cpp: In function ‘void AddAnnotateAttrsToGlobal(llvm::GlobalValue*, tree_node*)’: ../../llvm-gcc-4.2/gcc/llvm-backend.cpp:1171: err...
2011 Apr 05
3
[LLVMdev] inserting a print statement into IR
Hi Everyone, I am trying to construct the print statement : printf("value:%d\n", value); This is my llvm code. It is seg faulting at builder.CreateGlobalStringPtr(str,""). Thanks. George vector<const Type *> params; params.push_back(Type::getInt8PtrTy(M.getContext())); FunctionType *fType = FunctionType::get(Type::getInt32Ty(M.getContext()), params, true); Constant *temp = M.getOrInsertFunction("printf",fType); if(!temp){ errs() << "printf function not in symbol table\n"; exit(1); } Function *f = cast<Function&gt...
2015 Nov 24
2
How to create a sprintf call in IR
...egerType 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::getInt8PtrTy(ctxt)); FunctionType* sprintfFT = FunctionType::get(Type::getInt32Ty(ctxt), args, true); Constant* sprintf = mod->getOrInsertFunction("sprintf", sprintfFT); Now, I got stuck to create teh function call for sprintf. I didn't it like the following: Value* str = b...
2011 Oct 20
2
[LLVMdev] common type at compile time?
I'm a bit confused. For the Type did you mean something like: ArrayType *type = ArrayType::get(Type::getInt8PtrTy(M.getContext()), 4); This does not work, it gives me ""Wrong type in array element initializer" at runtime. Also it doesn't look like ConstantExpr inherits ConstantArray, so I'm not sure how I could use this instead. Thanks On Thu, Oct 20, 2011 at 12:04 PM, John Criswell &...
2010 Sep 07
0
[LLVMdev] Intrinsic prototype has incorrect number of arguments!
On Sep 7, 2010, at 11:30 AM, F van der Meeren wrote: > > > Any ideas on what I am doing wrong here ? > Why not just use something like: const Type *ArgPtr = Type::getInt8PtrTy(Context); const Type *IntPtr = getTargetData().getIntPtrType(Context); and then: const Type *ArgTypes[3] = {ArgPtr, ArgPtr, IntPtr }; Intrinsic::getDeclaration(TheModule, Intrinsic::memcpy, ArgTypes, 3) to get the type of memcpy? Trying to declare it that way is likely confusing to th...
2018 May 16
0
Global is external, but doesn't have external or weak linkage!
Hi, I have a pass that creates a GlobalVariable, when I ran it get the following error: Global is external, but doesn't have external or weak linkage! i8** @myvar This is how I create the GlobalVariable: ------------------------------------------------ new llvm::GlobalVariable(*M, IRB.getInt8PtrTy(), false, llvm::GlobalValue::CommonLinkage, nullptr, "myvar", NULL, GlobalVariable::GeneralDynamicTLSModel, 0, false); ------------------------------------------------ I am using "IRB.getInt8PtrTy()" because this variable will be a pointer to a buffer "char *&q...
2013 Apr 16
1
[LLVMdev] Instruction does not dominate all uses
...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 %bitcast6 = bitcast i32* %9 to i8* Instruction does not dominate all use...
2017 Jun 11
2
Force casting a Value*
...his value to external function IRBuilder<> builder(&I); builder.SetInsertPoint(&B, ++builder.GetInsertPoint()); Constant *func = F.getParent()->getOrInsertFunction("instrument_store", Type::getVoidTy(Ctx), Type::getInt8PtrTy(Ctx), NULL); Value* args[] = {var_value}; builder.CreateCall(func, args); } ================================================== To reiterate, I want to wrap up the run-time value (var_value) as a Value* and call the method (instrument_store) with that value...
2013 Apr 10
0
[LLVMdev] How to call the llvm.prefetch intrinsic ?
Alexandra, I'm not sure what you mean by "replace", but I have code that does this to insert prefetches: Type *I8Ptr = Type::getInt8PtrTy((*I)->getContext(), PtrAddrSpace); Value *PrefPtrValue = ... IRBuilder<> Builder(MemI); Module *M = (*I)->getParent()->getParent(); Type *I32 = Type::getInt32Ty((*I)->getContext()); Value *PrefetchFunc = Intrinsic::getDeclaration(M, Intrinsic::prefet...
2011 Nov 10
1
[LLVMdev] problem with DwarfEHPrepare::InsertUnwindResumeCalls in multiple JIT context?
...ust an unsupported use case of calling the JIT multiple times, or am I missing something? Thanks! Damien if (!RewindFunction) { LLVMContext &Ctx = Resumes[0]->getContext(); FunctionType *FTy = FunctionType::get(Type::getVoidTy(Ctx), Type::getInt8PtrTy(Ctx), false); const char *RewindName = TLI->getLibcallName(RTLIB::UNWIND_RESUME); RewindFunction = F->getParent()->getOrInsertFunction(RewindName, FTy); } ________________________________ This e-mail and its attachments are intended only for the individual or entity to whom it...
2013 Apr 10
2
[LLVMdev] How to call the llvm.prefetch intrinsic ?
Hello, Can anyone please guide me how can I replace a load instruction with a prefetch. I was looking at the intrinsic creation methods of the IRBuilder, but I can only find functions corresponding to memset, memcpy and memmove intrinsics, not for prefetching. Also, I target x86-64 architectures. Is it sufficient to insert a call to the intrinsic in the LLVM IR to have the corresponding prefetch
2010 Sep 07
2
[LLVMdev] Intrinsic prototype has incorrect number of arguments!
I have created the function prototype with the following code: const uintmax_t methodNameSize = 1024; const char methodNameTemplate[] = "llvm.memcpy.p0i%llu.p0i%llu.i%llu"; char methodName[methodNameSize]; // Create the methodName. memset(methodName, 0, methodNameSize); sprintf(methodName, methodNameTemplate, dstSize, srcSize, lengthSize); // Search for the
2011 Apr 05
0
[LLVMdev] inserting a print statement into IR
...builder object all the information it needs to insert IR (e.g., which LLVM Module * it is modifying, which BasicBlock or Instruction it is to use when inserting instructions, etc)? -- John T. > Thanks. > > George > > vector<const Type *> params; > params.push_back(Type::getInt8PtrTy(M.getContext())); > FunctionType *fType = > FunctionType::get(Type::getInt32Ty(M.getContext()), params, true); > Constant *temp = M.getOrInsertFunction("printf",fType); > if(!temp){ > errs() << "printf function not in symbol table\n"; > exit(1); >...
2011 Apr 01
3
[LLVMdev] insert printf into IR
Hi All, I am trying to insert printf ("%d", v), where v is an integer param, into the IR. I am doing something wrong because I keep getting segfaults. Below is my code. Thanks. vector<const Type *> params; params.push_back(Type::getInt8PtrTy(M.getContext())); params.push_back(Type::getInt32Ty(M.getContext())); FunctionType *fType = FunctionType::get(Type::getInt32Ty(M.getContext()), params, true); Constant *temp = M.getOrInsertFunction("printf",fType); if(!temp){ errs() << "printf function not in symbol table\n&q...
2011 Oct 20
0
[LLVMdev] common type at compile time?
On 10/20/11 11:34 AM, ret val wrote: > I'm a bit confused. For the Type did you mean something like: > ArrayType *type = ArrayType::get(Type::getInt8PtrTy(M.getContext()), 4); I assume that creates an ArrayType of 4 elements whose elements are pointers to 8-bit values. If so, then this is what I meant. > This does not work, it gives me ""Wrong type in array element > initializer" at runtime. > > Also it doesn't look...
2017 Jun 12
2
Force casting a Value*
...uilder<> builder(&I); >> builder.SetInsertPoint(&B, >> ++builder.GetInsertPoint()); >> Constant *func = F.getParent()->getOrInsertFunc >> tion("instrument_store", >> >> Type::getVoidTy(Ctx), Type::getInt8PtrTy(Ctx), NULL); >> Value* args[] = {var_value}; >> builder.CreateCall(func, args); >> } >> >> ================================================== >> >> To reiterate, I want to wrap up the run-time value (var_value) as a...
2020 Oct 01
3
Creating a global variable for a struct array
>The type you pass to GlobalVariable's constructor for that variable should be "[10 x %struct.dlist]" because that's what you want storage for. Then the GlobalVariable itself will be a Constant of type "[10 x %struct.dlist]*". Yes, I verified that this is the case. I enabled assertions and the error seems to occur while creating GlobalVariable for both struct dhash