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
Review URL: https://codereview.chromium.org/1217443024.
| Name |
Last commit
|
Last update |
|---|---|---|
| .. | ||
| IceAPFloat.h | Loading commit data... | |
| IceAPInt.h | Loading commit data... | |
| IceAssembler.cpp | Loading commit data... | |
| IceAssembler.h | Loading commit data... | |
| IceAssemblerARM32.h | Loading commit data... | |
| IceAssemblerMIPS32.h | Loading commit data... | |
| IceAssemblerX8632.h | Loading commit data... | |
| IceAssemblerX8664.cpp | Loading commit data... | |
| IceAssemblerX8664.h | Loading commit data... | |
| IceAssemblerX86Base.h | Loading commit data... | |
| IceAssemblerX86BaseImpl.h | Loading commit data... | |
| IceBrowserCompileServer.cpp | Loading commit data... | |
| IceBrowserCompileServer.h | Loading commit data... | |
| IceBuildDefs.h | Loading commit data... | |
| IceCfg.cpp | Loading commit data... | |
| IceCfg.h | Loading commit data... | |
| IceCfgNode.cpp | Loading commit data... | |
| IceCfgNode.h | Loading commit data... | |
| IceClFlags.cpp | Loading commit data... | |
| IceClFlags.h | Loading commit data... | |
| IceClFlagsExtra.h | Loading commit data... | |
| IceCompileServer.cpp | Loading commit data... | |
| IceCompileServer.h | Loading commit data... | |
| IceCompiler.cpp | Loading commit data... | |
| IceCompiler.h | Loading commit data... | |
| IceConditionCodesARM32.h | Loading commit data... | |
| IceConditionCodesX8632.h | Loading commit data... | |
| IceConditionCodesX8664.h | Loading commit data... | |
| IceConverter.cpp | Loading commit data... | |
| IceConverter.h | Loading commit data... | |
| IceDefs.h | Loading commit data... | |
| IceELFObjectWriter.cpp | Loading commit data... | |
| IceELFObjectWriter.h | Loading commit data... | |
| IceELFSection.cpp | Loading commit data... | |
| IceELFSection.h | Loading commit data... | |
| IceELFStreamer.h | Loading commit data... | |
| IceFixups.cpp | Loading commit data... | |
| IceFixups.h | Loading commit data... | |
| IceGlobalContext.cpp | Loading commit data... | |
| IceGlobalContext.h | Loading commit data... | |
| IceGlobalInits.cpp | Loading commit data... | |
| IceGlobalInits.h | Loading commit data... | |
| IceInst.cpp | Loading commit data... | |
| IceInst.def | Loading commit data... | |
| IceInst.h | Loading commit data... | |
| IceInstARM32.cpp | Loading commit data... | |
| IceInstARM32.def | Loading commit data... | |
| IceInstARM32.h | Loading commit data... | |
| IceInstMIPS32.cpp | Loading commit data... | |
| IceInstMIPS32.def | Loading commit data... | |
| IceInstMIPS32.h | Loading commit data... | |
| IceInstX8632.cpp | Loading commit data... | |
| IceInstX8632.def | Loading commit data... | |
| IceInstX8632.h | Loading commit data... | |
| IceInstX8664.def | Loading commit data... | |
| IceInstX86Base.h | Loading commit data... | |
| IceInstX86BaseImpl.h | Loading commit data... | |
| IceIntrinsics.cpp | Loading commit data... | |
| IceIntrinsics.h | Loading commit data... | |
| IceLiveness.cpp | Loading commit data... | |
| IceLiveness.h | Loading commit data... | |
| IceOperand.cpp | Loading commit data... | |
| IceOperand.h | Loading commit data... | |
| IcePhiLoweringImpl.h | Loading commit data... | |
| IceRNG.cpp | Loading commit data... | |
| IceRNG.h | Loading commit data... | |
| IceRegAlloc.cpp | Loading commit data... | |
| IceRegAlloc.h | Loading commit data... | |
| IceRegistersARM32.h | Loading commit data... | |
| IceRegistersMIPS32.h | Loading commit data... | |
| IceRegistersX8632.h | Loading commit data... | |
| IceRegistersX8664.h | Loading commit data... | |
| IceSwitchLowering.cpp | Loading commit data... | |
| IceSwitchLowering.h | Loading commit data... | |
| IceTLS.h | Loading commit data... | |
| IceTargetLowering.cpp | Loading commit data... | |
| IceTargetLowering.h | Loading commit data... | |
| IceTargetLoweringARM32.cpp | Loading commit data... | |
| IceTargetLoweringARM32.def | Loading commit data... | |
| IceTargetLoweringARM32.h | Loading commit data... | |
| IceTargetLoweringMIPS32.cpp | Loading commit data... | |
| IceTargetLoweringMIPS32.def | Loading commit data... | |
| IceTargetLoweringMIPS32.h | Loading commit data... | |
| IceTargetLoweringX8632.cpp | Loading commit data... | |
| IceTargetLoweringX8632.def | Loading commit data... | |
| IceTargetLoweringX8632.h | Loading commit data... | |
| IceTargetLoweringX8632Traits.h | Loading commit data... | |
| IceTargetLoweringX8664.cpp | Loading commit data... | |
| IceTargetLoweringX8664.h | Loading commit data... | |
| IceTargetLoweringX86Base.h | Loading commit data... | |
| IceTargetLoweringX86BaseImpl.h | Loading commit data... | |
| IceThreading.cpp | Loading commit data... | |
| IceThreading.h | Loading commit data... | |
| IceTimerTree.cpp | Loading commit data... | |
| IceTimerTree.def | Loading commit data... | |
| IceTimerTree.h | Loading commit data... | |
| IceTranslator.cpp | Loading commit data... | |
| IceTranslator.h | Loading commit data... | |
| IceTypeConverter.cpp | Loading commit data... | |
| IceTypeConverter.h | Loading commit data... | |
| IceTypes.cpp | Loading commit data... | |
| IceTypes.def | Loading commit data... | |
| IceTypes.h | Loading commit data... | |
| IceUtils.h | Loading commit data... | |
| Makefile | Loading commit data... | |
| PNaClTranslator.cpp | Loading commit data... | |
| PNaClTranslator.h | Loading commit data... | |
| README.SIMD.rst | Loading commit data... | |
| main.cpp | Loading commit data... |