[LLVMdev] How to handle size_t in front ends?
Chris Lattner
sabre at nondot.org
Wed May 7 18:07:22 PDT 2008
On Wed, 7 May 2008, Jonathan S. Shapiro wrote:
> On Wed, 2008-05-07 at 16:09 -0700, Chris Lattner wrote:
>> On Wed, 7 May 2008, Jonathan S. Shapiro wrote:
>>>>
>>>> i64 should be big enough for this. Just use i64.
>>>
>>> On a 32-bit platform, doesn't one want to use i32?
>>
>> Why? What is wrong with i64?
>
> On its face, the problem is that it doesn't fit in a native register...
> or is there something here that I am failing to understand?
The code generator deletes dead upper parts. For example:
int test(long long a, long long b) {
return a+b; // 64-bit add, taking low 32-bits
}
compiles to a single add, even on x86-32:
_test:
movl 12(%esp), %eax
addl 4(%esp), %eax
ret
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-dev
mailing list