]> granicus.if.org Git - clang/commitdiff
Define _MIPS_ARCH and _MIPS_ARCH_<cpu name> macros for MIPS targets.
authorSimon Atanasyan <satanasyan@mips.com>
Wed, 29 Aug 2012 15:17:29 +0000 (15:17 +0000)
committerSimon Atanasyan <satanasyan@mips.com>
Wed, 29 Aug 2012 15:17:29 +0000 (15:17 +0000)
The patch suggested by Logan Chien.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162840 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets.cpp
test/Preprocessor/init.c

index 1d495f1f6412f76866cc3a7e5f242a3f26da788c..b5cc54d44f6412f1eb25d4f124b35a2e20ec66c3 100644 (file)
@@ -3736,6 +3736,9 @@ public:
     Builder.defineMacro("_MIPS_SZPTR", Twine(getPointerWidth(0)));
     Builder.defineMacro("_MIPS_SZINT", Twine(getIntWidth()));
     Builder.defineMacro("_MIPS_SZLONG", Twine(getLongWidth()));
+
+    Builder.defineMacro("_MIPS_ARCH", "\"" + CPU + "\"");
+    Builder.defineMacro("_MIPS_ARCH_" + StringRef(CPU).upper());
   }
 
   virtual void getTargetDefines(const LangOptions &Opts,
index e7321e063099ba783201daa646a80bca443ad1d1..66b91aad10b26e1bebac9a2debe9c071e16b78c7 100644 (file)
 // MIPS32BE:#define _ABIO32 1
 // MIPS32BE-NOT:#define _LP64
 // MIPS32BE:#define _MIPSEB 1
+// MIPS32BE:#define _MIPS_ARCH "mips32"
+// MIPS32BE:#define _MIPS_ARCH_MIPS32 1
 // MIPS32BE:#define _MIPS_SIM _ABIO32
 // MIPS32BE:#define _MIPS_SZINT 32
 // MIPS32BE:#define _MIPS_SZLONG 32
 // MIPS32EL:#define _ABIO32 1
 // MIPS32EL-NOT:#define _LP64
 // MIPS32EL:#define _MIPSEL 1
+// MIPS32EL:#define _MIPS_ARCH "mips32"
+// MIPS32EL:#define _MIPS_ARCH_MIPS32 1
 // MIPS32EL:#define _MIPS_SIM _ABIO32
 // MIPS32EL:#define _MIPS_SZINT 32
 // MIPS32EL:#define _MIPS_SZLONG 32
 // MIPS64BE:#define _ABI64 3
 // MIPS64BE:#define _LP64 1
 // MIPS64BE:#define _MIPSEB 1
+// MIPS64BE:#define _MIPS_ARCH "mips64"
+// MIPS64BE:#define _MIPS_ARCH_MIPS64 1
 // MIPS64BE:#define _MIPS_SIM _ABI64
 // MIPS64BE:#define _MIPS_SZINT 32
 // MIPS64BE:#define _MIPS_SZLONG 64
 // MIPS64EL:#define _ABI64 3
 // MIPS64EL:#define _LP64 1
 // MIPS64EL:#define _MIPSEL 1
+// MIPS64EL:#define _MIPS_ARCH "mips64"
+// MIPS64EL:#define _MIPS_ARCH_MIPS64 1
 // MIPS64EL:#define _MIPS_SIM _ABI64
 // MIPS64EL:#define _MIPS_SZINT 32
 // MIPS64EL:#define _MIPS_SZLONG 64