9398 Commits

Author SHA1 Message Date
Alexander Shaposhnikov
0390dacdd0 [llvm-strip] Minor fix of the usage of TableGen
This is a small follow-up to the revisions r333117 and r331663.

1. Avoid the name conflicts of the generated variables for prefixes.
2. Apply clang-format -i -style=llvm to llvm-objcopy.cpp once again.
3. Add a test for the flag with double dash.

Test plan: make check-all


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333120 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-23 20:39:52 +00:00
Alexander Shaposhnikov
49011d2b65 [llvm-strip] Expose --keep-symbol option
Expose --keep-symbol option in llvm-strip.

Test plan: make check-all

Differential revision: https://reviews.llvm.org/D47222


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333117 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-23 19:44:19 +00:00
Matt Davis
273694c064 [llvm-mca] Fix header comments. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333096 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-23 16:15:06 +00:00
Andrea Di Biagio
3d525a3f58 [llvm-mca] Print the "Block RThroughput" in the SummaryView.
This patch implements the "block reciprocal throughput" computation in the
SummaryView.

The block reciprocal throughput is computed as the MAX of:
  - NumMicroOps / DispatchWidth
  - Resource Cycles / #Units   (for every resource consumed).

The block throughput is bounded from above by the hardware dispatch throughput.
That is because the DispatchWidth is an upper bound on how many opcodes can be part
of a single dispatch group.

The block throughput is also limited by the amount of hardware parallelism. The
number of available resource units affects how the resource pressure is
distributed, and also how many blocks can be delivered every cycle.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333095 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-23 15:59:27 +00:00
Max Moroz
f880cf0ebc [Coverage] Update CSS to make HTML reports copy-paste friendly.
Summary:
This minor change allows to copy snippets from HTML reports so they
will be pasted in the following format:
%LineNumber%\t%HitCount%\t%CodeLine%

rather then being split onto multiple lines. To see this in action, try copy
pasting from https://chromium-coverage.appspot.com/reports/560344/linux/chromium/src/third_party/zlib/compress.c.html

Requested in https://bugs.chromium.org/p/chromium/issues/detail?id=845571

Reviewers: vsk

Reviewed By: vsk

Subscribers: llvm-commits, morehouse, kcc

Differential Revision: https://reviews.llvm.org/D47231

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333034 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-22 22:40:14 +00:00
Matt Davis
5fd7b638b8 [llvm-mca] Move DispatchStage::cycleEvent to preExecute. NFC.
Summary:
This is an intermediate change, it moves the non-notification logic from
Backend::notifyCycleBegin to runCycle().
    
Once the scheduler becomes part of the Execution stage
the explicit call to Scheduler::cycleEvent will disappear.
    
The logic for Dispatch::cycleEvent() can be in
the preExecute phase, which this patch addresses.


Reviewers: andreadb, RKSimon, courbet

Reviewed By: andreadb

Subscribers: tschuett, gbedwell, llvm-commits

Differential Revision: https://reviews.llvm.org/D47213

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333029 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-22 20:51:58 +00:00
Alexander Shaposhnikov
8eff37b3dd [llvm-objcopy] Fix the behavior of --strip-* and --keep-symbol
If one runs llvm-objcopy --strip-all --keep-symbol foo
and the symbol table indeed contains the symbol "foo"
then it should not be removed.

Test plan: make check-all

Differential revision: https://reviews.llvm.org/D47052


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333008 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-22 18:24:07 +00:00
Clement Courbet
a38d19ff57 [llvm-exegesis] Analysis output uses HTML.
Summary: This makes the report much more readable.

Reviewers: gchatelet

Subscribers: tschuett, mgrang, craig.topper, RKSimon, llvm-commits

Differential Revision: https://reviews.llvm.org/D47189

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332979 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-22 13:31:29 +00:00
Paul Semel
7d79fc6afb Revert "[llvm-objcopy] Add --strip-unneeded option"
There is a use after free I didn't see. Need to investigate.

This reverts commit f7624abeb1f0d012309baf2e78cf2499fbfe5e5f.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332925 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-22 01:04:36 +00:00
Paul Semel
f7624abeb1 [llvm-objcopy] Add --strip-unneeded option
This option removes symbols that are not needed by relocations.

