search for: entryblock

Displaying 20 results from an estimated 77 matches for "entryblock".

2012 Nov 02
4
[LLVMdev] Instruction does not dominate all uses! <badref> ??
I'm having trouble figuring out what the error "Instruction does not dominate all uses!" means. I'm trying to construct a call to a function with two parameters. The printed IR, with error, looks like this: define i32 @add(i32, i32) { EntryBlock: %2 = add i32 %0, %1 ret i32 %2 } define i32 @eval_expr() { EntryBlock: ret i32 <badref> } Instruction does not dominate all uses! <badref> = call i32 @add(i32 2, i32 3) ret i32 <badref> And the approximate/simplified code I'm using to generate the call, which wo...
2012 Nov 02
0
[LLVMdev] Instruction does not dominate all uses! <badref> ??
...ort-ora-y wrote: > I'm having trouble figuring out what the error "Instruction does not > dominate all uses!" means. I'm trying to construct a call to a function > with two parameters. The printed IR, with error, looks like this: > > define i32 @add(i32, i32) { > EntryBlock: > %2 = add i32 %0, %1 > ret i32 %2 > } > > define i32 @eval_expr() { > EntryBlock: > ret i32 <badref> > } > > Instruction does not dominate all uses! > <badref> = call i32 @add(i32 2, i32 3) > ret i32 <badref> Looks like you for...
2004 Sep 23
2
[LLVMdev] struct and class under VC7.1
...that too. It's not just linking. You are right... BTW, I've just fixed that problem in my checkout and, among others terrible hacks, here I am: :\home\arathorn\sandbox\llvm>HowToUseJIT.exe We just constructed this LLVM module: implementation ; Functions: int %add1(int %AnArg) { EntryBlock: %addresult = add int 1, %AnArg ; <int> [#uses=1] ret int %addresult } int %foo() { EntryBlock: %add1 = call int %add1( int 10 ) ; <int> [#uses=1] ret int %add1 } Running foo: Result: 11 D:\home\arathorn\sandbox\llvm>...
2006 Apr 15
6
[LLVMdev] how to code a loop in llvm assembly
Hi, I've read over the "LLVM Language Reference Manual" a few times, and writing some ll code, but i'm stuck at a very basic point. How to decrement a counter variable ? int %count(int %n) { EntryBlock: %cond = seteq int %n, 0 br bool %cond, label %Exit, label %Next Next: ; how to decrement n ? %new_n = sub int %n, 1 br label %EntryBlock Exit: ret int 0 } I guess I could malloc a variable and use store/load. Is that the right way ? Also the above code is invalid: Entry block to functi...
2013 May 12
2
[LLVMdev] Problem with llvm-c
Hi, I have the following program (attached) I produces, using the llvm-c API, this: ; ModuleID = './llvm-test.bc' define i32 @test2() { EntryBlock: ret i32 3 } But, I want it to produce this: ; ModuleID = './llvm-test.bc' define i32 @test2() { EntryBlock: %1 = add i32 1, 2 ret i32 %1 } I.e. With the "add" in there. llvm appears to be doing some optimization on it, to remove the add. Is there any way to switch off th...
2012 Nov 02
0
[LLVMdev] Instruction does not dominate all uses! <badref> ??
...ort-ora-y wrote: > I'm having trouble figuring out what the error "Instruction does not > dominate all uses!" means. I'm trying to construct a call to a function > with two parameters. The printed IR, with error, looks like this: > > define i32 @add(i32, i32) { > EntryBlock: > %2 = add i32 %0, %1 > ret i32 %2 > } > > define i32 @eval_expr() { > EntryBlock: > ret i32<badref> > } > > Instruction does not dominate all uses! > <badref> = call i32 @add(i32 2, i32 3) > ret i32<badref> It's correct bu...
2019 Jan 02
2
JIT compiler, Windows, external functions like cos
...odule", 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(context, "EntryBlock", externalFn_IR); builder.SetInsertPoint(entryBlock); std::vector<Type *> args(1, Type::getDoubleTy(context)); FunctionType *FT = FunctionType::get(Type::getDoubleTy(context), args, false); auto externalFn_llvm = Function::Create(FT, Func...
2004 Sep 23
0
[LLVMdev] struct and class under VC7.1
...> BTW, I've just fixed that problem in my checkout and, among others > terrible hacks, here I am: > > :\home\arathorn\sandbox\llvm>HowToUseJIT.exe > We just constructed this LLVM module: > > > implementation ; Functions: > > int %add1(int %AnArg) { > EntryBlock: > %addresult = add int 1, %AnArg ; <int> [#uses=1] > ret int %addresult > } > > int %foo() { > EntryBlock: > %add1 = call int %add1( int 10 ) ; <int> > [#uses=1] > ret int %add1 > } > >...
2011 Jun 18
1
[LLVMdev] loop only executes once
...any input > 2 the function returns 2, the loop only executes once Hopefully someone can see what the problem is from the output and the source. Does the input ArgX require to be cast? Cheers module dump verifying module ; ModuleID = 'test fib' define fastcc i32 @fib2(i32 %ArgX) { EntryBlock: %A = alloca i32 %B = alloca i32 %C = alloca i32 %D = alloca i32 store i32 1, i32* %A store i32 1, i32* %B store i32 0, i32* %C store i32 %ArgX, i32* %D %cond = icmp sle i32 %ArgX, 2 br i1 %cond, label %IF, label %Else IF: ; preds =...
2005 Mar 11
0
[LLVMdev] FP Intrinsics
...2 bit float. For comparision I included the code generated by the X86ISelSimple which is only 8 instructions... it seems the compare is being generated twice in two different ways with the pattern selector?! I also attached the diff of my current version m. internal void %EvaluatePoint3D65() { EntryBlock: store float 0.000000e+000, float* getelementptr ([4 x float]* cast (<4 x float>* %_ARGB56 to [4 x float]*), int 0, int 0) store float 0.000000e+000, float* getelementptr ([4 x float]* cast (<4 x float>* %_ARGB56 to [4 x float]*), int 0, int 1) store float 0.000000e+000, float* get...
2010 Apr 29
2
[LLVMdev] Why the same code is much slower in JIT compared to separate executable?
...ith argument 45 JIT runs for 11.3sec and executable runs for 7.5sec. Why there is such difference? Yuri -------- fib.ll -------- ; ModuleID = 'all.bc' @.str = private constant [12 x i8] c"fib(%i)=%i\0A\00", align 1 ; <[12 x i8]*> [#uses=1] define i32 @fib(i32 %AnArg) { EntryBlock: %cond = icmp sle i32 %AnArg, 2 ; <i1> [#uses=1] br i1 %cond, label %return, label %recurse return: ; preds = %EntryBlock ret i32 1 recurse: ; preds = %EntryBlock %arg = sub i32 %AnArg, 1...
2015 Oct 27
3
Add a mapping to a C++ lambda
...reate(lambdaFT, Function::ExternalLinkage, "lambda", Owner.get()); auto lambdaBody = []() { return 100; }; Function *mainF = cast<Function>(M->getOrInsertFunction("main", Type::getInt32Ty(Context), (Type *) 0)); BasicBlock *BB = BasicBlock::Create(Context, "EntryBlock", mainF); IRBuilder<> builder(BB); CallInst *lambdaRes = builder.CreateCall(lambdaFN, std::vector<Value *>(), "lambdaRetVar"); builder.CreateRet(lambdaRes); ExecutionEngine *EE = EngineBuilder(std::move(Owner)).create(); EE->addGlobalMapping(lambdaFN, &...
2011 Aug 31
2
[LLVMdev] How to place call(s) to functions found in other llvm modules ???
...function declaration to the caller module. Function::Create(FT, Function::ExternalLinkage, "gcd", mod); Where "FT" is the same as before. And the output produced by the PrintModulePass becomes: ; ModuleID = 'GCDMain' declare i32 @gcd(i32, i32) define i32 @main() { EntryBlock: %tmp = call i32 @gcd(i32 30, i32 50) ret i32 %tmp } But it still fails to WriteBitcodeToFile, and produces the same error as before. I guess I might be missing some attribute, like "extern" in C ... Any Comments? Thanks again for your help, Hamayun On 08/31/2011 07:18 PM, Eli...
2004 Nov 05
0
[LLVMdev] Re: LLVM Visual Studio Project files
...it was there to be checked in, as it's a hidden file. This file had hard-coded paths to Morten's setup, and even had his breakpoints in it. So... once these problems are fixed, I run fibonacci and get the following output: --------- implementation ; Functions: int %fib(int %AnArg) { EntryBlock: %cond = setle int %AnArg, 2 ; <bool> [#uses=1] br bool %cond, label %return, label %recurse return: ; preds = %EntryBlock ret int 1 recurse: ; preds = %EntryBlock %arg = sub int %AnArg, 1 ; <int> [#uses...
2005 Mar 11
5
[LLVMdev] FP Intrinsics
Hello, I am trying to make the FP intrinsics (abs, sin, cos, sqrt) I've added work with the X86ISelPattern, but I'm having some difficulties understanding what needs to be done. I assume I have to add new nodetypes for the FP instructions to SelectionDAGNodes.h, and make nodes for these in SelectionDAGLowering::visitCall when I find the intrinsic... The part I don't quite
2006 Apr 15
2
[LLVMdev] Re: how to code a loop in llvm assembly
...n Burton <simon at arrowtheory.com> writes: > Hi, > > I've read over the "LLVM Language Reference Manual" > a few times, and writing some ll code, but i'm stuck at > a very basic point. How to decrement a counter variable ? > > int %count(int %n) { > EntryBlock: > %cond = seteq int %n, 0 > br bool %cond, label %Exit, label %Next > Next: > ; how to decrement n ? > %new_n = sub int %n, 1 > br label %EntryBlock > Exit: > ret int 0 > } > > I guess I could malloc a variable and use store/load. Is that the right way ?...
2004 Aug 09
1
[LLVMdev] API on JIT, code snippets
...*Add1F = new Function(Add1T, > Function::ExternalLinkage, // maybe too much > "add1", M); > > // Add a basic block to the function... (again, it automatically inserts > // because of the last argument.) > BasicBlock *BB = new BasicBlock("EntryBlock of add1 function", Add1F); > > // Get pointers to the constant `1'... > Value *One = ConstantSInt::get(Type::IntTy, 1); > > // Get pointers to the integer argument of the add1 function... > Value *ArgX = 0; // FIXME!! > > > // Create t...
2004 Aug 09
5
[LLVMdev] API on JIT, code snippets
...*Add1F = new Function(Add1T, > Function::ExternalLinkage, // maybe too much > "add1", M); > > // Add a basic block to the function... (again, it automatically inserts > // because of the last argument.) > BasicBlock *BB = new BasicBlock("EntryBlock of add1 function", Add1F); > > // Get pointers to the constant `1'... > Value *One = ConstantSInt::get(Type::IntTy, 1); > > // Get pointers to the integer argument of the add1 function... > Value *ArgX = 0; // FIXME!! > > > // Create t...
2008 Aug 19
7
[LLVMdev] Please help with LLVM C++ integration
...ate( func_type, Function::ExternalLinkage, "some_test_func", M ); EE->addGlobalMapping( my_function, (void*)&some_test_func ); Function *FooF = cast<Function>(M->getOrInsertFunction("foo", Type::Int32Ty, (Type *)0)); BasicBlock * BB = BasicBlock::Create("EntryBlock", FooF); Value *Ten = ConstantInt::get(Type::Int32Ty, 10); CallInst *Add1CallRes = CallInst::Create(my_function, Ten, "some_test_func", BB); Add1CallRes->setTailCall(true); ReturnInst::Create(Add1CallRes, BB); std::cout << "We just constructed this LLVM module:\n...
2009 Aug 31
0
[LLVMdev] problems with the 2.6 branch under x86_64
...6_64-apple-darwin"...Reading symbols for shared libraries .... done (gdb) r Starting program: /Users/lrz/src/llvm-26/Release/examples/HowToUseJIT Reading symbols for shared libraries +++. done We just constructed this LLVM module: ; ModuleID = 'test' define i32 @add1(i32 %AnArg) { EntryBlock: %addresult = add i32 1, %AnArg ; <i32> [#uses=1] ret i32 %addresult } define i32 @foo() { EntryBlock: %add1 = tail call i32 @add1(i32 10) ; <i32> [#uses=1] ret i32 %add1 } Running foo: Program received signal EXC_BAD_ACCESS, Could not access...