[cfe-dev] x86-64 code

Chris Lattner clattner at apple.com
Thu Mar 6 10:01:30 PST 2008


On Mar 6, 2008, at 9:52 AM, Santosh Nagarakatte wrote:

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

No, currently it's fairly hard coded to x86-32.  Clang has a good  
target abstraction interface (TargetInfo) most methods are just hard  
coded like this:

class TargetInfo : ...
...

   /// getPointerWidth - Return the width of pointers on this target, we
   /// currently assume one pointer type.
   void getPointerInfo(uint64_t &Size, unsigned &Align) {
     Size = 32;  // FIXME: implement correctly.
     Align = 32;
   }


If you're interested in making this happen, just sink the logic into  
TargetInfoImpl (like getWCharInfo does), and have the x86-64 target do  
the right thing.  This will allow you use 'clang -arch x86_64 foo.c'  
or something similiar.

-Chris




More information about the cfe-dev mailing list