llvm-6502/include/llvm/CodeGen
Chandler Carruth a6a87b595d [PM] Change the core design of the TTI analysis to use a polymorphic
type erased interface and a single analysis pass rather than an
extremely complex analysis group.

The end result is that the TTI analysis can contain a type erased
implementation that supports the polymorphic TTI interface. We can build
one from a target-specific implementation or from a dummy one in the IR.

I've also factored all of the code into "mix-in"-able base classes,
including CRTP base classes to facilitate calling back up to the most
specialized form when delegating horizontally across the surface. These
aren't as clean as I would like and I'm planning to work on cleaning
some of this up, but I wanted to start by putting into the right form.

There are a number of reasons for this change, and this particular
design. The first and foremost reason is that an analysis group is
complete overkill, and the chaining delegation strategy was so opaque,
confusing, and high overhead that TTI was suffering greatly for it.
Several of the TTI functions had failed to be implemented in all places
because of the chaining-based delegation making there be no checking of
this. A few other functions were implemented with incorrect delegation.
The message to me was very clear working on this -- the delegation and
analysis group structure was too confusing to be useful here.

The other reason of course is that this is *much* more natural fit for
the new pass manager. This will lay the ground work for a type-erased
per-function info object that can look up the correct subtarget and even
cache it.

Yet another benefit is that this will significantly simplify the
interaction of the pass managers and the TargetMachine. See the future
work below.

The downside of this change is that it is very, very verbose. I'm going
to work to improve that, but it is somewhat an implementation necessity
in C++ to do type erasure. =/ I discussed this design really extensively
with Eric and Hal prior to going down this path, and afterward showed
them the result. No one was really thrilled with it, but there doesn't
seem to be a substantially better alternative. Using a base class and
virtual method dispatch would make the code much shorter, but as
discussed in the update to the programmer's manual and elsewhere,
a polymorphic interface feels like the more principled approach even if
this is perhaps the least compelling example of it. ;]

Ultimately, there is still a lot more to be done here, but this was the
huge chunk that I couldn't really split things out of because this was
the interface change to TTI. I've tried to minimize all the other parts
of this. The follow up work should include at least:

1) Improving the TargetMachine interface by having it directly return
   a TTI object. Because we have a non-pass object with value semantics
   and an internal type erasure mechanism, we can narrow the interface
   of the TargetMachine to *just* do what we need: build and return
   a TTI object that we can then insert into the pass pipeline.
2) Make the TTI object be fully specialized for a particular function.
   This will include splitting off a minimal form of it which is
   sufficient for the inliner and the old pass manager.
3) Add a new pass manager analysis which produces TTI objects from the
   target machine for each function. This may actually be done as part
   of #2 in order to use the new analysis to implement #2.
4) Work on narrowing the API between TTI and the targets so that it is
   easier to understand and less verbose to type erase.
5) Work on narrowing the API between TTI and its clients so that it is
   easier to understand and less verbose to forward.
6) Try to improve the CRTP-based delegation. I feel like this code is
   just a bit messy and exacerbating the complexity of implementing
   the TTI in each target.

Many thanks to Eric and Hal for their help here. I ended up blocked on
this somewhat more abruptly than I expected, and so I appreciate getting
it sorted out very quickly.

