search for: constantints

Displaying 20 results from an estimated 569 matches for "constantints".

Did you mean: constantint
2004 Jun 17
2
[LLVMdev] ConstantInt::getRawValue
Is there are reason why ConstantInt::getRawValue method can't be moved one step into class hierarchy, into ConstantIntegral::getRawValue The reason I'd like this is that to handle both ConstantInt and ConstantBool, I need the following: if (ConstantInt* CI = dyn_cast<ConstantInt>(V)) { BuildMI(*MBB, IPt, NM::MOVE, 1, Reg).addImm(CI->getRawValue()); } if
2020 Jan 14
2
sizeof implementation: how to get size as a constantInt?
I'm implementing c style "sizeof()", and I did as http://nondot.org/sabre/LLVMNotes/SizeOf-OffsetOf-VariableSizedStructs.txt illuarstrated, and it works find, here's an example of my implementation: auto *p = builder.CreateGEP(structTy, llvm::ConstantPointerNull::get(pointerTy), constint1); auto *size =
2010 Nov 02
2
[LLVMdev] ConstantInt to Value*?
How to convert ConstantInt* to value*? -- regards, soumya prasad ukil -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101102/af73eabb/attachment.html>
2013 Jan 15
2
[LLVMdev] [cfe-dev] no-alias generated as result of restrict function arguments
On Wed, Dec 12, 2012 at 01:59:55PM -0800, Dan Gohman wrote: > The bug here isn't in clang's use of noalias or in BasicAliasAnalysis' > implementation of noalias; it's in the code that's optimizing the > icmp. Let's come back to this. The attached patch decouples InstSimplify from the alias analysis and provides the conservative logic for when pointers are not
2011 Jul 13
2
[LLVMdev] overflow check
Hi, I have three constants (B, C and V) and V = B + C. I want to find out if B + C wraps around. The way I'll do it is, assuming B and C are both positive, to check if V < B or C. For this I need the values of B, C and V. I tried using APInt as below. *** If (isa<Constant> (B) && isa<Constant> (C) && isa<Constant>(V)) { ConstantInt *CV =
2019 Jul 03
3
optimisation issue in an llvm IR pass
Hi Craig, On 03.07.19 17:33, Craig Topper wrote: > Don't the CreateICmp calls return a Value* with an i1 type? But then > they are added to an i8 type? Not sure that works.  I had that initially: auto cf = IRB.CreateICmpULT(Incr, ConstantInt::get(Int8Ty, 1)); auto carry = IRB.CreateZExt(cf, Int8Ty); Incr = IRB.CreateAdd(Incr, carry); it makes no difference to the generated assembly
2019 Jul 03
2
optimisation issue in an llvm IR pass
Hello, I have an optimisation issue in an llvm IR pass - the issue being that unnecessary instructions are generated in the final assembly (with -O3). I want to create the following assembly snippet: mov dl,BYTE PTR [rsi+rdi*1] add dl,0x1 adc dl,0x0 mov BYTE PTR [rsi+rdi*1],dl however what is created is (variant #1): mov dl,BYTE PTR [rsi+rdx*1] add dl,0x1 cmp
2009 Aug 24
1
[LLVMdev] question about LLVMContext
Hi devs: I'm trying to do something quite simple, but it seems I need to provide an LLVMContext& to do it. I'm not sure what the 'proper' LLVMContext would be in my situation. I'm writing an analysis that is a FunctionPass. At some point in the pass, I am given a Value * representing an N-bit integer. My goal is to contruct two ConstantInt instances, for comparison
2004 Jun 17
0
[LLVMdev] ConstantInt::getRawValue
On Thu, 17 Jun 2004, Vladimir Prus wrote: > Is there are reason why ConstantInt::getRawValue method can't be moved one > step into class hierarchy, into ConstantIntegral::getRawValue > > The reason I'd like this is that to handle both ConstantInt and ConstantBool, > I need the following: > > if (ConstantInt* CI = dyn_cast<ConstantInt>(V)) { >
2008 Jul 07
0
[LLVMdev] (GEP) Index validity
Hi all, I just found that TargetData also contains a similar assert, and that I forgot a "return" in my previous patch. Here's an updated patch, which allows to use any integer to index a CompositeType. It seems this enables GEP to work with any integer value as well, I tested indexing a struct with a i16 an i64 (also through llc). This should still be adressed somewhere, unless we
2012 Jul 04
2
[LLVMdev] Bogus assert in VMCore/Instructions.cpp CallInst::Create?
Evening, I was writing some code that tried 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 =
2008 Jul 07
2
[LLVMdev] (GEP) Index validity
Hi all, I'm fiddling around a bit with programmatically created GEP instructions, which is failing when using i64 for any indix, except the first. The reason behind this, is that StructureType::indexValid only accepts Value* that are constant ints of width 32. I can't really see why this limitation is here. SequentialType solves this slightly differently, it allows for both 32 and 64
2010 Apr 22
2
[LLVMdev] Operand, instruction
Thanks for the quick reply. I am able to get the numerical value. But i also need the numerical value to be in value type, so that it can be used as operand of other instruction. For that i am trying to create a new ConstantInt, but i am unable to find create() function for ConstantInt. Thanks again for the quick and helpful reply. Ben Perry-3 wrote: > > if (ConstantInt *c = (ConstantInt
2015 Mar 07
2
[LLVMdev] cannot understand global c++API code
Hi all, translating the following c code to llvm c++Api code, I can not understand the result. Perhaps someone could explain it to me. c code --------------------------------- struct stest { int age; float weight; } foo={44,67.2}; int main() { foo.weight=68.2; ... ---------------------------------------- API code // this is clear ConstantFP* const_float_102 =
2013 Jan 16
0
[LLVMdev] [cfe-dev] no-alias generated as result of restrict function arguments
On Wed, Jan 16, 2013 at 12:53:55AM +0100, Joerg Sonnenberger wrote: > Let's come back to this. The attached patch decouples InstSimplify from > the alias analysis and provides the conservative logic for when pointers > are not equal. Let's take the version with the cleanup from IRC. *sigh* Dealing with too many copies. Joerg -------------- next part -------------- Index:
2008 Jul 10
2
[LLVMdev] (GEP) Index validity
Hi all, any comments about this patch? I'd like to get it out of my working copy :-) Gr. Matthijs > Index: lib/VMCore/Type.cpp > =================================================================== > --- lib/VMCore/Type.cpp (revision 53136) > +++ lib/VMCore/Type.cpp (working copy) > @@ -394,9 +394,8 @@ > > bool StructType::indexValid(const Value *V) const { >
2013 Sep 06
2
[LLVMdev] How to get the exact integer from a Value
Hi,all I have a Value* type named indexValue, and the type is i32. I think "indexValue" must hold a number which type is int. Now I want to use the exact number which pointed by indexValue , so I do like this: ConstantInt* CI = llvm::cast<llvm::ConstantInt>(indexValue); //This is wrong, so is dyn_cast. uint64_t index = indexValue->getZExtValue(); uint64_t size = index + 1; I
2013 May 13
3
[LLVMdev] Q: When is a boolean not a boolean?
A: When the types are created in different contexts. I've been running into a module validation error related to phi nodes produced by the GVN pass, where the types of the incoming values aren't the same instance of IntegerType i1. I'm not certain I've found the root cause of the problem yet, it's probably due to my handling of LLVMContext & Module life cycles, and this
2012 Feb 09
2
[LLVMdev] Your commit 149912 "Remove some dead code and tidy things up"...
Hi Chris, this was a very tempting commit to make, unfortunately it broke pattern matching of vectors of booleans. The problem is that a ConstantDataVector is only formed if the element type is one of i8, i16, etc. So vectors of funky types, or not so funky types like i1, are no longer matched. I noticed this while working on PR11948. The good thing is that the testcase there no longer crashes
2009 Jun 18
3
[LLVMdev] Initialising global Array
Hi, I try to create a array that has a nonzero initialiser: What i do is, first create the array type. > const ArrayType *ATy = ArrayType::get(Type::Int32Ty, NumEdges); Then create some constant values for the initializer. > std::vector<Constant*> Initializer; Initializer.reserve(NumEdges); > APInt zero(32,0); Constant* zeroc = ConstantInt::get(zero); > APInt