llvm-6502/lib/Target/Mips
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
..
AsmParser [mips] Manually replace JAL pseudo-instructions with their JALR equivalent, instead of using InstAlias. 2015-01-30 11:18:50 +00:00
Disassembler [Mips][Disassembler] When disassembler meets cache/pref instructions for r6 it crashes as the access to operands array is out of range. This patch adds dedicated decoder method for R6 CACHE_HINT_DESC class that properly handles decoding of these instructions. 2015-01-29 11:33:41 +00:00
InstPrinter [mips][microMIPS] MicroMIPS 16-bit unconditional branch instruction B 2015-01-21 12:39:30 +00:00
MCTargetDesc Compute the ELF SectionKind from the flags. 2015-01-29 17:33:21 +00:00
TargetInfo
CMakeLists.txt MipsABIInfo class is used in different libraries. Moving the files to MCTargetDesc folder(LLVMMipsDesc library) prevents linkage errors. There are no functional changes. 2014-12-17 11:49:56 +00:00
LLVMBuild.txt Prune redundant libdeps. 2014-07-24 11:45:27 +00:00
Makefile Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
MicroMipsInstrFormats.td [mips][microMIPS] Implement LWGP instruction 2015-01-28 17:27:26 +00:00
MicroMipsInstrFPU.td [mips][microMIPS] Fix opcodes of MFHC1 and MTHC1 instructions. 2014-11-19 13:37:51 +00:00
MicroMipsInstrInfo.td [mips][microMIPS] Implement SWM and LWM aliases 2015-01-28 21:52:27 +00:00
Mips16FrameLowering.cpp Remove most of the TargetMachine::getSubtarget/getSubtargetImpl 2015-01-29 23:27:36 +00:00
Mips16FrameLowering.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
Mips16HardFloat.cpp Rewrite the Mips16HardFloat pass to avoid using the Subtarget. 2015-01-06 01:12:30 +00:00
Mips16HardFloat.h Rewrite the Mips16HardFloat pass to avoid using the Subtarget. 2015-01-06 01:12:30 +00:00
Mips16HardFloatInfo.cpp [C++] Use 'nullptr'. Target edition. 2014-04-25 05:30:21 +00:00
Mips16HardFloatInfo.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
Mips16InstrFormats.td Fix a whole bunch of binary literals which were the wrong size. All were being silently zero extended to the correct width. 2014-08-07 05:46:54 +00:00
Mips16InstrInfo.cpp Replace several 'assert(false' with 'llvm_unreachable' or fold a condition into the assert. 2015-01-05 10:15:49 +00:00
Mips16InstrInfo.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
Mips16InstrInfo.td Replace neverHasSideEffects=1 with hasSideEffects=0 in all .td files. 2014-11-26 00:46:26 +00:00
Mips16ISelDAGToDAG.cpp Remove most of the TargetMachine::getSubtarget/getSubtargetImpl 2015-01-29 23:27:36 +00:00
Mips16ISelDAGToDAG.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
Mips16ISelLowering.cpp Remove most of the TargetMachine::getSubtarget/getSubtargetImpl 2015-01-29 23:27:36 +00:00
Mips16ISelLowering.h Re-commit r221056 and others with fix, "[mips] Move F128 argument handling into MipsCCState as we did for returns. NFC." 2014-11-02 16:09:29 +00:00
Mips16RegisterInfo.cpp Remove most of the TargetMachine::getSubtarget/getSubtargetImpl 2015-01-29 23:27:36 +00:00
Mips16RegisterInfo.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
Mips32r6InstrFormats.td Fix bit initializer which was one bit too long, but worked so long as we silently dropped the leading 0 2014-07-31 01:43:54 +00:00
Mips32r6InstrInfo.td [Mips][Disassembler] When disassembler meets cache/pref instructions for r6 it crashes as the access to operands array is out of range. This patch adds dedicated decoder method for R6 CACHE_HINT_DESC class that properly handles decoding of these instructions. 2015-01-29 11:33:41 +00:00
Mips64InstrInfo.td [mips] Enable arithmetic and binary operations for the i128 data type. 2015-01-26 12:33:22 +00:00
Mips64r6InstrInfo.td [mips] Fix two patterns that select i32's (for MIPS32r6) / i64's (for MIPS64r6) 2014-07-22 13:36:02 +00:00
Mips.h Remove most of the TargetMachine::getSubtarget/getSubtargetImpl 2015-01-29 23:27:36 +00:00
Mips.td Move the Mips target to storing the ABI in the TargetMachine rather 2015-01-26 17:33:46 +00:00
MipsAnalyzeImmediate.cpp Remove unnecessary copying or replace it with moves in a bunch of places. 2014-10-04 16:55:56 +00:00
MipsAnalyzeImmediate.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
MipsAsmPrinter.cpp Get rid of a few calls through the subtarget to get the ABI 2015-01-29 23:27:45 +00:00
MipsAsmPrinter.h std::unique_ptrify the MCStreamer argument to createAsmPrinter 2015-01-18 20:29:04 +00:00
MipsCallingConv.td [mips] Add Mips-specific CCIf's for accessing the MipsCCState. NFC. 2014-12-08 15:40:09 +00:00
MipsCCState.cpp [mips] Fix sret arguments for N32/N64 which were accidentally broken in r221534. 2014-11-10 15:57:53 +00:00
MipsCCState.h [cleanup] Re-sort all the #include lines in LLVM using 2015-01-14 11:23:27 +00:00
MipsCondMov.td [mips] Enable code generation for MIPS-III. 2014-12-12 15:16:46 +00:00
MipsConstantIslandPass.cpp Remove most of the TargetMachine::getSubtarget/getSubtargetImpl 2015-01-29 23:27:36 +00:00
MipsDelaySlotFiller.cpp Remove most of the TargetMachine::getSubtarget/getSubtargetImpl 2015-01-29 23:27:36 +00:00
MipsDSPInstrFormats.td Make it possible for the Subtarget to change between function 2014-07-10 17:26:51 +00:00
MipsDSPInstrInfo.td
MipsFastISel.cpp Get rid of a few calls through the subtarget to get the ABI 2015-01-29 23:27:45 +00:00
MipsFrameLowering.cpp Remove most of the TargetMachine::getSubtarget/getSubtargetImpl 2015-01-29 23:27:36 +00:00
MipsFrameLowering.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
MipsInstrFormats.td [mips] Add octeon branch instructions bbit0/bbit032/bbit1/bbit132 2015-01-20 16:10:51 +00:00
MipsInstrFPU.td [mips] Move COP2 & COP3 load/store instructions from MipsInstrFPU.td to MipsInstrInfo.td. NFC. 2014-11-04 21:45:16 +00:00
MipsInstrInfo.cpp Update include - this class doesn't use the target machine, but 2015-01-08 18:18:54 +00:00
MipsInstrInfo.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
MipsInstrInfo.td [mips] Manually replace JAL pseudo-instructions with their JALR equivalent, instead of using InstAlias. 2015-01-30 11:18:50 +00:00
MipsISelDAGToDAG.cpp Remove most of the TargetMachine::getSubtarget/getSubtargetImpl 2015-01-29 23:27:36 +00:00
MipsISelDAGToDAG.h Remove most of the TargetMachine::getSubtarget/getSubtargetImpl 2015-01-29 23:27:36 +00:00
MipsISelLowering.cpp Remove most of the TargetMachine::getSubtarget/getSubtargetImpl 2015-01-29 23:27:36 +00:00
MipsISelLowering.h Remove most of the TargetMachine::getSubtarget/getSubtargetImpl 2015-01-29 23:27:36 +00:00
MipsLongBranch.cpp Remove most of the TargetMachine::getSubtarget/getSubtargetImpl 2015-01-29 23:27:36 +00:00
MipsMachineFunction.cpp Remove most of the TargetMachine::getSubtarget/getSubtargetImpl 2015-01-29 23:27:36 +00:00
MipsMachineFunction.h Fix some cases where StringRef was being passed by const reference. Remove const from some other StringRefs since its implicitly const already. 2014-08-30 16:48:02 +00:00
MipsMCInstLower.cpp [mips] Optimize long branch for MIPS64 by removing %higher and %highest. 2014-05-27 18:53:06 +00:00
MipsMCInstLower.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
MipsModuleISelDAGToDAG.cpp Fundamentally change the MipsSubtarget replacement machinery: 2014-07-18 23:41:32 +00:00
MipsModuleISelDAGToDAG.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
MipsMSAInstrFormats.td Make it possible for the Subtarget to change between function 2014-07-10 17:26:51 +00:00
MipsMSAInstrInfo.td [mips] Rename MipsAsmParser functions to conform to the LLVM Coding Standards. No functional changes. 2014-09-04 13:23:44 +00:00
MipsOptimizePICCall.cpp Remove most of the TargetMachine::getSubtarget/getSubtargetImpl 2015-01-29 23:27:36 +00:00
MipsOptionRecord.h Move the Mips target to storing the ABI in the TargetMachine rather 2015-01-26 17:33:46 +00:00
MipsOs16.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:41:26 +00:00
MipsOs16.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
MipsRegisterInfo.cpp Remove most of the TargetMachine::getSubtarget/getSubtargetImpl 2015-01-29 23:27:36 +00:00
MipsRegisterInfo.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
MipsRegisterInfo.td [mips][microMIPS] Implement disassembler support for 16-bit instructions LBU16, LHU16, LW16, SB16, SH16 and SW16 2014-11-26 18:56:38 +00:00
MipsSchedule.td [mips] Implement shorthand add / sub forms for MIPS. 2014-03-24 14:05:39 +00:00
MipsSEFrameLowering.cpp Remove most of the TargetMachine::getSubtarget/getSubtargetImpl 2015-01-29 23:27:36 +00:00
MipsSEFrameLowering.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
MipsSEInstrInfo.cpp Fix a couple of odd formatting issues. 2015-01-08 18:18:53 +00:00
MipsSEInstrInfo.h Remove dead variable. 2015-01-06 01:12:42 +00:00
MipsSEISelDAGToDAG.cpp Get rid of a few calls through the subtarget to get the ABI 2015-01-29 23:27:45 +00:00
MipsSEISelDAGToDAG.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
MipsSEISelLowering.cpp Remove most of the TargetMachine::getSubtarget/getSubtargetImpl 2015-01-29 23:27:36 +00:00
MipsSEISelLowering.h Re-commit r221056 and others with fix, "[mips] Move F128 argument handling into MipsCCState as we did for returns. NFC." 2014-11-02 16:09:29 +00:00
MipsSelectionDAGInfo.cpp Have MipsSelectionDAGInfo constructor take a DataLayout rather 2014-06-27 04:38:30 +00:00
MipsSelectionDAGInfo.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
MipsSERegisterInfo.cpp Have MachineFunction cache a pointer to the subtarget to make lookups 2014-08-05 02:39:49 +00:00
MipsSERegisterInfo.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
MipsSubtarget.cpp Move DataLayout back to the TargetMachine from TargetSubtargetInfo 2015-01-26 19:03:15 +00:00
MipsSubtarget.h Move DataLayout back to the TargetMachine from TargetSubtargetInfo 2015-01-26 19:03:15 +00:00
MipsTargetMachine.cpp [PM] Change the core design of the TTI analysis to use a polymorphic 2015-01-31 03:43:40 +00:00
MipsTargetMachine.h Move DataLayout back to the TargetMachine from TargetSubtargetInfo 2015-01-26 19:03:15 +00:00
MipsTargetObjectFile.cpp Compute the ELF SectionKind from the flags. 2015-01-29 17:33:21 +00:00
MipsTargetObjectFile.h [mips] Add the following MIPS options that control gp-relative addressing of 2014-11-06 13:20:12 +00:00
MipsTargetStreamer.h Move the Mips target to storing the ABI in the TargetMachine rather 2015-01-26 17:33:46 +00:00
MSA.txt Revert r221048 - Test commit 2014-11-01 16:08:03 +00:00