search for: getptrtoint

Displaying 11 results from an estimated 11 matches for "getptrtoint".

2009 Sep 23
2
[LLVMdev] DebugFactory
On Sep 22, 2009, at 4:49 PM, Talin wrote: > > // Calculate the size of the specified LLVM type. > Constant * DebugInfoBuilder::getSize(const Type * type) { > Constant * one = ConstantInt::get(Type::Int32Ty, 1); > return ConstantExpr::getPtrToInt( > ConstantExpr::getGetElementPtr( > ConstantPointerNull::get(PointerType::getUnqual(type)), > &one, 1), Type::Int32Ty); > } > > Constant * DebugInfoBuilder::getAlignment(const Type * type) { > // Calculates the alignment of T using &quot...
2009 Sep 22
0
[LLVMdev] DebugFactory
...et info in all > cases ? > > oops... I meant to say "... without Target info..." > > // Calculate the size of the specified LLVM type. Constant * DebugInfoBuilder::getSize(const Type * type) { Constant * one = ConstantInt::get(Type::Int32Ty, 1); return ConstantExpr::getPtrToInt( ConstantExpr::getGetElementPtr( ConstantPointerNull::get(PointerType::getUnqual(type)), &one, 1), Type::Int32Ty); } Constant * DebugInfoBuilder::getAlignment(const Type * type) { // Calculates the alignment of T using "sizeof({i8, T}) - sizeof(T)"...
2009 Sep 22
3
[LLVMdev] DebugFactory
On Tue, Sep 22, 2009 at 9:21 AM, Devang Patel <devang.patel at gmail.com> wrote: > On Tue, Sep 22, 2009 at 12:14 AM, Talin <viridia at gmail.com> wrote: >> So, one feature of the late, lamented DebugInfoBuilder that I am missing >> quite badly, and which is not available in the current DIFactory, is the >> ability to specify structure offsets abstractly. The
2009 Sep 23
0
[LLVMdev] DebugFactory
...; wrote: > > On Sep 22, 2009, at 4:49 PM, Talin wrote: > >> >> // Calculate the size of the specified LLVM type. >> Constant * DebugInfoBuilder::getSize(const Type * type) { >> Constant * one = ConstantInt::get(Type::Int32Ty, 1); >> return ConstantExpr::getPtrToInt( >> ConstantExpr::getGetElementPtr( >> ConstantPointerNull::get(PointerType::getUnqual(type)), >> &one, 1), Type::Int32Ty); >> } >> >> Constant * DebugInfoBuilder::getAlignment(const Type * type) { >> // Calculates the al...
2009 Sep 23
2
[LLVMdev] DebugFactory
...> On Sep 22, 2009, at 4:49 PM, Talin wrote: >>> >>> // Calculate the size of the specified LLVM type. >>> Constant * DebugInfoBuilder::getSize(const Type * type) { >>>    Constant * one = ConstantInt::get(Type::Int32Ty, 1); >>>    return ConstantExpr::getPtrToInt( >>>        ConstantExpr::getGetElementPtr( >>>            ConstantPointerNull::get(PointerType::getUnqual(type)), >>>            &one, 1), Type::Int32Ty); >>> } >>> >>> Constant * DebugInfoBuilder::getAlignment(const Type * type) { >>...
2009 Sep 23
1
[LLVMdev] DebugFactory
...>> >> oops... I meant to say "... without Target info..." >> > // Calculate the size of the specified LLVM type. > Constant * DebugInfoBuilder::getSize(const Type * type) { > Constant * one = ConstantInt::get(Type::Int32Ty, 1); > return ConstantExpr::getPtrToInt( > ConstantExpr::getGetElementPtr( > ConstantPointerNull::get(PointerType::getUnqual(type)), > &one, 1), Type::Int32Ty); > } > > Constant * DebugInfoBuilder::getAlignment(const Type * type) { > // Calculates the alignment of T using &quot...
2011 Aug 01
0
[LLVMdev] SwitchInst::addCase with BlockAddress
On Sun, Jul 31, 2011 at 7:36 AM, Carlo Alberto Ferraris <cafxx at strayorange.com> wrote: > I'm trying to figure out how to feed a blockaddress to a switch condition > AND destination (basically emulating an indirectbr via a switch; I know it's > not a good approach, I'm just experimenting). > Suppose I have the following: > > SwitchInst *s =
2011 Aug 01
1
[LLVMdev] SwitchInst::addCase with BlockAddress
...t; You can use an explicit comparison+branch, though. BlockAddress is a class derived from Constant, so I thought it was meant to be, well, constant. Besides, as I wrote, it is possible to get a ConstantExpr from a BlockAddress via ConstantExpr::getPointerCast (that in turn calls ConstantExpr::getPtrToInt). Unfortunately, getPointerCast returns a Constant, not a ConstantInt; moreover, dyn_cast<ConstantInt> on that Constant returns null. What I'm missing is, therefore, how do I get a ConstantInt out of a Constant obtained via ConstantExpr::getPointerCast? -- Carlo Alberto Ferraris <...
2009 Oct 02
0
[LLVMdev] DebugFactory
...4:49 PM, Talin wrote: > >>> > >>> // Calculate the size of the specified LLVM type. > >>> Constant * DebugInfoBuilder::getSize(const Type * type) { > >>> Constant * one = ConstantInt::get(Type::Int32Ty, 1); > >>> return ConstantExpr::getPtrToInt( > >>> ConstantExpr::getGetElementPtr( > >>> ConstantPointerNull::get(PointerType::getUnqual(type)), > >>> &one, 1), Type::Int32Ty); > >>> } > >>> > >>> Constant * DebugInfoBuilder::getAlignment...
2011 Jul 31
3
[LLVMdev] SwitchInst::addCase with BlockAddress
I'm trying to figure out how to feed a blockaddress to a switch condition AND destination (basically emulating an indirectbr via a switch; I know it's not a good approach, I'm just experimenting). Suppose I have the following: SwitchInst *s = SwitchInst::Create(...); BasicBlock *bb = ...; PtrToIntInst k = new PtrToIntInst(BlockAddress::get(bb), <TYPE>, "", s);
2011 Feb 04
3
[LLVMdev] ConstantBuilder proposal
...onst Type *Ty) { return ConstantExpr::getSIToFP(C, Ty); } static Constant *GetFPToUI(Constant *C, const Type *Ty) { return ConstantExpr::getFPToUI(C, Ty); } static Constant *GetFPToSI(Constant *C, const Type *Ty) { return ConstantExpr::getFPToSI(C, Ty); } static Constant *GetPtrToInt(Constant *C, const Type *Ty) { return ConstantExpr::getPtrToInt(C, Ty); } static Constant *GetIntToPtr(Constant *C, const Type *Ty) { return ConstantExpr::getIntToPtr(C, Ty); } static Constant *GetBitCast(Constant *C, const Type *Ty) { return ConstantExpr::getBitCast(C, Ty);...