llvm-6502/tools
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
..
bugpoint Fix style. 2014-11-07 21:30:36 +00:00
bugpoint-passes [CMake] Add LLVM_LINK_COMPONENTS to loadable modules, LLVMHello and BugpointPasses, on Win32. 2014-07-13 13:36:48 +00:00
dsymutil Move DebugInfo to DebugInfo/DWARF. 2015-01-30 18:07:45 +00:00
gold Fixup gold-plugin after r227576. 2015-01-30 19:14:04 +00:00
llc Move DataLayout back to the TargetMachine from TargetSubtargetInfo 2015-01-26 19:03:15 +00:00
lli Fix lli after the DebugInfo move. 2015-01-30 18:42:03 +00:00
llvm-ar llvm-ar: Remove unimplemented -N option from -help 2015-01-28 06:00:01 +00:00
llvm-as Modernize raw_fd_ostream's constructor a bit. 2014-08-25 18:16:47 +00:00
llvm-bcanalyzer [cleanup] Re-sort all the #include lines in LLVM using 2015-01-14 11:23:27 +00:00
llvm-c-test Fix build breakage caused by memory leaks in llvm-c-test 2015-01-28 18:32:31 +00:00
llvm-config [cmake] Teach the llvm-config program to respect LLVM_LIBDIR_SUFFIX. 2014-12-29 11:16:25 +00:00
llvm-cov llvm-cov: Don't use llvm::outs() in library code 2015-01-23 23:09:27 +00:00
llvm-diff Return a std::unique_ptr from the IRReader.h functions. NFC. 2014-08-26 17:29:46 +00:00
llvm-dis Use the DiagnosticHandler to print diagnostics when reading bitcode. 2015-01-10 00:07:30 +00:00
llvm-dwarfdump Move DebugInfo to DebugInfo/DWARF. 2015-01-30 18:07:45 +00:00
llvm-extract Remove redundant calls to isMaterializable. 2014-11-01 16:46:18 +00:00
llvm-go Move DebugInfo to DebugInfo/DWARF. 2015-01-30 18:07:45 +00:00
llvm-jitlistener Fix lli after the DebugInfo move. 2015-01-30 18:42:03 +00:00
llvm-link Make it easier to pass a custom diagnostic handler to the IR linker. 2014-10-27 23:02:10 +00:00
llvm-lto [llvm-lto] Add a line for setting LTOCodeGenerator's CPU string from command 2015-01-30 01:14:28 +00:00
llvm-mc Remove unused includes and out of date comment. NFC. 2014-12-17 03:07:20 +00:00
llvm-mcmarkup Explicitly pass ownership of the MemoryBuffer to AddNewSourceBuffer using std::unique_ptr 2014-08-21 20:44:56 +00:00
llvm-nm [cleanup] Re-sort all the #include lines in LLVM using 2015-01-14 11:23:27 +00:00
llvm-objdump Add the -section option to llvm-objdump used with -macho that takes the argument 2015-01-31 00:37:11 +00:00
llvm-pdbdump Oops -- accidentally commit some debug code! Removing that code; NFC (this time for real). 2015-01-29 16:18:59 +00:00
llvm-profdata Assigning and copying command line option objects shouldn't be allowed. 2015-01-22 01:49:59 +00:00
llvm-readobj Add STB_GNU_UNIQUE to the ELF writer. 2015-01-23 04:44:35 +00:00
llvm-rtdyld Move DebugInfo to DebugInfo/DWARF. 2015-01-30 18:07:45 +00:00
llvm-shlib [cmake] Start making LLVM_LIBDIR_SUFFIX effective by adding it to 2014-12-29 11:16:19 +00:00
llvm-size Assigning and copying command line option objects shouldn't be allowed. 2015-01-22 01:49:59 +00:00
llvm-stress Modernize raw_fd_ostream's constructor a bit. 2014-08-25 18:16:47 +00:00
llvm-symbolizer Move DebugInfo to DebugInfo/DWARF. 2015-01-30 18:07:45 +00:00
llvm-vtabledump llvm-vtabledump: Handle Itanium VTables 2014-11-03 07:23:25 +00:00
lto [lto] Disable dialog boxes on crash on Windows. 2015-01-29 17:20:41 +00:00
macho-dump Add printing the LC_LINKER_OPTION load command with llvm-objdump’s -private-headers. 2014-12-18 00:53:40 +00:00
msbuild MSBuild integration: fix the loop in install.bat 2014-09-30 22:30:06 +00:00
obj2yaml obj2yaml, yaml2obj: Add support for COFF executables 2014-11-14 08:15:42 +00:00
opt [PM] Change the core design of the TTI analysis to use a polymorphic 2015-01-31 03:43:40 +00:00
verify-uselistorder Prologue support 2014-12-03 02:08:38 +00:00
yaml2obj [ELFYAML] Support mips64 relocation record format in yaml2obj/obj2yaml 2015-01-25 13:29:25 +00:00
CMakeLists.txt Really really don't build llvm-pdbdump on MSVC < 2013. 2015-01-30 18:08:05 +00:00
LLVMBuild.txt Add llvm-pdbdump to tools. 2015-01-27 20:46:21 +00:00
Makefile Initial dsymutil tool commit. 2014-12-12 17:31:24 +00:00