Differential Revision: https://reviews.llvm.org/D46896

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332915 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-21 22:50:32 +00:00
Peter Collingbourne
aadeae8d7a LTO: Replace split dwarf implementation that uses objcopy with one that uses direct emission.
Part of PR37466.

Differential Revision: https://reviews.llvm.org/D47091

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332884 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-21 20:26:49 +00:00
Peter Collingbourne
9ffe073e98 CodeGen: Add a dwo output file argument to addPassesToEmitFile and hook it up to dwo output.
Part of PR37466.

Differential Revision: https://reviews.llvm.org/D47089

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332881 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-21 20:16:41 +00:00
Peter Collingbourne
60fd99da88 MC: Introduce an ELF dwo object writer and teach llvm-mc about it.
Part of PR37466.

Differential Revision: https://reviews.llvm.org/D47051

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332875 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-21 19:44:54 +00:00
Peter Collingbourne
8e93a9573f MC: Change object writers to use endian::Writer. NFCI.
Part of PR37466.

Differential Revision: https://reviews.llvm.org/D47040

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332861 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-21 18:17:42 +00:00
Peter Collingbourne
74bda0b770 MC: Change MCAssembler::writeSectionData and writeFragmentPadding to take a raw_ostream. NFCI.
Also clean up a couple of hacks where we were writing the section
contents to another stream by setting the object writer's stream,
writing and setting it back.

Part of PR37466.

Differential Revision: https://reviews.llvm.org/D47038

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332858 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-21 18:11:35 +00:00
Andrea Di Biagio
8b5d01038b [llvm-mca] Removed an empty line generated by the timeline view. NFC.
Also, regenerate all tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332853 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-21 17:11:56 +00:00
Robert Widmann
e9654fe6f7 [LLVM-C] Add DIBuilder Bindings For ObjC Classes
Summary: Add LLVMDIBuilderCreateObjCIVar, LLVMDIBuilderCreateObjCProperty, and LLVMDIBuilderCreateInheritance to allow declaring metadata for Objective-C class hierarchies and their associated properties and instance variables.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: harlanhaskins, llvm-commits

Differential Revision: https://reviews.llvm.org/D47123

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332850 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-21 16:27:35 +00:00
James Henderson
8b03f4d6d2 [DWARF] Refactor callback usage for .debug_line error handling
Change the "recoverable" error callback to take an Error instaed of a
string.

Reviewed by: JDevlieghere

Differential Revision: https://reviews.llvm.org/D46831



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332845 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-21 15:30:54 +00:00
Robert Widmann
1181c40e0e [LLVM-C] Improve Bindings For Aliases
Summary: Add wrappers for a module's alias iterators and a getter and setter for the aliasee value.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits, harlanhaskins

Differential Revision: https://reviews.llvm.org/D46808

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332826 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-20 23:49:08 +00:00
Robert Widmann
12e746778c [LLVM-C] Use Length-Providing Value Name Getters and Setters
Summary:
- Provide LLVMGetValueName2 and LLVMSetValueName2 that return and take the length of the provided C string respectively
- Deprecate LLVMGetValueName and LLVMSetValueName

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits, harlanhaskins

Differential Revision: https://reviews.llvm.org/D46890

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332810 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-19 15:08:36 +00:00
Peter Collingbourne
a68d4cc279 Support: Simplify endian stream interface. NFCI.
Provide some free functions to reduce verbosity of endian-writing
a single value, and replace the endianness template parameter with
a field.

Part of PR37466.

Differential Revision: https://reviews.llvm.org/D47032

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332757 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-18 19:46:24 +00:00
Peter Collingbourne
17a98146db MC: Change the streamer ctors to take an object writer instead of a stream. NFCI.
The idea is that a client that wants split dwarf would create a
specific kind of object writer that creates two files, and use it to
create the streamer.

Part of PR37466.

Differential Revision: https://reviews.llvm.org/D47050

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332749 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-18 18:26:45 +00:00
Clement Courbet
2652053345 [llvm-exegesis] Improve documentation.
Summary:
- Better flag names.
- Fix flag reference in doc.
- Add usage examples in doc.

Fixes PR37497.

Reviewers: gchatelet

Subscribers: llvm-commits, tschuett

Differential Revision: https://reviews.llvm.org/D47015

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332708 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-18 12:33:57 +00:00
Alexander Shaposhnikov
2135b33dc5 [llvm-objcopy] Fix formatting
Apply clang-format -i -style=llvm to llvm-objcopy.cpp
NFC.

