[LLVMdev] arch-specific predefines in LLVM's source

David Fang fang at csl.cornell.edu
Thu Jul 25 14:54:48 PDT 2013


Hi all,
 	My recent commit r187027 fixed a simple oversight of forgetting to 
check for __ppc__ (only checking __powerpc__), which broke my 
powerpc-apple-darwin8 stage1 tests, since the system gcc only provided 
__ppc__.  I was wondering if this justifies using simpler macros like

#define LLVM_PPC	(defined(__ppc__) || defined(__powerpc__) ...)
#define LLVM_PPC64	(defined(__ppc64__) || defined(__powerpc64__) ...)

I've even seen __POWERPC__, _POWER, _ARCH_PPC being tested in 
conditionals.

These proposed standardized macros would only be used in LLVM project 
sources; there's no reason to exported them. 
The standardized macros would simplify conditionals and make their use 
less error-prone.

What predefines do other architectures use?

What would be a suitable place for these proposed macros?
include/llvm/Support/Compiler.h?
include/llvm/Support/Arch.h (new)?

Fang

-- 
David Fang
http://www.csl.cornell.edu/~fang/




More information about the llvm-dev mailing list