search for: getint32ty

Displaying 20 results from an estimated 208 matches for "getint32ty".

2011 May 18
3
[LLVMdev] access array problem
...ntation code. For example: GlobalVariable: int *counter; //counter the number of load/store operations in run-time int *counterArray; //record the load/store addresses //increase the counter if a load/store is performed std::vector<Constant *>index(2); index[0] = Constant::getNullvalue(Type:getInt32Ty(Context)); index[1] = Constant::get(Type::getInt32Ty(Context), 0); Constant *ElementPtr = ConstantExpr::getGetElementPtr(counter, &index[0], index.size()); Value *oldcounter = new LoadInst(ElementPtr, "oldcounter", InsertPos); Value *newcounter = BinaryOperator::Create(Instruction::Ad...
2017 Apr 08
2
How to insert vector type input parameter for function in C/C++ API?
Thank you so much Craig! I tried it. But still complaining. Here is the error message during compilation. HowToUseJIT_SIMD_FuncProto.cpp:94:55: error: expected unqualified-id VectorType::(Type::getInt32Ty(Context),4), THIS IS MY CODE: LLVMContext Context; std::unique_ptr<Module> Owner = make_unique<Module>("test", Context); Module *M = Owner.get(); Function *Add1F = cast<Function>(M->getOrInsertFunction("add1", VectorType::(Type::getInt32Ty(...
2011 May 18
2
[LLVMdev] access array problem
...r of load/store operations in run-time >> int *counterArray; //record the load/store addresses > strictly speaking these are not arrays, they are pointers. Also, you have > written them in some kind of C-style idiom. What are the declarations in > LLVM IR? const Type *IntTy = Type::getInt32Ty(M.getContext()); const Type *ATyC = ArrayType::get(Type::getInt64Ty(M.getContext()), 1); GlobalVariable *CounterSize = new GlobalVariable(M, ATyC, false, GlobalValue::InternalLinkage, Constant::getNullValue(ATyC), "MemTraceCounterSize"); const Type *ATy = ArrayType::get(Type::getInt32T...
2017 Apr 08
3
How to insert vector type input parameter for function in C/C++ API?
Fantastic! It's working! Thank you so much Craig!!! On Fri, Apr 7, 2017 at 6:05 PM, Craig Topper <craig.topper at gmail.com> wrote: > It should be VectorType::get(Type::getInt32Ty(Context),4). You need the > word "get" after VectorType:: > > ~Craig > > On Fri, Apr 7, 2017 at 6:01 PM, Michael Choi <choimichael103 at gmail.com> > wrote: > >> Thank you so much Craig! >> >> I tried it. But still complaining. Here is the err...
2011 May 18
0
[LLVMdev] access array problem
...ctly speaking these are not arrays, they are pointers. Also, you have written them in some kind of C-style idiom. What are the declarations in LLVM IR? > //increase the counter if a load/store is performed > std::vector<Constant *>index(2); > index[0] = Constant::getNullvalue(Type:getInt32Ty(Context)); > index[1] = Constant::get(Type::getInt32Ty(Context), 0); The above two lines both compute the same thing (an i32 constant equal to zero) in two different ways. > Constant *ElementPtr = ConstantExpr::getGetElementPtr(counter, > &index[0], index.size()); > Value *oldcoun...
2011 May 18
0
[LLVMdev] access array problem
...tions in run-time >>> int *counterArray; //record the load/store addresses >> strictly speaking these are not arrays, they are pointers. Also, you have >> written them in some kind of C-style idiom. What are the declarations in >> LLVM IR? > const Type *IntTy = Type::getInt32Ty(M.getContext()); > const Type *ATyC = ArrayType::get(Type::getInt64Ty(M.getContext()), 1); > > GlobalVariable *CounterSize = new GlobalVariable(M, ATyC, false, > GlobalValue::InternalLinkage, > Constant::getNullValue(ATyC), "MemTraceCounterSize"); so CounterSize is an arra...
2013 Jan 27
2
[LLVMdev] Passing an array to an external function
...lvm::GetElementPtrInst::hasAllZeroIndices() const + 0 std::vector<Value*> Args(1); //Vector with array values SmallVector<Constant*, 2> counts; counts.push_back(ConstantInt::get(Type::getInt32Ty(BB->getContext()),32, false)); counts.push_back(ConstantInt::get(Type::getInt32Ty(BB->getContext()),12, false)); //Array with 2 integers ArrayType* ar_type = llvm::ArrayType::get(llvm::Type::getInt32Ty(BI->getContext()),2); Value* arra...
2012 Nov 02
4
[LLVMdev] Instruction does not dominate all uses! <badref> ??
...ret i32 <badref> And the approximate/simplified code I'm using to generate the call, which would appear at <badref> is: llvm::Value * func = module->getFunction( "add" ); std::vector<llvm::Value*> args; args.push_back( llvm::ConstantInt::get( llvm::Type::getInt32Ty( *context ), 2 ) ); args.push_back( llvm::ConstantInt::get( llvm::Type::getInt32Ty( *context ), 3 ) ); llvm::ArrayRef<llvm::Value*> ar_args( args ); return llvm::CallInst::Create( func, ar_args ); -- edA-qa mort-ora-y -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --...
2011 Mar 07
1
[LLVMdev] DW_TAG_lexical_block structure in debug information
...e, unsigned Line, unsigned Col) { // Defeat MDNode uniqing for lexical blocks by using unique id. static unsigned int unique_id = 0; Value *Elts[] = { GetTagConstant(VMContext, dwarf::DW_TAG_lexical_block), Scope, ConstantInt::get(Type::getInt32Ty(VMContext), Line), ConstantInt::get(Type::getInt32Ty(VMContext), Col), File, ConstantInt::get(Type::getInt32Ty(VMContext), unique_id++) }; return DILexicalBlock(MDNode::get(VMContext, &Elts[0], array_lengthof(Elts))); } Is this an error in the documentation? Thanks in advance,...
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 assuming they ar...
2012 Feb 09
1
[LLVMdev] Difficulty inserting putchar in IR
Hi, I have written a simple code to insert putchar() function into IR. It compiled well but when I tried to run the generated .bc file with lli, its not showing proper output. Function *putchar_func = cast<Function>(M-> getOrInsertFunction("putchar", IntegerType::getInt32Ty(Context), IntegerType::getInt32Ty(Context), NULL)); Value *One = ConstantInt::get(Type::getInt32Ty(Context), 1); CallInst *CallFibX1 = CallInst::Create(putchar_func, One, "fibx1", BB); CallFibX1->setTailCall(); Thanks and Regards, Tarun Agrawal ------...
2018 Aug 07
2
Create an Add Instruction in LLVM IR
...tion that takes two constant operands at the LLVM IR level. I use the IRBuilder class, but nothing happens. Here is part of the runOnFunction() method of my function pass: ... LLVMContext &Context = F.getContext(); IRBuilder<> builder(&Instruction); Value *Lef = ConstantInt::get(Type::getInt32Ty(Context), 4); Value *Rig = ConstantInt::get(Type::getInt32Ty(Context), 5); Value *Result = builder.CreateAdd(Lef, Rig); ... It seems that the problem is with the ConstantInt::get() function. Any idea? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.l...
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* newInst = ne...
2012 Feb 01
1
[LLVMdev] Function Insertion Error
...nclude "llvm/Support/IRBuilder.h" using namespace llvm;   namespace {   struct FunctionInsert : public ModulePass {     static char ID;     FunctionInsert() : ModulePass(ID) {}   };     virtual bool runOnModule(Module &M) {           FunctionType* ty=FunctionType::get(Type::getInt32Ty(M.getContext()),false);        Function *func =  cast<Function>(M.getOrInsertFunction("func", ty,Type::getInt32Ty(M.getContext()),  (Type *)0));        BasicBlock *BB = BasicBlock::Create(M.getContext(), "bb1", func);       IRBuilder<> builder(BB);        Value...
2015 May 30
2
[LLVMdev] Linking modules across contexts crashes
...ot;module1", *ctx1); LLVMContext *ctx2 = new LLVMContext; Module* module2 = new Module("module2", *ctx2); LLVMContext *ctx3 = new LLVMContext; Module* module3 = new Module("module3", *ctx3); // fill modules llvm::Function::Create(llvm::FunctionType::get(Type::getInt32Ty(*ctx1), false), llvm::Function::ExternalLinkage, "f1", module1); llvm::Function::Create(llvm::FunctionType::get(Type::getInt32Ty(*ctx2), false), llvm::Function::ExternalLinkage, "f2", module2); llvm::Function::Create(llvm::FunctionType::get(Type::getInt32Ty(*ctx3), false), ll...
2010 Aug 18
2
[LLVMdev] clang: call extern function using JIT
...> application. > > Here my function > > int Execute(llvm::Module *Mod, char * const *envp) { > llvm::InitializeNativeTarget(); It is not necessary to call InitializeNativeTarget each time. One is enough. [snip] > llvm::FunctionType* ft = llvm::FunctionType::get(llvm::Type::getInt32Ty > > (llvm::getGlobalContext()), > std::vector<const llvm::Type*>(0, llvm::Type::getInt32Ty _______________________________________________^ You are creating a vector of Type's with *zero* elements, so the effect of this is a FuntionType that takes zero arguments. [snip] Next...
2011 May 18
2
[LLVMdev] access array problem
Thank you, Duncan. I rewrote the code, please help check why it still does not work: //declare global variable const Type *IntTy = Type::getInt32Ty(M.getContext()); const Type *ATyC = ArrayType::get(Type::getInt64Ty(M.getContext()), 1); GlobalVariable *CounterSize = new GlobalVariable(M, ATyC, false, GlobalValue::InternalLinkage, Constant::getNullValue(ATyC), "MemTraceCounterSize&...
2013 Nov 26
0
[LLVMdev] Help needed with a pass
...t;llvm/Assembly/PrintModulePass.h"#include "llvm/IR/IRBuilder.h" using namespace llvm; Module* makeLLVMModule() { Module* mod = new Module(getGlobalContext()); Function* strncpy_func = cast<Function>(mod->getOrInsertFunction(new StringRef("strncpy"), Type::getInt32Ty(getGlobalContext()), Type::getInt32Ty(getGlobalContext()), Type::getInt32Ty(getGlobalContext()), NULL)); Function* printf_func = cast<Function>(mod->getOrInsertFunction(new StringRef("printf"), Type::getInt32Ty(getGlobalContext()), NULL)); Constant* c = mod->getO...
2012 Apr 10
2
[LLVMdev] How to get the module handle of a .bc file??
...position. My problem is about the step 1. How can I get the handle of the .bc file (Probably is a Module*)? so I can declare the extern function like // insert the " i32 @fib(i32 )" to the module M Function *FibF = cast<Function>(M->getOrInsertFunction("fib", Type::getInt32Ty(Context), Type::getInt32Ty(Context), (Type *)0)); How can I get the "M" of the .bc file?????? Any help~ -- 祝好! 甄凯 ----------------------------------------------------------------------...
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 Lattner wro...