> ----- Original Message ----- >> 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__) ...) > > A general note: Given all of the compiler variance out there regarding whether the 32-bit macros are also defined on the 64-bit systems, I really think that you'll need to arrange these as: > > #define LLVM_PPC64 (defined(__ppc64__) || defined(__powerpc64__) ...) > #define LLVM_PPC !LLVM_PPC64 && (defined(__ppc__) || defined(__powerpc__) ...)or define more clearly: #define LLVM_PPC32 (((defined(__ppc__) || defined(__powerpc__)) && !LLVM_PPC64) #define LLVM_PPC_ANY (LLVM_PPC32 || LLVM_PPC64) or #define LLVM_PPC_ANY (defined(__ppc__) || defined(__powerpc__)) #define LLVM_PPC32 (LLVM_PPC_ANY && !LLVM_PPC64) ?>> 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? > > Would all uses of these macros be restricted to the PPC backend, or > would they appear elsewhere as well?One place I see these predefines outside of the PPC backend is lib/Support/Host.cpp Fang> -Hal > >> >> 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/
----- Original Message -----> > ----- Original Message ----- > >> 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__) > >> ...) > > > > A general note: Given all of the compiler variance out there > > regarding whether the 32-bit macros are also defined on the 64-bit > > systems, I really think that you'll need to arrange these as: > > > > #define LLVM_PPC64 (defined(__ppc64__) || defined(__powerpc64__) > > ...) > > #define LLVM_PPC !LLVM_PPC64 && (defined(__ppc__) || > > defined(__powerpc__) ...) > > or define more clearly: > > #define LLVM_PPC32 (((defined(__ppc__) || defined(__powerpc__)) && > !LLVM_PPC64) > #define LLVM_PPC_ANY (LLVM_PPC32 || LLVM_PPC64) > > or > > #define LLVM_PPC_ANY (defined(__ppc__) || defined(__powerpc__)) > #define LLVM_PPC32 (LLVM_PPC_ANY && !LLVM_PPC64)I thought that you had discovered that on Darwin __ppc__, etc. are defined only for 32-bit builds. Is that correct? -Hal> > ? > > >> 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? > > > > Would all uses of these macros be restricted to the PPC backend, or > > would they appear elsewhere as well? > > One place I see these predefines outside of the PPC backend is > lib/Support/Host.cpp > > Fang > > > -Hal > > > >> > >> 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/ > >-- Hal Finkel Assistant Computational Scientist Leadership Computing Facility Argonne National Laboratory
Hi,> ----- Original Message ----- >>> ----- Original Message ----- >>>> 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__) >>>> ...) >> or define more clearly: >> >> #define LLVM_PPC32 (((defined(__ppc__) || defined(__powerpc__)) && >> !LLVM_PPC64) >> #define LLVM_PPC_ANY (LLVM_PPC32 || LLVM_PPC64) >> >> or >> >> #define LLVM_PPC_ANY (defined(__ppc__) || defined(__powerpc__)) >> #define LLVM_PPC32 (LLVM_PPC_ANY && !LLVM_PPC64) > > I thought that you had discovered that on Darwin __ppc__, etc. are defined only for 32-bit builds. Is that correct? > > -HalAh yes, with apple-gcc-4.0.1 (powerpc) -m32 only defines __ppc__ -m64 only defines __ppc64__ So a more correct set of definitions would be: #define LLVM_PPC32 ((defined(__ppc__) || (defined(__powerpc__) && !defined(__powerpc64__))) #define LLVM_PPC64 (defined(__ppc64__) || defined(__powerpc64__)) #define LLVM_PPC_ANY (LLVM_PPC32 || LLVM_PPC64) Fang>>>> 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? >>> >>> Would all uses of these macros be restricted to the PPC backend, or >>> would they appear elsewhere as well? >> >> One place I see these predefines outside of the PPC backend is >> lib/Support/Host.cpp >> >> Fang >> >>> -Hal >>> >>>> >>>> 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/ >> >> > >-- David Fang http://www.csl.cornell.edu/~fang/
Possibly Parallel Threads
- [LLVMdev] arch-specific predefines in LLVM's source
- [LLVMdev] arch-specific predefines in LLVM's source
- [LLVMdev] arch-specific predefines in LLVM's source
- [LLVMdev] arch-specific predefines in LLVM's source
- [LLVMdev] [PATCH] fix for FreeBSD/powerpc build breakage