diff options
author | Dylan Noblesmith <nobled@dreamwidth.org> | 2012-08-10 19:12:37 +0000 |
---|---|---|
committer | Dylan Noblesmith <nobled@dreamwidth.org> | 2012-08-10 19:12:37 +0000 |
commit | 6bd3291605a3034b858c8aeecc6990fa4f979f6c (patch) | |
tree | ba36e48e909fa2a478e514c16433651df011b02e /lib | |
parent | 5498e3a01be0446f38c102278847566176f6507f (diff) |
Frontend: define _LP64 in a target-independent way
Instead of adding it to each individual subclass in
Targets.cpp, simply check the appropriate target
values.
Where before it was only on x86_64 and ppc64, it's now
also defined on mips64 and nvptx64.
Also add a bunch of negative tests to ensure it is *not*
defined on any other architectures while we're here.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161685 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Basic/Targets.cpp | 6 | ||||
-rw-r--r-- | lib/Frontend/InitPreprocessor.cpp | 7 |
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index c9491183b1..883864fd9a 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -792,8 +792,6 @@ void PPCTargetInfo::getTargetDefines(const LangOptions &Opts, Builder.defineMacro("__POWERPC__"); if (PointerWidth == 64) { Builder.defineMacro("_ARCH_PPC64"); - Builder.defineMacro("_LP64"); - Builder.defineMacro("__LP64__"); Builder.defineMacro("__powerpc64__"); Builder.defineMacro("__ppc64__"); } else { @@ -2074,10 +2072,6 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const { // Target identification. if (PointerWidth == 64) { - if (getLongWidth() == 64) { - Builder.defineMacro("_LP64"); - Builder.defineMacro("__LP64__"); - } Builder.defineMacro("__amd64__"); Builder.defineMacro("__amd64"); Builder.defineMacro("__x86_64"); diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp index 6b9965ed60..1440da6e37 100644 --- a/lib/Frontend/InitPreprocessor.cpp +++ b/lib/Frontend/InitPreprocessor.cpp @@ -458,6 +458,13 @@ static void InitializePredefinedMacros(const TargetInfo &TI, else Builder.defineMacro("__BYTE_ORDER__", "__ORDER_LITTLE_ENDIAN__"); + + if (TI.getPointerWidth(0) == 64 && TI.getLongWidth() == 64 + && TI.getIntWidth() == 32) { + Builder.defineMacro("_LP64"); + Builder.defineMacro("__LP64__"); + } + // Define type sizing macros based on the target properties. assert(TI.getCharWidth() == 8 && "Only support 8-bit char so far"); Builder.defineMacro("__CHAR_BIT__", "8"); |