Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Issue 1217443024: Changes the TargetX8632 to inherit from TargetX86Base<TargetX8632>. (Closed)

Created:
5 years, 5 months ago by John
Modified:
5 years, 5 months ago
CC:
native-client-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Changes the TargetX8632 to inherit from TargetX86Base<TargetX8632>. Previously, TargetX8632 was defined as class TargetX8632 : public TargetLowering; and its create method would do TargetX8632 *TargetX8632::create() { return TargetX86Base<TargetX8632>::create() } TargetX86Base<M> was defined was template <class M> class TargetX86Base : public M; which meant TargetX8632 had no way to access methods defined in TargetX86Base<M>. This used to not be a problem, but with the X8664 backend around the corner it became obvious that the actual TargetX86 targets (e.g., X8632. X8664SysV, X8664Win) would need access to some methods in TargetX86Base (e.g., _mov, _fld, _fstp etc.) This CL changes the class hierarchy to something like TargetLowering <-- TargetX86Base<X8632> <-- X8632 <-- TargetX86Base<X8664SysV> <-- X8664SysV (TODO) <-- TargetX86Base<X8664Win> <-- X8664Win (TODO) One problem with this new design is that TargetX86Base<M> needs to be able to invoke methods in the actual backends. For example, each backend will have its own way of lowering llvm.nacl.read.tp. This creates a chicken/egg problem that is solved with (you guessed) template machinery (some would call it voodoo.) In this CL, as a proof of concept, we introduce the TargetX86Base::dispatchToConcrete template method. It is a very simple method: it downcasts "this" from the template base class (TargetX86Base<TargetX8664>) to the actual (concrete) class (TargetX8632), and then it invokes the requested method. It uses perfect forwarding for passing arguments to the method being invoked, and returns whatever that method returns. A simple proof-of-concept for using dispatchToConcrete is introduced with this CL: it is used to invoke createNaClReadTPSrcOperand on the concrete target class. In a way, dispatchToConcrete is a poor man's virtual method call, without the virtual method call overhead. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4077 R=jvoung@chromium.org, stichnot@chromium.org Committed: https://gerrit.chromium.org/gerrit/gitweb?p=native_client/pnacl-subzero.git;a=commit;h=5aeed955e17bac8cc44cc6d2b6ff7513cc714c2f

Patch Set 1 #

Total comments: 2

Patch Set 2 : s/Func-> /Func->/g (no functional changes) #

Total comments: 11

Patch Set 3 : Addresses comments. #

Total comments: 2

Patch Set 4 : git pull #

Unified diffs Side-by-side diffs Delta from patch set Stats (+109 lines, -131 lines) Patch
M src/IceTargetLoweringX8632.h View 2 chunks +15 lines, -6 lines 0 comments Download
M src/IceTargetLoweringX8632.cpp View 1 2 3 1 chunk +0 lines, -4 lines 0 comments Download
M src/IceTargetLoweringX8632Traits.h View 2 chunks +2 lines, -1 line 0 comments Download
M src/IceTargetLoweringX86Base.h View 1 2 3 4 chunks +41 lines, -66 lines 0 comments Download
M src/IceTargetLoweringX86BaseImpl.h View 1 2 3 34 chunks +51 lines, -54 lines 0 comments Download

Messages

Total messages: 9 (1 generated)
John
No behavioral changes, but a medium-sized redesign -- and some template voodoo. https://codereview.chromium.org/1217443024/diff/1/src/IceTargetLoweringX86BaseImpl.h File src/IceTargetLoweringX86BaseImpl.h ...
5 years, 5 months ago (2015-07-08 16:37:40 UTC) #2
jvoung (off chromium)
https://codereview.chromium.org/1217443024/diff/10008/src/IceRegistersX8632.h File src/IceRegistersX8632.h (right): https://codereview.chromium.org/1217443024/diff/10008/src/IceRegistersX8632.h#newcode72 src/IceRegistersX8632.h:72: /// used clang-format may need some help here https://codereview.chromium.org/1217443024/diff/10008/src/IceTargetLoweringX8632.h ...
5 years, 5 months ago (2015-07-08 18:50:11 UTC) #3
John
https://codereview.chromium.org/1217443024/diff/10008/src/IceRegistersX8632.h File src/IceRegistersX8632.h (right): https://codereview.chromium.org/1217443024/diff/10008/src/IceRegistersX8632.h#newcode72 src/IceRegistersX8632.h:72: /// used On 2015/07/08 18:50:11, jvoung wrote: > clang-format ...
5 years, 5 months ago (2015-07-08 21:44:42 UTC) #4
jvoung (off chromium)
Okay LGTM, but would be good if Jim could take a look when he comes ...
5 years, 5 months ago (2015-07-09 00:06:18 UTC) #5
Jim Stichnoth
LGTM. BTW, I don't know if the templatization is to the right point yet, but ...
5 years, 5 months ago (2015-07-13 17:51:59 UTC) #6
John
On 2015/07/13 17:51:59, stichnot wrote: > LGTM. > > BTW, I don't know if the ...
5 years, 5 months ago (2015-07-21 20:38:48 UTC) #7
John
Committed patchset #4 (id:50001) manually as 5aeed955e17bac8cc44cc6d2b6ff7513cc714c2f (presubmit successful).
5 years, 5 months ago (2015-07-21 20:39:21 UTC) #8
JF
5 years, 5 months ago (2015-07-21 21:04:30 UTC) #9
Message was sent while issue was closed.
>
> The templatization is not over yet -- I believe it will be over once I
> introduce
> the x86-64 target.
>

The templatization will continue until compile improves.

-- 
You received this message because you are subscribed to the Google Groups
"Native-Client-Reviews" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to native-client-reviews+unsubscribe@googlegroups.com.
To post to this group, send email to native-client-reviews@googlegroups.com.
Visit this group at http://groups.google.com/group/native-client-reviews.
For more options, visit https://groups.google.com/d/optout.

Powered by Google App Engine
This is Rietveld 408576698