Test plan: make check-all


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332693 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-18 04:18:41 +00:00
Matt Davis
c783a5d937 [llvm-mca] Make Dispatch a subclass of Stage.
Summary:
The logic of dispatch remains the same, but now DispatchUnit is a Stage (DispatchStage).

This change has the benefit of simplifying the backend runCycle() code.
The same logic applies, but it belongs to different components now.  This is just a start,
eventually we will need to remove the call to the DispatchStage in Scheduler.cpp, but
that will be a separate patch.  This change is mostly a renaming and moving of existing logic.

This change also encouraged me to remove the Subtarget (STI) member from the
Backend class.  That member was used to initialize the other members of Backend
and to eventually call DispatchUnit::dispatch().  Now that we have Stages, we
can eliminate this by instantiating the DispatchStage with everything it needs
at the time of construction (e.g., Subtarget).  That change allows us to call
DispatchStage::execute(IR) as we expect to call execute() for all other stages.

Once we add the Stage list (D46907) we can more cleanly call preExecute() on
all of the stages, DispatchStage, will probably wrap cycleEvent() in that
case.

Made some formatting and minor cleanups to README.txt.  Some of the text
was re-flowed to stay within 80 cols.


Reviewers: andreadb, courbet, RKSimon

Reviewed By: andreadb, courbet

Subscribers: mgorny, javed.absar, tschuett, gbedwell, llvm-commits

Differential Revision: https://reviews.llvm.org/D46983

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332652 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 19:22:29 +00:00
Reid Kleckner
b771c8e3d9 [llvm-pdbutil] Dump struct/class/union sizes in the minimal dump format
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332645 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 18:33:42 +00:00
Anastasis Grammenos
ac5db0d564 [Debugify] Print the output to stderr
Currently debugify prints it's output to stdout,
with this patch all the output generated goes to stderr.

This change lets us use debugify without taking away
the ability to pipe the output to other llvm tools.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332642 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 18:19:58 +00:00
Petar Jovanovic
6209d969a2 [mips] Add support for Global INValidate ASE
This includes

  Instructions: ginvi, ginvt,

  Assembler directives: .set ginv, .set noginv, .module ginv, .module noginv

  Attribute: ginv

  .MIPS.abiflags: GINV (0x20000)

Patch by Vladimir Stefanovic.

Differential Revision: https://reviews.llvm.org/D46268


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332624 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 16:30:32 +00:00
Andrea Di Biagio
eb1647b75b [llvm-mca] Hide unrelated flags from the -help output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332615 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 15:35:14 +00:00
Clement Courbet
234ed79cba [llvm-exegesis] Remove redudant explicit template instantiations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332611 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 14:37:31 +00:00
Clement Courbet
0ade31e6a1 [llvm-exegesis] Write out inconsistencies to a file.
Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D47013

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332608 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 13:41:28 +00:00
Andrea Di Biagio
acf3f6ed48 [llvm-mca] add flag -all-views and flag -all-stats.
Flag -all-views enables all the views.
Flag -all-stats enables all the views that print hardware statistics.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332602 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 12:27:03 +00:00
Clement Courbet
1e03426310 [llvm-exegesis] Analysis: detect clustering inconsistencies.
Summary:
Warn on instructions that should have the same performance
characteristics according to the sched model but actually
differ in their benchmarks.

Next step: Make the display nicer to browse, I was thinking maybe html.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D46945

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332601 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 12:25:18 +00:00
Clement Courbet
4f11b743f4 reland r332579: [llvm-exegesis] Update to cover latency through another opcode.
Restructuring the code to measure latency and uops.
The end goal is to have this program spawn another process to deal with SIGILL and other malformed programs. It is not yet the case in this redesign, it is still the main program that runs the code (and may crash).
It now uses BitVector instead of Graph for performance reasons.

https://reviews.llvm.org/D46821

(with fixed ARM tests)

