[PATCH] CodeGen: improve ms instrincics support

Reid Kleckner rnk at google.com
Tue Jun 17 14:35:15 PDT 2014


================
Comment at: lib/Sema/SemaChecking.cpp:139
@@ +138,3 @@
+  case Builtin::BI_InterlockedExchangePointer:
+    BuiltinID = Builtin::BI__sync_lock_test_and_set;
+    break;
----------------
I don't think these intrinsics need the special overload handling that the __sync intrinsics require.  They should just need type checking that's already described by Builtins.def.

================
Comment at: lib/Sema/SemaChecking.cpp:145-147
@@ +144,5 @@
+    assert(TheCall->getNumArgs() == 3);
+    Expr *Arg1 = TheCall->getArg(1), *Arg2 = TheCall->getArg(2);
+    TheCall->setArg(1, Arg2);
+    TheCall->setArg(2, Arg1);
+
----------------
The AST should reflect the code the user wrote, and we shouldn't be doing this kind of rewrite.  The overload resolution in the existing checking code is different, it's taking something that the user wrote and annotating it with all the implicit conversions that should occur.

This should have it's own lowering in CGBuiltin.cpp.

http://reviews.llvm.org/D4182






More information about the cfe-commits mailing list