search for: constint

Displaying 19 results from an estimated 19 matches for "constint".

Did you mean: constant
2012 Apr 17
0
[LLVMdev] arithmetic with SCEVs, SCEVConsts, ConstInts, and APInts
Hi, Pondering the code for StrongSIV and trying to write my own, I find I have many questions. In this code, for example, * if (isa<SCEVConstant>(delta) && isa<SCEVConstant>(srcCoeff)) { const SCEVConstant *constDelta = cast<SCEVConstant>(delta); const SCEVConstant *constCoeff = cast<SCEVConstant>(srcCoeff); APInt distance, remainder;
2017 Oct 20
2
How to create a 64 bit ConstInt having a value of -1?
I tried the following: - ConstantInt::get(Type::getInt64Ty(Ctx), APInt(0xFFFFFFFFFFFFFFFF, 64, false)) - ConstantInt::get(Type::getInt64Ty(Ctx), APInt(-1, 64)) I am receiving the following error: Assertion `NumBits <= MAX_INT_BITS && "bitwidth too large" failed -- Thanks & Regards, Dipanjan -------------- next part -------------- An HTML attachment was scrubbed...
2009 Jun 24
0
[LLVMdev] Handling SMax(N, N - constInt) in Scalar Evolution pass
Mai, Haohui wrote: > Hi all, > > I'm working on a project which tries to prove an access to an array is > safe. For example, > > int foo(int s) { > int * p = malloc(s * sizeof int); > ... > int q = p[s - 2]; > } > > then the access of p[s - 2] always stays in bound. > > I implemented a prototype using the Scalar Evolution pass. Here are the
2009 Mar 08
2
[LLVMdev] Creating Pointer Constants
Hello, I am writing a JIT compiler for a subset of the Matlab language and as a part of my implementation, I would like to be able to pass a constant pointer to a native function I'm calling. Right now, this is what I do: llvm::Constant* constInt = llvm::ConstantInt::get(llvm::Type::Int64Ty, (int64)thePointer); llvm::Value* constPtr = llvm::ConstantExpr::getIntToPtr(constInt, llvm::PointerType::getUnqual(llvm::Type::Int32Ty)); builder.CreateCall(my_function, constPtr); The resulting IR call looks like this: call void @nativeFunc(i32* in...
2009 Jun 24
1
[LLVMdev] Handling SMax(N, N - constInt) in Scalar Evolution pass
Hi all, I'm working on a project which tries to prove an access to an array is safe. For example, int foo(int s) { int * p = malloc(s * sizeof int); ... int q = p[s - 2]; } then the access of p[s - 2] always stays in bound. I implemented a prototype using the Scalar Evolution pass. Here are the pseudo-code of the implementation: const SCEV * offset =
2009 Jun 24
0
[LLVMdev] Handling SMax(N, N - constInt) in Scalar Evolution pass
Nick, It might be a little bit difficult to handle SMax correctly. But is it possible to reduce A+(-A) to 0 in SAddExpr? Haohui On Wed, 2009-06-24 at 01:05 -0500, Mai, Haohui wrote: > On Tue, 2009-06-23 at 22:55 -0700, Nick Lewycky wrote: > > Mai, Haohui wrote: > > > Hi all, > > > > > > I'm working on a project which tries to prove an access to an array
2009 Jun 24
1
[LLVMdev] Handling SMax(N, N - constInt) in Scalar Evolution pass
Mai, Haohui wrote: > Nick, > > It might be a little bit difficult to handle SMax correctly. But is it > possible to reduce A+(-A) to 0 in SAddExpr? Yes, it should already do that. Here's a quick test I wrote up: $ cat x.ll define i8 @test(i8 %x) { %neg = sub i8 0, %x %sum = add i8 %x, %neg ret i8 %sum } $ llvm-as < x.ll | opt -analyze
2009 Jun 24
2
[LLVMdev] Handling SMax(N, N - constInt) in Scalar Evolution pass
On Tue, 2009-06-23 at 22:55 -0700, Nick Lewycky wrote: > Mai, Haohui wrote: > > Hi all, > > > > I'm working on a project which tries to prove an access to an array is > > safe. For example, > > > > int foo(int s) { > > int * p = malloc(s * sizeof int); > > ... > > int q = p[s - 2]; > > } > > > > then the access
2017 Jun 11
2
Force casting a Value*
On 11 June 2017 at 07:53, David Blaikie <dblaikie at gmail.com> wrote: > Sounds like you're looking for reinterpret_cast: http://en. > cppreference.com/w/cpp/language/reinterpret_cast > I tried cast<ConstInt>(vo), but that failed at run-time. > > On Sun, Jun 11, 2017 at 3:06 AM Dipanjan Das via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> >> I am trying to cast a Value* irrespective of its underlying subclass to >> uint64 and pass it on to a method as a...
2015 May 18
2
[LLVMdev] copy value of a global's data field to another global
...nested structs, from which I want to extract e.g. one double datafield. Example: >From a struct Stuct having double,array(3xint),float fields, I could extract the second int value using the index sequence 0,1,1 with getGetElementPtr. This gives me a constantPointer, but I would need to get a constInt... Alex David Blaikie wrote: > On Sat, May 16, 2015 at 10:28 PM, Alexander Poddey > <alexander.poddey at gmx.net >> wrote: > >> Hi all, >> >> I can get access to the data stored in globals as follows: >> >> GlobalVariable* pGvarAct=_set_a_valid_g...
2009 Mar 11
0
[LLVMdev] Creating Pointer Constants
...at 12:46, Nyx wrote: > I am writing a JIT compiler for a subset of the Matlab language and > as a > part of my implementation, I would like to be able to pass a constant > pointer to a native function I'm calling. > > Right now, this is what I do: > > llvm::Constant* constInt = llvm::ConstantInt::get(llvm::Type::Int64Ty, > (int64)thePointer); > llvm::Value* constPtr = llvm::ConstantExpr::getIntToPtr(constInt, > llvm::PointerType::getUnqual(llvm::Type::Int32Ty)); > > builder.CreateCall(my_function, constPtr); > > The resulting IR call looks like th...
2011 Oct 14
2
[PATCH] Fix logic error in rhino driver
...drivers/rhino.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/rhino.c b/drivers/rhino.c index ca66169..e478bcb 100644 --- a/drivers/rhino.c +++ b/drivers/rhino.c @@ -187,7 +187,7 @@ AutonomyCalc( int ia ) /* all models */ { currin = ( UtilPowerOut + ConstInt ) *1.0 / Vin; auton = ( ( ( AmpH *1.0 / currin ) * 60 * ( ( BattVoltage - VbatMin ) * 1.0 /( VbatNom - VbatMin ) ) * FM ) + FA ); - if( ( BattVoltage > 129 ) || ( BattVoltage < 144 ) ) + if( ( BattVoltage > 129 ) && ( BattVoltage < 144 ) ) result = 133;...
2010 Jan 06
0
[LLVMdev] [Help] How can we call an object's virtual function inside IR?
Hi Gyounghwa Kim, > First of all, thank you very much for your answer. > I tried your sugestion and found out that it is not what I wanted. > What I have to do is call a native C function from inside this > generated function. > Is there any way that we can find and call native C functions not > created by LLVM IR? You can insert a declaration of the function into the IR, then
2010 Jan 05
5
[LLVMdev] [Help] How can we call an object's virtual function inside IR?
Dear experts, I am learning llvm by reading documents and have a question to ask. The following is the example of code generation that I created. [[a [10.00]] > [3.00]] ; ModuleID = 'ExprF' define i1 @expr(double* %record) { entry: %0 = getelementptr double* %record, i32 0 ; <double*> [#uses=1] %1 = load double* %0 ; <double>
2017 Jun 11
2
Force casting a Value*
I am trying to cast a Value* irrespective of its underlying subclass to uint64 and pass it on to a method as an argument. if (StoreInst *store_inst = dyn_cast<StoreInst>(&I)) { Value* vo = store_inst->getValueOperand(); uint64 value = /* cast vo to unsigned int 64 bit */ func(value); } How can I force
2015 May 17
2
[LLVMdev] copy value of a global's data field to another global
Hi all, I can get access to the data stored in globals as follows: GlobalVariable* pGvarAct=_set_a_valid_global_; const_ptr_indicesVec=_the_indexes_ llvm::Constant* pConst; pConst=ConstantExpr::getGetElementPtr(pGvarAct, const_ptr_indicesVec); and e.g. use this to repalece an argumrnt of an instruction like: I->setOperand(someArgumentIndex,pConst); However, getGetElementPtr returns a
2011 Oct 13
0
1) A memory leak in drivers/rhino.c 2) Wunused-but-set-variable.patch
...ed. Index: b/drivers/rhino.c =================================================================== --- a/drivers/rhino.c 2011-10-12 03:16:00.000000000 +0300 +++ b/drivers/rhino.c 2011-10-12 12:24:46.000000000 +0300 @@ -85,12 +85,6 @@ static double const FA = -2; /* static double const ConstInt = 250; /* Consumo interno sem o carregador */ static double const Vin = 220; /* Tens?o de entrada */ -static int Day, Month, Year; -static int dian=0, mesn=0, anon=0, weekn=0; -static int ihour,imin, isec; -/* unsigned char DaysOnWeek; */ -/* char seman[4]; */ - /* int FExpansaoBateria;...
2019 Feb 05
2
IRBuilder constraints
Hi, I need to control IRBuilder(or manage IR building with other means) very strictly. The problem is in the realm of ConstInt/GlobalVariable handling, more precisely: LLVM converts llvm::ConstantInt values to GlobalVariable addresses ad-hoc if I store a constant in a GlobalVariable, and it appears to me, that I can do nothing about it. Consider the following, shortened code: ... 0x18: r2 = memread(0x4000) 0x1C: r3 = memr...
2017 Jun 11
2
Force casting a Value*
...>> >> >> On 11 June 2017 at 07:53, David Blaikie <dblaikie at gmail.com> wrote: >> >>> Sounds like you're looking for reinterpret_cast: http://en.cp >>> preference.com/w/cpp/language/reinterpret_cast >>> >> >> I tried cast<ConstInt>(vo), but that failed at run-time. >> > > That is not the same as reinterpret_cast<int64>(some_value_star). > None of the following work. Value* var_value = reinterpret_cast<intptr_t>(vo); Value* var_value= reinterpret_cast<uint64_t>(vo); The following worked,...