Authored by Guillaume Chatelet

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332592 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 10:52:18 +00:00
Clement Courbet
9bb99f85e4 Revert r332579 "[llvm-exegesis] Update to cover latency through another opcode."
The revision failed to update the ARM tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332580 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 08:12:29 +00:00
Clement Courbet
33d415b159 [llvm-exegesis] Update to cover latency through another opcode.
Restructuring the code to measure latency and uops.
    The end goal is to have this program spawn another process to deal with SIGILL and other malformed programs. It is not yet the case in this redesign, it is still the main program that runs the code (and may crash).
    It now uses BitVector instead of Graph for performance reasons.

    https://reviews.llvm.org/D46821

    Authored by Guillaume Chatelet

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332579 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 07:38:21 +00:00
Petr Hosek
da555b0e24 [CMake] Support building shared library for Fuchsia
Fuchsia uses ELF as a file format and LLD as the linker so we can
use the same implementation as other ELF based platforms.

Differential Revision: https://reviews.llvm.org/D46991

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332570 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 03:39:03 +00:00
Lang Hames
bb60b65608 [ORC] Rewrite the VSO symbol table yet again. Update related utilities.
VSOs now track dependencies for materializing symbols. Each symbol must have its
dependencies registered with the VSO prior to finalization. Usually this will
involve registering the dependencies returned in
AsynchronousSymbolQuery::ResolutionResults for queries made while linking the
symbols being materialized.

Queries against symbols are notified that a symbol is ready once it and all of
its transitive dependencies are finalized, allowing compilation work to be
broken up and moved between threads without queries returning until their
symbols fully safe to access / execute.

Related utilities (VSO, MaterializationUnit, MaterializationResponsibility) are
updated to support dependence tracking and more explicitly track responsibility
for symbols from the point of definition until they are finalized.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332541 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-16 22:24:30 +00:00
Matt Davis
9e6d158bde [llvm-mca] Move the RegisterFile class into its own translation unit. NFC
Summary: This change will help us turn the DispatchUnit into its own stage.

Reviewers: andreadb, RKSimon, courbet

Reviewed By: andreadb, courbet

Subscribers: mgorny, tschuett, gbedwell, llvm-commits

Differential Revision: https://reviews.llvm.org/D46916

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332493 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-16 17:07:08 +00:00
Teresa Johnson
f90a5e079c [ThinLTO] Make llvm-lto module ID numbering consistent with linkers
The module ID numbering typically starts at 0 (in both the new and old
LTO APIs, used by linkers). Make llvm-lto consistent with that.

Split out of D46699.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332476 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-16 14:58:14 +00:00
Andrea Di Biagio
fad0c9b3b0 [llvm-mca] Move definitions in FetchStage.cpp inside namespace mca. NFC
Also, get rid of a redundant include in FetchStage.h and FetchStage.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332468 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-16 13:38:17 +00:00
Andrea Di Biagio
fb66864554 [llvm-mca] Fix perf regression after r332390.
Revision 332390 introduced a FetchStage class in llvm-mca.
By design, FetchStage owns all the instructions in-flight in the OoO Backend.

Before this change, new instructions were added to a DenseMap indexed by
instruction id. The problem with using a DenseMap is that elements are not
ordered by key. This was causing a massive slow down in method
FetchStage::postExecute(), which searches for instructions retired that can be
deleted.

This patch replaces the DenseMap with a std::map ordered by instruction index.
At the end of every cycle, we search for the first instruction which is not
marked as "retired", and we remove all the previous instructions before it.
This works well because instructions are retired in-order.

Before this patch, a debug build of llvm-mca (on my Ryzen linux machine) took
~8.0 seconds to simulate 3000 iterations of a x86 dot-product (a `vmulps,
vpermilps, vaddps, vpermilps, vaddps` sequence). With this patch, it now takes
~0.8s to run all the 3000 iterations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332461 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-16 12:33:09 +00:00
Clement Courbet
f392447b19 [llvm-exegesis] Fix unused variable warning in release mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332455 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-16 11:49:15 +00:00
Clement Courbet
3f4a74f3e5 [llvm-exegesis] Add a flag to output analysis csv to a file.
Reviewers: gchatelet

Subscribers: llvm-commits, tschuett

Differential Revision: https://reviews.llvm.org/D46931

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332445 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-16 09:50:04 +00:00
Andrea Di Biagio
13e8f305a9 [llvm-mca] Remove redundant includes in Stage.h.
This patch also makes Stage::isReady() a const method.

