[cfe-dev] x86-64 code

Santosh Nagarakatte santosh.nagarakatte at gmail.com
Thu Mar 6 09:52:54 PST 2008


Hi,

Does clang generate llvm ir for a 64-bit machine?.


The llvm ir generated for the following c code is


C code
-----------
void foo ( void *addr)
{
unsigned long int area = (unsigned long int) addr;
..............
}

LLVM IR
----------------

%addr.addr = alloca i8*
%area = alloca i32
store i8* %addr, i8** %addr.addr
%tmp = load i8** %addr.addr
%conv = ptrtoint i8* tmp to i32

the pointers are 32bit => clang is not generating code for a 64-bit machine.

Am I missing something?
Shouldn't  the llvm ir generated on a 64-bit machine be

%addr.addr = alloc i8*
%area =alloca i64
...........
..............
%conv = ptrtoint i8* tmp to i64

How do I make clang generate the above code?


-- 
Santosh



More information about the cfe-dev mailing list