Differential Revision: http://reviews.llvm.org/D7293

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227669 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-31 03:43:40 +00:00
..
PBQP [PBQP] Unique allowed-sets for nodes in the PBQP graph and use pairs of these 2014-10-27 17:44:25 +00:00
Analysis.h Fold a loop for array processing in ComputeLinearIndex 2015-01-14 05:33:01 +00:00
AsmPrinter.h Prune an out-of-date \param since r226476. [-Wdocumentation] 2015-01-23 01:05:12 +00:00
BasicTTIImpl.h [PM] Change the core design of the TTI analysis to use a polymorphic 2015-01-31 03:43:40 +00:00
CalcSpillWeights.h [PBQP] Tweak spill costs and coalescing benefits 2014-11-04 20:51:24 +00:00
CallingConvLower.h Make musttail more robust for vector types on x86 2014-12-22 23:58:37 +00:00
CommandFlags.h Revert "Insert random noops to increase security against ROP attacks (llvm)" 2015-01-14 05:24:33 +00:00
DAGCombine.h
DFAPacketizer.h Remove the TargetMachine from DFAPacketizer since it was only 2014-10-14 01:03:16 +00:00
DIE.h Make DIE.h a public CodeGen header. 2015-01-05 21:29:41 +00:00
EdgeBundles.h [modules] "Specialize" a function by actually specializing a function template 2014-04-24 18:27:29 +00:00
FastISel.h [cleanup] Re-sort all the #include lines in LLVM using 2015-01-14 11:23:27 +00:00
ForwardControlFlowIntegrity.h [cleanup] Re-sort all the #include lines in LLVM using 2015-01-14 11:23:27 +00:00
FunctionLoweringInfo.h Remove dead code for llvm.eh.selector in the old EH model 2015-01-14 18:49:39 +00:00
GCMetadata.h Revert GCStrategy ownership changes 2015-01-26 18:26:35 +00:00
GCMetadataPrinter.h Revert GCStrategy ownership changes 2015-01-26 18:26:35 +00:00
GCs.h clang-format all the GC related files (NFC) 2015-01-16 23:16:12 +00:00
GCStrategy.h Remove gc.root's performCustomLowering 2015-01-28 19:28:03 +00:00
IntrinsicLowering.h Rename some member variables from TD to DL. 2014-02-18 15:33:12 +00:00
ISDOpcodes.h Implement new way of expanding extloads. 2015-01-14 01:35:17 +00:00
JumpInstrTables.h Add Forward Control-Flow Integrity. 2014-11-11 21:08:02 +00:00
LatencyPriorityQueue.h [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-14 00:51:57 +00:00
LexicalScopes.h [cleanup] Re-sort all the #include lines in LLVM using 2015-01-14 11:23:27 +00:00
LinkAllAsmWriterComponents.h Add a GC plugin for Erlang 2013-03-25 13:47:46 +00:00
LinkAllCodegenComponents.h Introduce an example statepoint GC strategy 2015-01-07 19:07:50 +00:00
LiveInterval.h LiveInterval: Introduce createMainRangeFromSubranges(). 2014-12-24 02:11:51 +00:00
LiveIntervalAnalysis.h LiveIntervalAnalysis: Factor out code to update liveness on vreg def removal 2015-01-21 19:02:30 +00:00
LiveIntervalUnion.h LiveIntervalUnion: Allow specification of liverange when unifying/extracting. 2014-12-10 01:12:59 +00:00
LivePhysRegs.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
LiveRangeEdit.h Remove unnecessary getTarget call now that the subtarget is cached 2014-09-03 20:36:26 +00:00
LiveRegMatrix.h [C++11] Replace OwningPtr with std::unique_ptr in places where it doesn't break the API. 2014-04-21 09:34:48 +00:00
LiveStackAnalysis.h [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-14 00:51:57 +00:00
LiveVariables.h CodeGen/LiveVariables: hoist out code in nested loops 2014-08-25 01:59:49 +00:00
MachineBasicBlock.h CodeGen: assert an instruction is being inserted with the correct iterator. 2014-11-14 00:34:59 +00:00
MachineBlockFrequencyInfo.h blockfreq: Remove unnecessary template parameters 2014-04-11 23:21:02 +00:00
MachineBranchProbabilityInfo.h blockfreq: Use const in MachineBlockFrequencyInfo 2014-03-25 18:01:32 +00:00
MachineCombinerPattern.h MachineCombiner Pass for selecting faster instruction 2014-08-03 21:35:39 +00:00
MachineConstantPool.h CodeGen: Add a getSectionKind method to MachineConstantPoolEntry 2014-07-14 22:06:29 +00:00
MachineDominanceFrontier.h Try to fix MSVC build 2014-07-12 23:09:02 +00:00
MachineDominators.h Update SetVector to rely on the underlying set's insert to return a pair<iterator, bool> 2014-11-19 07:49:26 +00:00
MachineFrameInfo.h Add the llvm.frameallocate and llvm.recoverframeallocation intrinsics 2015-01-13 00:48:10 +00:00
MachineFunction.h Add a similar templated cast for getSubtarget off of the MachineFunction 2015-01-30 22:02:19 +00:00
MachineFunctionAnalysis.h [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-07 09:26:03 +00:00
MachineFunctionPass.h [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-07 09:26:03 +00:00
MachineInstr.h LiveIntervalAnalysis: Mark subregister defs as undef when we determined they are only reading a dead superregister value 2015-01-21 22:55:13 +00:00
MachineInstrBuilder.h Work around bugs in MSVC "14" CTP 3's conversion logic 2014-10-31 23:19:46 +00:00
MachineInstrBundle.h [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-14 00:51:57 +00:00
MachineJumpTableInfo.h
MachineLoopInfo.h [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-07 09:26:03 +00:00
MachineMemOperand.h AA metadata refactoring (introduce AAMDNodes) 2014-07-24 12:16:19 +00:00
MachineModuleInfo.h Classify functions by EH personality type rather than using the triple 2015-01-23 18:49:01 +00:00
MachineModuleInfoImpls.h
MachineOperand.h Add MachineOperand::ChangeToFPImmediate and setFPImm 2014-09-28 19:24:59 +00:00
MachinePassRegistry.h Refactoring cl::parser construction and initialization. 2015-01-22 21:01:12 +00:00
MachinePostDominators.h Fix typos in comments, NFC 2014-08-29 21:53:01 +00:00
MachineRegionInfo.h Templatify RegionInfo so it works on MachineBasicBlocks 2014-07-19 18:29:29 +00:00
MachineRegisterInfo.h MachineRegisterInfo can access TII off of the MachineFunction's 2015-01-27 01:15:16 +00:00
MachineScheduler.h [cleanup] Re-sort all the #include lines in LLVM using 2015-01-14 11:23:27 +00:00
MachineSSAUpdater.h [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-14 00:51:57 +00:00
MachineTraceMetrics.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
MachineValueType.h Intrinsics: introduce llvm_any_ty aka ValueType Any 2015-01-22 20:14:38 +00:00
MachORelocation.h
Passes.h Add a Windows EH preparation pass that zaps resumes 2015-01-29 00:41:44 +00:00
PBQPRAConstraint.h Remove redundant virtual on overriden functions. 2014-11-14 19:06:36 +00:00
PseudoSourceValue.h Fix broken build of llvm using clang. 2014-04-15 08:10:46 +00:00
RegAllocPBQP.h [PBQP] Fix transposed worst row/column check in handleAdd/RemoveNode in the PBQP 2015-01-30 22:28:49 +00:00
RegAllocRegistry.h
RegisterClassInfo.h [C++11] Replace OwningPtr with std::unique_ptr in places where it doesn't break the API. 2014-04-21 09:34:48 +00:00
RegisterPressure.h Move remaining LLVM_ENABLE_DUMP conditionals out of the headers 2014-07-01 21:19:13 +00:00
RegisterScavenging.h Changed the liveness tracking in the RegisterScavenger 2014-08-04 23:07:49 +00:00
ResourcePriorityQueue.h [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 06:32:26 +00:00
RuntimeLibcalls.h Add minnum / maxnum codegen 2014-10-21 23:01:01 +00:00
ScheduleDAG.h New method SDep::isNormalMemoryOrBarrier() in ScheduleDAGInstrs.cpp. 2015-01-07 13:38:29 +00:00
ScheduleDAGInstrs.h Cleanup: Delete seemingly unused reference to MachineDominatorTree from ScheduleDAGInstrs. 2014-08-20 20:57:26 +00:00
ScheduleDFS.h Move remaining LLVM_ENABLE_DUMP conditionals out of the headers 2014-07-01 21:19:13 +00:00
ScheduleHazardRecognizer.h Add two additional hazard recognizer functions 2013-12-11 22:33:43 +00:00
SchedulerRegistry.h
ScoreboardHazardRecognizer.h [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-14 00:51:57 +00:00
SelectionDAG.h Fixed a bug in type legalizer for masked load/store intrinsics. 2015-01-22 12:07:59 +00:00
SelectionDAGISel.h [cleanup] Re-sort all the #include lines in LLVM using 2015-01-14 11:23:27 +00:00
SelectionDAGNodes.h Fixed a bug in type legalizer for masked load/store intrinsics. 2015-01-22 12:07:59 +00:00
SlotIndexes.h [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-14 00:51:57 +00:00
StackMapLivenessAnalysis.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
StackMaps.h [Statepoints 2/4] Statepoint infrastructure for garbage collection: MI & x86-64 Backend 2014-12-01 22:52:56 +00:00
StackProtector.h [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-14 00:51:57 +00:00
TargetLoweringObjectFileImpl.h Recommit r224935 with a fix for the ObjC++/AArch64 bug that that revision 2015-01-09 18:55:42 +00:00
TargetSchedule.h Change MCSchedModel to be a struct of statically initialized data. 2014-09-02 17:43:54 +00:00
ValueTypes.h [C++11] More 'nullptr' conversion or in some cases just using a boolean check instead of comparing to nullptr. 2014-04-09 06:08:46 +00:00
ValueTypes.td Intrinsics: introduce llvm_any_ty aka ValueType Any 2015-01-22 20:14:38 +00:00
VirtRegMap.h [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-14 00:51:57 +00:00