No functional change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332443 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-16 09:24:38 +00:00
Clement Courbet
5ae14383e9 Fix unused variable warning in r332437.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332441 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-16 09:10:04 +00:00
Clement Courbet
13a2d87d4d [llvm-exegesis] Analysis: Display sched class for instructions.
Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D46883

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332437 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-16 08:47:21 +00:00
Anastasis Grammenos
d146023add [Debugfiy] Print the pass name next to the result
CheckDebugify now prints the pass name right next to the result of the check.

Differential Revision: https://reviews.llvm.org/D46908

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332416 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-15 23:38:05 +00:00
Jake Ehrlich
bcc9a743a6 [llvm-objcopy] Add --only-keep-debug as a noop
This option just keeps being a problem and really needs to be implemented
in some fashion. Implementing it properly requires some kind of
"replaceSectionReference" method because all the existing links need to be
maintained. The desired behavior is just for allocated sections to become
NOBITS but actually implementing that is rather tricky due to the current
design of llvm-objcopy. However converting allocated sections to NOBITS is
just an optimization and not something debuggers need. Debuggers can debug
a stripped executable and take an unstripped executable for that stripped
executable as input. Additionally allocated sections account for a very
small part of debug binaries so this optimization is quite small. I propose
that for the time being we implement this as a NOP so that people can use
llvm-objcopy where they need to, just in a sub-optimal way.

This option has already blocked a lot of people and its currently blocking me.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332396 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-15 20:53:53 +00:00
Matt Davis
1b9c943536 [llvm-mca] Introduce a pipeline Stage class and FetchStage.
Summary:
    This is just an idea, really two ideas.  I expect some push-back,
    but I realize that posting a diff is the most comprehensive way to express
    these concepts.

    This patch introduces a Stage class which represents the
    various stages of an instruction pipeline.  As a start, I have created a simple
    FetchStage that is based on existing logic for how MCA produces
    instructions, but now encapsulated in a Stage.  The idea should become more concrete
    once we introduce additional stages.  The idea being, that when a stage completes,
    the next stage in the pipeline will be executed.  Stages are chained together
    as a singly linked list to closely model a real pipeline. For now there is only one stage,
    so the stage-to-stage flow of instructions isn't immediately obvious.

    Eventually, Stage will also handle event notifications, but that functionality
    is not complete, and not destined for this patch.  Ideally, an interested party 
    can register for notifications from a particular stage.  Callbacks will be issued to
    these listeners at various points in the execution of the stage.  
    For now, eventing functionality remains similar to what it has been in mca::Backend. 
    We will be building-up the Stage class as we move on, such as adding debug output.

    This patch also removes the unique_ptr<Instruction> return value from
    InstrBuilder::createInstruction.  An Instruction pointer is still produced,
    but now it's up to the caller to decide how that item should be managed post-allocation
    (e.g., smart pointer).  This allows the Fetch stage to create instructions and
    manage the lifetime of those instructions as it wishes, and not have to be bound to any
    specific managed pointer type.  Other callers of createInstruction might have different 
    requirements, and thus can manage the pointer to fit their needs.  Another idea would be to push the
   ownership to the RCU. 

    Currently, the FetchStage will wrap the Instruction
    pointer in a shared_ptr.  This allows us to remove the Instruction container in
    Backend, which was probably going to disappear, or move, at some point anyways.
    Note that I did run these changes through valgrind, to make sure we are not leaking
    memory.  While the shared_ptr comes with some additional overhead it relieves us
    from having to manage a list of generated instructions, and/or make lookup calls
    to remove the instructions. 

    I realize that both the Stage class and the Instruction pointer management
    (mentioned directly above) are separate but related ideas, and probably should
    land as separate patches; I am happy to do that if either idea is decent.
    The main reason these two ideas are together is that
    Stage::execute() can mutate an InstRef. For the fetch stage, the InstRef is populated
    as the primary action of that stage (execute()).  I didn't want to change the Stage interface
    to support the idea of generating an instruction.  Ideally, instructions are to
    be pushed through the pipeline.  I didn't want to draw too much of a
    specialization just for the fetch stage.  Excuse the word-salad.

Reviewers: andreadb, courbet, RKSimon

Reviewed By: andreadb

Subscribers: llvm-commits, mgorny, javed.absar, tschuett, gbedwell

Differential Revision: https://reviews.llvm.org/D46741

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332390 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-15 20:21:04 +00:00