search for: pmodul

Displaying 10 results from an estimated 10 matches for "pmodul".

Did you mean: modul
2016 Sep 19
3
llvm interpreter does not find function defined by addGlobalMapping
...quot;C" double testFunction(){ return 42.0; } int main() { // initialization needed for JIT llvm::InitializeNativeTarget(); llvm::InitializeNativeTargetAsmPrinter(); llvm::InitializeNativeTargetAsmParser(); llvm::LLVMContext &context(llvm::getGlobalContext()); llvm::Module *pModule = new llvm::Module("a module", context); // Here the EngineKind-flag decides if JIT or interpreter is used. auto pExecutionEngine = llvm::EngineBuilder(std::unique_ptr<llvm::Module>(pModule) ).setEngineKind(llvm::EngineKind::Interpreter).create(); pModule->setDataLayo...
2019 Jan 02
2
JIT compiler, Windows, external functions like cos
...nst char externalFnName[] = "cos"; InitializeNativeTarget(); InitializeNativeTargetAsmPrinter(); InitializeNativeTargetAsmParser(); LLVMContext context; IRBuilder<> builder(context); std::unique_ptr<llvm::Module> module(new Module("TestModule", context)); Module* pModule = module.get(); auto externalFn_IR = cast<Function>(pModule->getOrInsertFunction("externalFn", Type::getDoubleTy(context), Type::getDoubleTy(context))); Value* x = externalFn_IR->arg_begin(); x->setName("x"); BasicBlock *entryBlock = BasicBlock::Create(contex...
2007 Jul 20
5
[LLVMdev] Seg faulting on vector ops
...e::get(Type::FloatTy,dim),"pv",basicBlock); Value* v = new LoadInst(pV,"v",basicBlock); for (unsigned int i = 0 ; i < dim ; ++i) v = new InsertElementInst(v,s,i,"v",basicBlock); return v; } Function* generateVectorAndSelect(Module* pModule) { std::vector<Type const*> params; params.push_back(Type::FloatTy); FunctionType* funcType = FunctionType::get(Type::FloatTy,params,NULL); Function* func = cast<Function>(pModule->getOrInsertFunction("vSelect3",funcType)); BasicBlock* ba...
2010 Jul 16
2
[LLVMdev] Strange behavior when converting arrays to strings
Hello, I found saw some strange behavior (to me) when converting constant arrays to strings. Consider the following example: std::string Text = "HelloWorld"; unsigned TextLengthBefore = Text.length(); ConstantArray *pArray = dyn_cast<ConstantArray>(llvm::ConstantArray::get(pModule->getContext(), Text, true)); unsigned NumElements = pArray->getNumOperands(); Text = pArray->getAsString(); unsigned TextLengthAfter = Text.length(); After running this example here are the values in each variable: TextLengthBefore = 10 NumElements = 11 TextLengthAfter = 11...
2007 Jul 21
0
[LLVMdev] Seg faulting on vector ops
...e* v = new LoadInst(pV,"v",basicBlock); > > > > for (unsigned int i = 0 ; i < dim ; ++i) > > v = new InsertElementInst(v,s,i,"v",basicBlock); > > > > return v; > > } > > > > Function* generateVectorAndSelect(Module* pModule) > > { > > std::vector<Type const*> params; > > > > params.push_back(Type::FloatTy); > > > > FunctionType* funcType = > FunctionType::get(Type::FloatTy,params,NULL); > > Function* func = > cast<Function>(pModule->getOrInser...
2007 Jul 24
2
[LLVMdev] Seg faulting on vector ops
...gt; >> >> for (unsigned int i = 0 ; i < dim ; ++i) >> >> v = new InsertElementInst(v,s,i,"v",basicBlock); >> >> >> >> return v; >> >> } >> >> >> >> Function* generateVectorAndSelect(Module* pModule) >> >> { >> >> std::vector<Type const*> params; >> >> >> >> params.push_back(Type::FloatTy); >> >> >> >> FunctionType* funcType = >> FunctionType::get(Type::FloatTy,params,NULL); >> >> Funct...
2007 Jul 20
0
[LLVMdev] Seg faulting on vector ops
...v = new LoadInst(pV,"v",basicBlock); > > > > for (unsigned int i = 0 ; i < dim ; ++i) > > v = new InsertElementInst(v,s,i,"v",basicBlock); > > > > return v; > > } > > > > Function* generateVectorAndSelect(Module* pModule) > > { > > std::vector<Type const*> params; > > > > params.push_back(Type::FloatTy); > > > > FunctionType* funcType = FunctionType::get > (Type::FloatTy,params,NULL); > > Function* func = cast<Function>(pModule->getOrInse...
2007 Jul 26
0
[LLVMdev] Seg faulting on vector ops
...; i < dim ; ++i) >>> >>> v = new InsertElementInst(v,s,i,"v",basicBlock); >>> >>> >>> >>> return v; >>> >>> } >>> >>> >>> >>> Function* generateVectorAndSelect(Module* pModule) >>> >>> { >>> >>> std::vector<Type const*> params; >>> >>> >>> >>> params.push_back(Type::FloatTy); >>> >>> >>> >>> FunctionType* funcType = >>> FunctionType::get(Ty...
2010 Jul 28
0
[LLVMdev] Strange behavior when converting arrays to strings
...s Hello, I found saw some strange behavior (to me) when converting constant arrays to strings. Consider the following example: std::string Text = "HelloWorld"; unsigned TextLengthBefore = Text.length(); ConstantArray *pArray = dyn_cast<ConstantArray>(llvm::ConstantArray::get(pModule->getContext(), Text, true)); unsigned NumElements = pArray->getNumOperands(); Text = pArray->getAsString(); unsigned TextLengthAfter = Text.length(); After running this example here are the values in each variable: TextLengthBefore = 10 NumElements = 11 TextLengthAfter = 11...
2010 Jul 28
1
[LLVMdev] Strange behavior when converting arrays to strings
...e behavior (to me) when converting constant > arrays to strings. Consider the following example: > > std::string Text = "HelloWorld"; > > unsigned TextLengthBefore = Text.length(); > > ConstantArray *pArray = > dyn_cast<ConstantArray>(llvm::ConstantArray::get(pModule->getContext(), > Text, true)); from Constants.h: /// This method constructs a ConstantArray and initializes it with a text /// string. The default behavior (AddNull==true) causes a null terminator to /// be placed at the end of the array. This effectively increases the length /...