search for: getint8ty

Displaying 20 results from an estimated 50 matches for "getint8ty".

2010 May 05
2
[LLVMdev] How to cast an integer array to an integer pointer? (user question)
...32 0 How to convert the pointer to the array to u8* ? I tried BitCastInst but it inserts an explicit bitcast. I don't think this is right. Yuri // assume BasicBlock *BB, Module *M // global string std::vector<llvm::Constant*> Ivars; Ivars.push_back(llvm::ConstantInt::get(Type::getInt8Ty(Context), 0x41)); Ivars.push_back(llvm::ConstantInt::get(Type::getInt8Ty(Context), 0x42)); Ivars.push_back(llvm::ConstantInt::get(Type::getInt8Ty(Context), 0x43)); Ivars.push_back(llvm::ConstantInt::get(Type::getInt8Ty(Context), 0)); GlobalVariable *GGV = new GlobalVariable( *M, Arr...
2010 Jun 01
2
[LLVMdev] How to create global string array? (user question)
...ude "llvm/Instructions.h" #include "llvm/Analysis/Verifier.h" #include <stdio.h> #include <vector> using namespace llvm; using namespace std; Constant* mk_string(Module *M, LLVMContext &Context, const string &svalue) { ArrayType *Ty = ArrayType::get(Type::getInt8Ty(Context),svalue.size()+1); GlobalVariable *GV = new llvm::GlobalVariable( *M, Ty, true, GlobalValue::InternalLinkage, ConstantArray::get(Context,svalue), "str", 0, false, 0); vector<Constant*> idxs; idxs.push_back(ConstantInt::g...
2010 Nov 29
3
[LLVMdev] FunctionType as a function argument
...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/release_28/lib/VMCore/Type.cpp:456: llvm::FunctionType::FunctionType(llv...
2010 May 11
2
[LLVMdev] How to create Global Variables using LLVM API?
...e::get(getGlobalContext(), 32), NULL); Function* main = cast<Function> (c); main->setCallingConv(CallingConv::C); Twine s("foo"); StringRef s1("foo"); Constant *cons = ConstantArray::get(getGlobalContext(),s1, true); GlobalVariable val(*mod, (Type*) ArrayType::get(Type::getInt8Ty(getGlobalContext()), 4), true,GlobalValue::ExternalLinkage, cons, s); Application stops running after reaching the last line. can somebody help me out here? -- View this message in context: http://old.nabble.com/How-to-create-Global-Variables-using-LLVM-API--tp28519938p28519938.html Sent from...
2016 Apr 17
2
Problems with GEP and CallInst
...container->getContext(), val.c_str()), ".str"); strcst->setUnnamedAddr(true); strcst->setAlignment(chrtype->getByteSize()); } return builder->CreateInBoundsGEP(arty, strcst, llvm::ConstantInt::get(llvm::Type::getInt8Ty(container->getContext()), 0)); } -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160417/f5a4df11/attachment.html>
2015 Aug 05
2
[BUG] Incorrect ASCII escape characters on Mac
On Wed, 2015-08-05 at 10:02 -0400, Ramkumar Ramachandra wrote: > > - at 5 = internal global [10 x i8] c"\22\D0\12\F4!\00\15\F9\EC\E1" > - at 6 = internal global [10 x i8] c"\D0\19\FB+\FD\F8#\03\E2\11" > + at 5 = internal global [10 x i8] c"\22Ð\12ô!\00\15ùìá" > + at 6 = internal global [10 x i8] c"Ð\19û+ýø#\03â\11" > > The diff
2012 Dec 19
2
[LLVMdev] GetElementPtrConstantExpr
Ok, now it's arising another problem. IR code that I obtain is the following: i8* bitcast ([5 x i8] c"hello\00" to i8*) generated from instructions: ConstantExpr::getBitCast (ConstantDataArray::getString (getGlobalContext (), "hello"), PointerType::get (Type::getInt8Ty (getGlobalContext ()), 0)) but the LLC tool says: invalid cast opcode for cast from '[5 x i8]' to 'i8*'. Any help? 2012/12/18 Óscar Fuentes <ofv at wanadoo.es> > Alessio Giovanni Baroni <alessiogiovanni.baroni at gmail.com> writes: > > > Because I need t...
2009 Sep 22
5
[LLVMdev] Verifier should not make any assumptions about calls to "malloc"
...r, this code from the verifier broke the Ada front-end build: const Module* M = CI.getParent()->getParent()->getParent(); Constant *MallocFunc = M->getFunction("malloc"); if (CI.getOperand(0) == MallocFunc) { const PointerType *PTy = PointerType::getUnqual(Type::getInt8Ty(CI.getParent()->getContext())); Assert1(CI.getType() == PTy, "Malloc call must return i8*", &CI); } I think it is completely wrong for the verifier to be checking anything about calls to functions that happen to be called "malloc". What if I have my own runtime...
2013 May 21
1
[LLVMdev] Is it valid to add parameters to a function once it is created
...lvm::getGlobalContext(), "entrypoint", mainFunc); builder->SetInsertPoint(entry); llvm_counters::param_counter = 0; llvm_counters::label_counter = 0; } and then add parameters as needed with something like llvm::Argument * u8 = new llvm::Argument( llvm::Type::getInt8Ty(llvm::getGlobalContext()) , param_next() , mainFunc ); Is this valid?
2010 May 11
0
[LLVMdev] How to create Global Variables using LLVM API?
...); > Function* main = cast<Function> (c); > main->setCallingConv(CallingConv::C); > Twine s("foo"); > StringRef s1("foo"); > Constant *cons = ConstantArray::get(getGlobalContext(),s1, true); > GlobalVariable val(*mod, (Type*) > ArrayType::get(Type::getInt8Ty(getGlobalContext()), 4), > true,GlobalValue::ExternalLinkage, cons, s); Firstly, don't cast to Type*. You need to #include "llvm/DerivedTypes.h" instead. But that's not your bug. Don't allocate GlobalVariable val on the stack. You need to 'new' it, ala. 'Glo...
2018 Mar 17
1
Migration from 3.8 to 6.0 questions (segfault most concerning)
I'm encountering a few problems in my migration that I haven't yet figured out. `getOrInsertFunction` is generating a SEGFAULT at FunctionType::isValidArgumentType(llvm::Type*).  I'm calling it as:     generic_ptr_ = llvm::PointerType::get( llvm::Type::getInt8Ty(context), 0 );     f_natural_int = llvm::IntegerType::get(context, 64);     module->getOrInsertFunction(         "count_malloc", generic_ptr, f_natural_int, (llvm::Type*)0 ); It appears there is no more Reloc::Default or CodeModel::Default, but the docs on those fields indicate there...
2010 Nov 29
0
[LLVMdev] FunctionType as a function argument
...t 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/release_28/lib/VMCore/Type.cpp:456: > ll...
2012 Jul 04
2
[LLVMdev] Bogus assert in VMCore/Instructions.cpp CallInst::Create?
...ied to insert calls to the llvm.annotation intrinsic function, which has a signature of (i32, i8*, i8*, i32). The code is below. void addAnnotation( BasicBlock *block, Function *F) { string foo = "foo"; string bar = "barr"; Type *charTy = Type::getInt8Ty(block->getContext()); ArrayType *s1Ty = ArrayType::get(charTy, foo.size()+1); ArrayType *s2Ty = ArrayType::get(charTy, bar.size()+1); Constant *ar1 = ConstantArray::get(block->getContext(), foo); Constant *ar2 = ConstantArray::get(block->getContext(), bar);...
2015 Mar 10
4
[LLVMdev] noob IR builder question
...sicBlock *entry = llvm::BasicBlock::Create(context, "entrypoint", mainFunc); 15 builder.SetInsertPoint(entry); 16 17 llvm::Value *helloWorld = builder.CreateGlobalStringPtr("hello world!\n"); 18 19 std::vector<llvm::Type *> putsArgs; 20 putsArgs.push_back(builder.getInt8Ty()->getPointerTo()); 21 llvm::ArrayRef<llvm::Type*> argsRef(putsArgs); 22 23 llvm::FunctionType *putsType = 24 llvm::FunctionType::get(builder.getInt32Ty(), argsRef, false); 25 llvm::Constant *putsFunc = module->getOrInsertFunction("puts", putsType); 26 27 Value...
2013 Mar 06
1
[LLVMdev] LLVM load instruction query
...tual bool runOnModule(Module &M) { Constant *cpProfFunc; Context = &M.getContext(); cpProfFunc = M.getOrInsertFunction("_Z6cpProfi",Type::getVoidTy(*Context), PointerType::getUnqual(Type::getInt8Ty(*Context)), ,NULL); cpProf= cast<Function>(cpProfFunc); for(Module::iterator F = M.begin(), E = M.end(); F!= E; ++F) { for(Function::iterator BB = F->begin(), E = F-&gt...
2010 Jan 18
5
[LLVMdev] [patch] Union Types - work in progress
...e of the elements of the union. @@ -928,7 +949,7 @@ /// if the elements of the array are all ConstantInt's. bool ConstantArray::isString() const { // Check the element type for i8... - if (!getType()->getElementType()->isInteger(8)) + if (getType()->getElementType() != Type::getInt8Ty(getContext())) return false; // Check the elements to make sure they are all integers, not constant // expressions. You have a couple of these things which revert a recent patch, please don't :) Funky indentation in ConstantUnion::replaceUsesOfWithOnConstant and implement...
2012 Sep 05
1
[LLVMdev] Calling a function with a pointer to a global char array as argument
...String() fucntion. Now I am trying to declare a global char array with the content "hi" and call a function "print" (which takes a char pointer and return an insteger. I am doing the following in the code - Function Creation: PointerType* array = PointerType::get(IntegerType::getInt8Ty(getGlobalContext()) /*CI->getPointerOperand()->getType()*/, 0); printFunc = M.getOrInsertFunction("print", IntegerType::getInt32Ty(getGlobalContext()), array, NULL); Global Declaration: Constant *fname = ConstantDataArray::getString(getGlobalContext(),"hi", true);...
2014 Jan 08
3
[LLVMdev] reference to non-static member function must be called
...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::getVoidTy(M->getContext()); DataLayo...
2012 Dec 19
0
[LLVMdev] GetElementPtrConstantExpr
...can be done. Ciao, Duncan. PS: Unlike in C, in LLVM IR an array is not the same thing as a pointer to the first element. > > generated from instructions: > > ConstantExpr::getBitCast (ConstantDataArray::getString (getGlobalContext (), > "hello"), PointerType::get (Type::getInt8Ty (getGlobalContext ()), 0)) > > but the LLC tool says: invalid cast opcode for cast from '[5 x i8]' to 'i8*'. > > Any help? > > > 2012/12/18 Óscar Fuentes <ofv at wanadoo.es <mailto:ofv at wanadoo.es>> > > Alessio Giovanni Baroni <alessio...
2010 Dec 26
0
[LLVMdev] Generating target dependent function calls
...could declare in a function that would then inquire pointer size from TargetData like: FunctionType *geti8LongLong() { const PointerType *LongTy = Type::getIntNPtrTy(Context, TD.getPointerSizeInBits()); std::vector<const Type*> Params = { LongTy, LongTy }; const Type *ResultTy = Type::getInt8Ty(Context); return FunctionType::get(ResultTy, ArgTys, 0); } and then just use the return from geti8LongLong() as the function type when you declare the function. Or you can abstract out away the LongTy and use it in general. -eric