r191124 - [Mips] Allocate NaClTargetInfo for MIPSEL NaCl
Petar Jovanovic
petar.jovanovic at imgtec.com
Fri Sep 20 18:27:01 PDT 2013
Author: petarj
Date: Fri Sep 20 20:27:01 2013
New Revision: 191124
URL: http://llvm.org/viewvc/llvm-project?rev=191124&view=rev
Log:
[Mips] Allocate NaClTargetInfo for MIPSEL NaCl
A patch to AllocateTarget function to recognize llvm::Triple::NaCl for
MIPSEL and return NaClTargetInfo. Additional test has been added to check
if the expected macros get defined.
Added:
cfe/trunk/test/Driver/mipsel-nacl-defines.cpp
Modified:
cfe/trunk/lib/Basic/Targets.cpp
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=191124&r1=191123&r2=191124&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri Sep 20 20:27:01 2013
@@ -5376,6 +5376,8 @@ static TargetInfo *AllocateTarget(const
return new FreeBSDTargetInfo<Mips32ELTargetInfo>(Triple);
case llvm::Triple::NetBSD:
return new NetBSDTargetInfo<Mips32ELTargetInfo>(Triple);
+ case llvm::Triple::NaCl:
+ return new NaClTargetInfo<Mips32ELTargetInfo>(Triple);
default:
return new Mips32ELTargetInfo(Triple);
}
Added: cfe/trunk/test/Driver/mipsel-nacl-defines.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mipsel-nacl-defines.cpp?rev=191124&view=auto
==============================================================================
--- cfe/trunk/test/Driver/mipsel-nacl-defines.cpp (added)
+++ cfe/trunk/test/Driver/mipsel-nacl-defines.cpp Fri Sep 20 20:27:01 2013
@@ -0,0 +1,45 @@
+// RUN: %clang -target mipsel-unknown-nacl -### %s -emit-llvm-only -c -o %t.o 2>&1 | FileCheck %s -check-prefix=ECHO
+// RUN: %clang -target mipsel-unknown-nacl %s -emit-llvm -S -c -o - | FileCheck %s
+// RUN: %clang -target mipsel-unknown-nacl %s -emit-llvm -S -c -pthread -o - | FileCheck %s -check-prefix=THREADS
+
+// ECHO: {{.*}} "-cc1" {{.*}}mipsel-nacl-defines.c
+
+// Check platform defines
+
+// CHECK: _MIPSELdefined
+#ifdef _MIPSEL
+void _MIPSELdefined() {}
+#endif
+
+// CHECK: _mipsdefined
+#ifdef _mips
+void _mipsdefined() {}
+#endif
+
+// CHECK: __native_client__defined
+#ifdef __native_client__
+void __native_client__defined() {}
+#endif
+
+// CHECK: unixdefined
+#ifdef unix
+void unixdefined() {}
+#endif
+
+// CHECK: __ELF__defined
+#ifdef __ELF__
+void __ELF__defined() {}
+#endif
+
+// CHECK: _GNU_SOURCEdefined
+#ifdef _GNU_SOURCE
+void _GNU_SOURCEdefined() {}
+#endif
+
+// THREADS: _REENTRANTdefined
+// CHECK: _REENTRANTundefined
+#ifdef _REENTRANT
+void _REENTRANTdefined() {}
+#else
+void _REENTRANTundefined() {}
+#endif
More information about the cfe-commits
mailing list