[llvm-commits] [llvm-gcc-4.2] r55650 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Chris Lattner clattner at apple.com
Tue Sep 23 09:17:30 PDT 2008


On Sep 23, 2008, at 1:05 AM, Duncan Sands wrote:

>>> llvm-convert.cpp is target independent code.
>>
>> No, it's not; there's lots of #ifdef TARGET_LLVM's in here.  (If
>> you're saying it's not target-dependent because it's using some
>> abstraction rather than TARGET_POWERPC, I strongly disagree.)
>
> Well, there aren't that many!  Most of them are for sync things
> and were introduced by you ;)  Otherwise there is this one:
>
> 49950  evancheng #if defined(TARGET_ALPHA) || defined(TARGET_386) ||  
> defined(TARGET_POWERPC)
>
> And that's it really.

Put another way, just because there are *some* TARGET_xxx macros being  
checked doesn't make it right to check more.  The code really should  
be target independent parameterized with target hooks.  GCC does  
target hooks with macros defined in the target.h files, so we should  
use that mechanism.

-Chris



More information about the llvm-commits mailing list