Displaying 3 results from an estimated 3 matches for "intt".
Did you mean:
int
2011 Jun 06
2
[LLVMdev] Explanation
Hi All,
I am trying to check if a Value type is a int32 pointer by using
if(T == Type::getInt1PtrTy(Context, AS)) ...
I am trying to understand the AS (address space).
How do I get it? Thanks.
George
*
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110606/775e4f09/attachment.html>
2011 Jun 06
0
[LLVMdev] Explanation
On 6 June 2011 17:08, George Baah <georgebaah at gmail.com> wrote:
> if(T == Type::getInt1PtrTy(Context, AS)) ...
Hi,
You don't need to care about address spaces to check for an int32*:
if (T->isPointerTy()) {
const Type* intT = cast<PointerType>(T)->getElementType();
if (intT->isIntegerTy() && intT->getPrimitiveSizeInBits() == 32)
cout << "Yeah!" << endl;
}
Also, to create a pointer type, if you don't care about address space
at all, use the unqualified version:
c...
2011 Jun 06
1
[LLVMdev] Explanation
...0:05 AM, Renato Golin wrote:
> On 6 June 2011 17:08, George Baah <georgebaah at gmail.com> wrote:
>> if(T == Type::getInt1PtrTy(Context, AS)) ...
>
> You don't need to care about address spaces to check for an int32*:
>
> if (T->isPointerTy()) {
> const Type* intT = cast<PointerType>(T)->getElementType();
> if (intT->isIntegerTy() && intT->getPrimitiveSizeInBits() == 32)
> cout << "Yeah!" << endl;
> }
The more idiomatic way would be:
if (const PointerType *Ptr = dyn_cast<PointerType>(T))...