[PATCH] D12002: Initial WebAssembly support in clang

JF Bastien via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 12 18:15:47 PDT 2015


jfb added a subscriber: rengolin.

================
Comment at: include/clang/Basic/TargetCXXABI.h:166
@@ +165,3 @@
+    case GenericMIPS:
+      // TODO: ARM-style pointers to member functions put the discriminator in
+      //       the this adjustment, so they don't require functions to have any
----------------
@rengolin: FYI.

================
Comment at: lib/Basic/Targets.cpp:6935
@@ +6934,3 @@
+    NoAsmVariants = true;
+    LongDoubleWidth = LongDoubleAlign = 64;
+    SuitableAlign = 128;
----------------
That's already the default?

================
Comment at: lib/Basic/Targets.cpp:6937
@@ +6936,3 @@
+    SuitableAlign = 128;
+    RegParmMax = 0; // Disallow regparm
+  }
----------------
Already the default?

================
Comment at: lib/Basic/Targets.cpp:6938
@@ +6937,3 @@
+    RegParmMax = 0; // Disallow regparm
+  }
+
----------------
`TLSSupported = false` for now.

================
Comment at: lib/Basic/Targets.cpp:6941
@@ +6940,3 @@
+  void
+  getDefaultFeatures(llvm::StringMap<bool> &Features) const override final {}
+  bool setCPU(const std::string &Name) override final {
----------------
Not needed, since that's the default impl?

================
Comment at: lib/Basic/Targets.cpp:6956
@@ +6955,3 @@
+
+    Builder.defineMacro("__REGISTER_PREFIX__", "");
+  }
----------------
I'm not sure we need this. Does it just make porting easier?

================
Comment at: lib/Basic/Targets.cpp:6983
@@ +6982,3 @@
+  const char *getClobbers() const override { return ""; }
+  bool isCLZForZeroUndef() const override { return false; }
+};
----------------
`final` for these two.

================
Comment at: lib/Basic/Targets.cpp:6994
@@ +6993,3 @@
+
+class WebAssembly32TargetInfo : public WebAssemblyTargetInfo {
+public:
----------------
`final`

================
Comment at: lib/Basic/Targets.cpp:7015
@@ +7014,3 @@
+
+class WebAssembly64TargetInfo : public WebAssemblyTargetInfo {
+public:
----------------
`final`

================
Comment at: lib/Driver/Tools.cpp:1559
@@ -1558,1 +1558,3 @@
 
+/// getWebAssemblyTargetCPU - Get the (LLVM) name of the WebAssembly cpu we are
+/// targeting.
----------------
New comment style without `name -`.

================
Comment at: test/CodeGen/wasm-arguments.c:91
@@ +90,2 @@
+// WEBASSEMBLY64: define void @f10(%struct.bitfield1* byval align 4 %bf1)
+void f10(bitfield1 bf1) {}
----------------
TODO for vararg test?

================
Comment at: test/Driver/wasm32-unknown-unknown.cpp:51
@@ +50,3 @@
+void __wasm__defined() {}
+#endif
+
----------------
Also test `__wasm32__` (and 64 in the other file).

================
Comment at: test/Driver/wasm32-unknown-unknown.cpp:64
@@ +63,3 @@
+void _REENTRANTundefined() {}
+#endif
+
----------------
Test `__REGISTER_PREFIX__` if we do keep it.

================
Comment at: test/Preprocessor/init.c:8478
@@ +8477,3 @@
+// WEBASSEMBLY32:#define __GCC_ATOMIC_POINTER_LOCK_FREE 2
+// WEBASSEMBLY32:#define __GCC_ATOMIC_SHORT_LOCK_FREE 2
+// WEBASSEMBLY32:#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1
----------------
`ATOMIC_*_LOCK_FREE` should always be `1` for "maybe".


Repository:
  rL LLVM

http://reviews.llvm.org/D12002





More information about the cfe-commits mailing list