[cfe-commits] r162840 - in /cfe/trunk: lib/Basic/Targets.cpp test/Preprocessor/init.c

Simon Atanasyan satanasyan at mips.com
Wed Aug 29 08:17:30 PDT 2012


Author: atanasyan
Date: Wed Aug 29 10:17:29 2012
New Revision: 162840

URL: http://llvm.org/viewvc/llvm-project?rev=162840&view=rev
Log:
Define _MIPS_ARCH and _MIPS_ARCH_<cpu name> macros for MIPS targets.
The patch suggested by Logan Chien.

Modified:
    cfe/trunk/lib/Basic/Targets.cpp
    cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=162840&r1=162839&r2=162840&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Aug 29 10:17:29 2012
@@ -3736,6 +3736,9 @@
     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,

Modified: cfe/trunk/test/Preprocessor/init.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=162840&r1=162839&r2=162840&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Wed Aug 29 10:17:29 2012
@@ -461,6 +461,8 @@
 // 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
@@ -575,6 +577,8 @@
 // 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
@@ -686,6 +690,8 @@
 // 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
@@ -797,6 +803,8 @@
 // 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





More information about the cfe-commits mailing list