[PATCH] D27872: [APFloat] Switch from (PPCDoubleDoubleImpl, IEEEdouble) layout to (IEEEdouble, IEEEdouble)
Tim Shen via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 9 14:35:58 PST 2017
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
More information about the cfe-commits
mailing list