x86-64 code


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

The llvm ir generated for the following c code is

C code

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.