[PATCH] D36707: [CodeGen]Refactor CpuSupports/CPUIs Builtin Code Gen to better work with "target" implementation

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 31 09:54:24 PDT 2017


craig.topper added inline comments.


================
Comment at: lib/CodeGen/CGBuiltin.cpp:7414
+  StringRef FeatureStr = cast<StringLiteral>(FeatureExpr)->getString();
+  return EmitX86CpuSupports({FeatureStr});
+}
----------------
You shouldn't need curly braces here. ArrayRef has a conversion constructor that should take care of this.


================
Comment at: lib/CodeGen/CGBuiltin.cpp:7456
+
+  unsigned FeaturesMask = 0;
+
----------------
Declare as uint32_t?


================
Comment at: lib/CodeGen/CGBuiltin.cpp:7494
+    assert(Feature != X86Features::MAX && "Invalid feature!");
+    FeaturesMask |= (1ULL << Feature);
+  }
----------------
No need for 64-bit OR here. FeaturesMask is only 32-bits.


================
Comment at: lib/CodeGen/CGBuiltin.cpp:7525
                                            const CallExpr *E) {
+  if (BuiltinID == X86::BI__builtin_cpu_is)
+    return EmitX86CpuIs(E);
----------------
I think you have the builtin handline at the top and in the switch. Bad rebase?


https://reviews.llvm.org/D36707





More information about the cfe-commits mailing list