timshen marked an inline comment as done.
timshen added inline comments.

================
Comment at: llvm/include/llvm/ADT/APFloat.h:791
   void makeNaN(bool SNaN, bool Neg, const APInt *fill) {
-    getIEEE().makeNaN(SNaN, Neg, fill);
+    if (usesLayout<IEEEFloat>(getSemantics()))
+      return U.IEEE.makeNaN(SNaN, Neg, fill);
----------------
hfinkel wrote:
> I realize that some of this existed before, but is there any way to refactor 
> this so that we don't have so much boiler plate? Even using a utility macro 
> is probably better than this.
I was thinking about using a macro. I can do that after this patch.

The right way though, is to use virtual functions to do the dynamic dispatch. 
Ideally, we will have APFloatInterface as a pure virtual base, IEEEFloat and 
DoubleAPFloat as its two derives, and APFloat managing the union buffer to hold 
the objects. This approach is not easy to transit to, since then the object 
needs to keep a vtable pointer around, which costs a word. In order to 
compensate that overhead, we need somehow stash the "semantics" data member 
into the vtable.


https://reviews.llvm.org/D27872



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to