1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

9350 Commits

Author SHA1 Message Date
Jonas Devlieghere
8ea2cd2814 [ADT] Make escaping fn conform to coding guidelines
As noted by Adrian on llvm-commits, PrintHTMLEscaped and PrintEscaped in
StringExtras did not conform to the LLVM coding guidelines. This commit
rectifies that.

llvm-svn: 333669
2018-05-31 17:01:42 +00:00
Pavel Labath
c8fe2424ea DWARFAcceleratorTable: fix equal_range iterators
Summary:
Both (Apple and DWARF5) implementations of the iterators had bugs which
resulted in crashes if one attempted to iterate through the accelerator
tables all the way.

For the Apple tables, the issue was that we did not clear the DataOffset
field when we reached the end, which made our iterator compare unequal
to the "end" iterator. For the Dwarf5 tables, the problem was that we
incremented the CurrentIndex pointer and then used the incremented
(possibly invalid) pointer to check whether we have reached the end of
the index list.

The reason these bugs went undetected is because their only user
(dwarfdump) only ever searched for the first match. Besides allowing us
to test this fix, changing llvm-dwarfdump --find to display all matches
seems like a good improvement (it makes the behavior consistent with the
--name option), so I change llvm-dwarfdump to do that.

The existing tests would be sufficient to test this fix with the new
llvm-dwarfdump behavior, but I add a special test that demonstrates that
the tool indeed displays multiple results. The find.test test needed to
be tweaked a bit as the tool now does not print the ".debug_info
contents" header (also consistent with how --name works).

Reviewers: JDevlieghere, aprantl, dblaikie

Subscribers: mgrang, llvm-commits

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

llvm-svn: 333635
2018-05-31 08:47:00 +00:00
Roman Lebedev
1e6ec34d95 [llvm-exegesis][NFCI] Counter::Counter(): more useful msg on event open error
Summary:
I'm slowly looking into a new X86 scheduler model,
for AMD Bulldozer CPU, model 2 (bdver2, Piledriver).

And naturally, i have hit that assert :)
I happened to know what it meant, and how to fix it,
but that is not too common knowledge.

Reviewers: courbet, RKSimon

Reviewed By: courbet

Subscribers: tschuett, llvm-commits, craig.topper

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

llvm-svn: 333632
2018-05-31 07:08:26 +00:00
Vedant Kumar
dc70cf34c3 [llvm-cov] Use the new PrintHTMLEscaped utility
This removes some duplicate logic to escape characters in HTML output.

llvm-svn: 333608
2018-05-30 23:35:14 +00:00
Peter Collingbourne
33177b3e92 llvm-objcopy: Set sh_link to 0 on unrecognized symtab-linked sections.
Per discussion on the generic-abi mailing list:
https://groups.google.com/forum/#!topic/generic-abi/MPr8TVtnVn4

An object file manipulation tool must either write out a symbol
table with the same number of entries as the original symbol table
and in the same order, or if this is impossible, refuse to operate
on the object file if it has unrecognized sections that are linked
to the symtab section. However, existing tools (namely GNU strip,
GNU objcopy and ld.{bfd,gold,lld} -r) do not comply with this at
present: they change symbol table indexes and set sh_link to 0 on
the unrecognized symtab-linked sections.

We intend to use the latter as a (temporary) signal that a tool has
operated on a proposed new symtab-linked section and invalidated the
symbol table indexes. However, llvm-objcopy currently keeps sh_link
pointing to the new symtab section. This patch changes llvm-objcopy
to set sh_link to 0 to match the behaviour of the other tools.

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

llvm-svn: 333581
2018-05-30 19:30:39 +00:00
Galina Kistanova
39e5243c4d Reverted r333424 as it broke multiple build bots and left unfixed for a long time
llvm-svn: 333578
2018-05-30 18:51:08 +00:00
Jonas Devlieghere
562ffd5cb3 [dsymutil] Escape HTML special characters in plist.
When printing string in the Plist, we weren't escaping the characters
which lead to invalid XML. This patch adds the escape logic to
StringExtras.

rdar://39785334

llvm-svn: 333565
2018-05-30 17:47:11 +00:00
Lang Hames
480513a582 [ORC] Update JITCompileCallbackManager to support multi-threaded code.
Previously JITCompileCallbackManager only supported single threaded code. This
patch embeds a VSO (see include/llvm/ExecutionEngine/Orc/Core.h) in the callback
manager. The VSO ensures that the compile callback is only executed once and that
the resulting address cached for use by subsequent re-entries.

llvm-svn: 333490
2018-05-30 01:57:45 +00:00
Alexander Ivchenko
e6f5109566 [llvm-readobj] Support GNU_PROPERTY_X86_FEATURE_1_AND notes in .note.gnu.property
This patch allows parsing GNU_PROPERTY_X86_FEATURE_1_AND
notes in .note.gnu.property sections. These notes
indicate that the object file is built to support Intel CET.

patch by mike.dvoretsky

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

llvm-svn: 333424
2018-05-29 14:49:51 +00:00
Paul Semel
3e32dee194 [llvm-objcopy] Add --keep-file-symbols option
This option prevent from removing file symbols while removing symbols.

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

llvm-svn: 333339
2018-05-26 08:10:37 +00:00
Teresa Johnson
44e9da2985 [ThinLTO] Print module summary index to assembly
Summary:
Implements AsmWriter support for printing the module summary index to
assembly with the format discussed in the RFC "LLVM Assembly format for
ThinLTO Summary".

Implements just enough of the parsing support to recognize and ignore
the summary entries. As agreed in the RFC thread, this will be the
behavior when assembling the IR. A follow on change will implement
parsing/assembling of the summary entries for use by tools that
currently build the summary index from bitcode.

Reviewers: dexonsmith, pcc

Subscribers: inglorion, eraman, steven_wu, dblaikie, llvm-commits

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

llvm-svn: 333335
2018-05-26 02:34:13 +00:00
Fangrui Song
21e65384c4 [llvm-symbolizer] Simplify
llvm-svn: 333334
2018-05-26 02:29:14 +00:00
Matt Davis
d559fd8c73 [llvm-mca] Update the header's guard name. NFC.
This patch also places a comment at the end of the header guard.

llvm-svn: 333297
2018-05-25 18:45:43 +00:00
Matt Davis
3be2788247 [llvm-mca] Update DispatchStage header comment. NFC.
Updated the comment to be a wee bit more descriptive.

llvm-svn: 333296
2018-05-25 18:31:28 +00:00
Matt Davis
61885d41df [llvm-mca] Add the RetireStage.
Summary:
This class maintains the same logic as the original RetireControlUnit.

This is just an intermediate patch to make the RCU a Stage.  Future patches will remove the dependency on the DispatchStage, and then more properly populate the pre/execute/post Stage interface.  

Reviewers: andreadb, RKSimon, courbet

Reviewed By: andreadb, courbet

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

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

llvm-svn: 333292
2018-05-25 18:00:25 +00:00
Paul Semel
2ec480d797 [llvm-objcopy] Add --strip-unneeded option
Differential Revision: https://reviews.llvm.org/D46896

llvm-svn: 333267
2018-05-25 11:01:25 +00:00
Fangrui Song
2f653c41c6 [llvm-symbolizer] Simplify. NFC
llvm-svn: 333247
2018-05-25 00:11:15 +00:00
Vedant Kumar
4846f41b60 [Debugify] Set a DI version module flag for llc compatibility
Setting the "Debug Info Version" module flag makes it possible to pipe
synthetic debug info into llc, which is useful for testing backends.

llvm-svn: 333237
2018-05-24 23:00:23 +00:00
Vedant Kumar
44bf29bed5 [Debugify] Avoid printing unnecessary square braces, NFC
llvm-svn: 333236
2018-05-24 23:00:22 +00:00
Andrea Di Biagio
2aa4f29a7e [llvm-mca] Fix a rounding problem in SummaryView.cpp exposed by r333204.
Before printing the block reciprocal throughput, ensure that the floating point
number is always rounded the same way on every target.
No functional change intended.

llvm-svn: 333210
2018-05-24 17:22:14 +00:00
Clement Courbet
229476e1fb [llvm-exegesis] Analysis: Show value extents.
Summary: Screenshot attached in phabricator.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

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

llvm-svn: 333181
2018-05-24 12:41:02 +00:00
Jonas Devlieghere
b1ad6ad40e [Support] Add color cl category.
This commit adds a color category so tools can document this option and
enables it for dwarfdump and dsymuttil.

rdar://problem/40498996

llvm-svn: 333176
2018-05-24 11:36:57 +00:00
Clement Courbet
d810290dd0 [llvm-exegesis] Analysis: show debug string instead of raw key if provided.
Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

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

llvm-svn: 333175
2018-05-24 11:26:00 +00:00
Clement Courbet
0ba5b5b01b [llvm-exegesis] Show sched class details in analysis.
Summary: And update docs.

Reviewers: gchatelet

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

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

llvm-svn: 333169
2018-05-24 10:47:05 +00:00
Alexander Shaposhnikov
374938cfe5 [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

llvm-svn: 333120
2018-05-23 20:39:52 +00:00
Alexander Shaposhnikov
0ca90ddcbf [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

llvm-svn: 333117
2018-05-23 19:44:19 +00:00
Matt Davis
4c2c0e5a34 [llvm-mca] Fix header comments. NFC.
llvm-svn: 333096
2018-05-23 16:15:06 +00:00
Andrea Di Biagio
d476292a08 [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.

llvm-svn: 333095
2018-05-23 15:59:27 +00:00
Max Moroz
a24c958922 [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

llvm-svn: 333034
2018-05-22 22:40:14 +00:00
Matt Davis
127f57c750 [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

llvm-svn: 333029
2018-05-22 20:51:58 +00:00
Alexander Shaposhnikov
3208e2e790 [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

llvm-svn: 333008
2018-05-22 18:24:07 +00:00
Clement Courbet
3cc12a1a99 [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

llvm-svn: 332979
2018-05-22 13:31:29 +00:00
Paul Semel
c9adb6fa8c Revert "[llvm-objcopy] Add --strip-unneeded option"
There is a use after free I didn't see. Need to investigate.

This reverts commit f7624abeb1f0d012309baf2e78cf2499fbfe5e5f.

llvm-svn: 332925
2018-05-22 01:04:36 +00:00
Paul Semel
afef25edd1 [llvm-objcopy] Add --strip-unneeded option
This option removes symbols that are not needed by relocations.

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

llvm-svn: 332915
2018-05-21 22:50:32 +00:00
Peter Collingbourne
13afbf5f9e LTO: Replace split dwarf implementation that uses objcopy with one that uses direct emission.
Part of PR37466.

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

llvm-svn: 332884
2018-05-21 20:26:49 +00:00
Peter Collingbourne
7f9b89f0e2 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

llvm-svn: 332881
2018-05-21 20:16:41 +00:00
Peter Collingbourne
dfa516bd25 MC: Introduce an ELF dwo object writer and teach llvm-mc about it.
Part of PR37466.

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

llvm-svn: 332875
2018-05-21 19:44:54 +00:00
Peter Collingbourne
c6202abed0 MC: Change object writers to use endian::Writer. NFCI.
Part of PR37466.

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

llvm-svn: 332861
2018-05-21 18:17:42 +00:00
Peter Collingbourne
8c1bb0e1c2 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

llvm-svn: 332858
2018-05-21 18:11:35 +00:00
Andrea Di Biagio
36a508f010 [llvm-mca] Removed an empty line generated by the timeline view. NFC.
Also, regenerate all tests.

llvm-svn: 332853
2018-05-21 17:11:56 +00:00
Robert Widmann
bfecd2d56d [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

llvm-svn: 332850
2018-05-21 16:27:35 +00:00
James Henderson
19abcdf38f [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

llvm-svn: 332845
2018-05-21 15:30:54 +00:00
Robert Widmann
805c1d4c97 [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

llvm-svn: 332826
2018-05-20 23:49:08 +00:00
Robert Widmann
a9fe014e05 [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

llvm-svn: 332810
2018-05-19 15:08:36 +00:00
Peter Collingbourne
a2edc5eab3 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

llvm-svn: 332757
2018-05-18 19:46:24 +00:00
Peter Collingbourne
7e80473026 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

llvm-svn: 332749
2018-05-18 18:26:45 +00:00
Clement Courbet
075ea51309 [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

llvm-svn: 332708
2018-05-18 12:33:57 +00:00
Alexander Shaposhnikov
332fd1e114 [llvm-objcopy] Fix formatting
Apply clang-format -i -style=llvm to llvm-objcopy.cpp
NFC.

Test plan: make check-all

llvm-svn: 332693
2018-05-18 04:18:41 +00:00
Matt Davis
d16c1af4bc [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

llvm-svn: 332652
2018-05-17 19:22:29 +00:00
Reid Kleckner
17d4a79be2 [llvm-pdbutil] Dump struct/class/union sizes in the minimal dump format
llvm-svn: 332645
2018-05-17 18:33:42 +00:00
Anastasis Grammenos
5237007f41 [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.

llvm-svn: 332642
2018-05-17 18:19:58 +00:00
Petar Jovanovic
0d488852fe [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

llvm-svn: 332624
2018-05-17 16:30:32 +00:00
Andrea Di Biagio
f5e3a66963 [llvm-mca] Hide unrelated flags from the -help output.
llvm-svn: 332615
2018-05-17 15:35:14 +00:00
Clement Courbet
0ffa761a67 [llvm-exegesis] Remove redudant explicit template instantiations.
llvm-svn: 332611
2018-05-17 14:37:31 +00:00
Clement Courbet
5b27e9775e [llvm-exegesis] Write out inconsistencies to a file.
Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

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

llvm-svn: 332608
2018-05-17 13:41:28 +00:00
Andrea Di Biagio
8bbb45c175 [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.

llvm-svn: 332602
2018-05-17 12:27:03 +00:00
Clement Courbet
52045d7838 [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

llvm-svn: 332601
2018-05-17 12:25:18 +00:00
Clement Courbet
966ceb08e6 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

llvm-svn: 332592
2018-05-17 10:52:18 +00:00
Clement Courbet
c2ebebb08d Revert r332579 "[llvm-exegesis] Update to cover latency through another opcode."
The revision failed to update the ARM tests.

llvm-svn: 332580
2018-05-17 08:12:29 +00:00
Clement Courbet
07283fe934 [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

llvm-svn: 332579
2018-05-17 07:38:21 +00:00
Petr Hosek
9232b3a2e6 [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

llvm-svn: 332570
2018-05-17 03:39:03 +00:00
Lang Hames
cbf403bc80 [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.

llvm-svn: 332541
2018-05-16 22:24:30 +00:00
Matt Davis
78d832622d [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

llvm-svn: 332493
2018-05-16 17:07:08 +00:00
Teresa Johnson
abbed81733 [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.

llvm-svn: 332476
2018-05-16 14:58:14 +00:00
Andrea Di Biagio
5b328a4e1c [llvm-mca] Move definitions in FetchStage.cpp inside namespace mca. NFC
Also, get rid of a redundant include in FetchStage.h and FetchStage.cpp.

llvm-svn: 332468
2018-05-16 13:38:17 +00:00
Andrea Di Biagio
857c92f90f [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.

llvm-svn: 332461
2018-05-16 12:33:09 +00:00
Clement Courbet
6bd6bd1791 [llvm-exegesis] Fix unused variable warning in release mode.
llvm-svn: 332455
2018-05-16 11:49:15 +00:00
Clement Courbet
333ade66d9 [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

llvm-svn: 332445
2018-05-16 09:50:04 +00:00
Andrea Di Biagio
38049fdba1 [llvm-mca] Remove redundant includes in Stage.h.
This patch also makes Stage::isReady() a const method.

No functional change.

llvm-svn: 332443
2018-05-16 09:24:38 +00:00
Clement Courbet
3c993bb482 Fix unused variable warning in r332437.
llvm-svn: 332441
2018-05-16 09:10:04 +00:00
Clement Courbet
58ef761cf2 [llvm-exegesis] Analysis: Display sched class for instructions.
Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

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

llvm-svn: 332437
2018-05-16 08:47:21 +00:00
Anastasis Grammenos
1d797ae8dd [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

llvm-svn: 332416
2018-05-15 23:38:05 +00:00
Jake Ehrlich
b63074777b [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.

llvm-svn: 332396
2018-05-15 20:53:53 +00:00
Matt Davis
efffaf5cb4 [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

llvm-svn: 332390
2018-05-15 20:21:04 +00:00
Martin Storsjo
059282774a [llvm-rc] Add support for the optional CLASS statement for dialogs
Differential Revision: https://reviews.llvm.org/D46875

llvm-svn: 332386
2018-05-15 19:21:28 +00:00
Andrea Di Biagio
5c841698f9 [llvm-mca] use a formatted_raw_ostream to insert padding and get rid of tabs. NFC
llvm-svn: 332381
2018-05-15 18:11:45 +00:00
Andrea Di Biagio
09c9c3e7d1 [llvm-mca] Strip leading tabs and spaces from instruction strings before printing. NFC
llvm-svn: 332361
2018-05-15 15:18:05 +00:00
Paul Semel
0a67d7e1d5 [llvm-objcopy] Add --keep-symbol (-K) option
This option permits to explicitly keep the specified
symbol so that it doesn't get removed.

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

llvm-svn: 332356
2018-05-15 14:09:37 +00:00
Clement Courbet
592a4a5772 [llvm-exegesis] Split AsmTemplate.Name into components.
Summary:
AsmTemplate becomes IntructionBenchmarkKey, which has three components.
This allows retreiving the opcode for analysis.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

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

llvm-svn: 332348
2018-05-15 13:07:05 +00:00
Clement Courbet
6c83d875a3 Fix compilation under pre-c++14 gccs.
llvm-svn: 332346
2018-05-15 12:38:06 +00:00
Clement Courbet
d1aa19fac3 Fix r332344: only the native target is linked.
llvm-svn: 332345
2018-05-15 12:27:36 +00:00
Clement Courbet
be6ab91eb0 [llvm-exegesis] Add an analysis mode.
Summary:
The analysis mode gives the user a clustered view of the measurement results.
Next steps are (requires the split ok AsmTemplate.Name into {mnemonic, mode}):
 - Show the sched class.
 - Highlight any inconsistencies with the checked-in data.

Reviewers: gchatelet

Subscribers: mgorny, llvm-commits, tschuett

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

llvm-svn: 332344
2018-05-15 12:08:00 +00:00
Andrea Di Biagio
ee73b51886 [llvm-mca] Remove unused include header files. NFC
Also, run clang-format on RetireControlUnit.cpp.

llvm-svn: 332337
2018-05-15 10:30:39 +00:00
Andrea Di Biagio
e5c03fa0a4 [llvm-mca] Add file header to RetireControlUnit.cpp.
Strictly speaking, this is not necessary for .cpp files. However, other .cpp
files from this same tool have it. This also matches what we do in other tools.

llvm-svn: 332334
2018-05-15 09:31:32 +00:00
Clement Courbet
e80abfe602 [llvm-exegesis] InMemoryAssembler: handle return-less targets (e.g. arm).
Summary: Arm does not have a ret code per se.

Reviewers: gchatelet

Subscribers: mgorny, javed.absar, kristof.beyls, tschuett, llvm-commits

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

llvm-svn: 332331
2018-05-15 07:40:21 +00:00
Clement Courbet
72eeaf5ee6 [llvm-exegesis] Check perf event validity.
This was part of https://reviews.llvm.org/D46821.

Authored by Guillaume Chatelet

llvm-svn: 332330
2018-05-15 07:35:21 +00:00
Martin Storsjo
19d53b6f8f [llvm-rc] Add support for parsing memory flags
Most of the handling is pretty straightforward; fetch the default
memory flags for the specific resource type before parsing the flags
and apply them on top of that, except that some flags imply others
and some flags clear more than one flag.

For icons and cursors, the flags set get passed on to all individual
single icon/cursor resources, while only some flags affect the icon/cursor
group resource.

For stringtables, the behaviour is pretty simple; the first stringtable
resource of a bundle sets the flags for the whole bundle.

The output of these tests match rc.exe byte for byte.

The actual use of these memory flags is deprecated and they have no
effect since Win16, but some resource script files may still happen
to have them in place.

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

llvm-svn: 332329
2018-05-15 06:35:29 +00:00
Martin Storsjo
89de642154 [llvm-rc] Read the Planes/BitCount fields from BITMAPINFOHEADER for icons
Previously these fields were only read from this header for cursors,
while Planes was hardcoded to 1 for icons (with a comment that it was
unknown why this was needed) and BitCount was left at the value
read originally in the RESDIRENTRY.

This fixes the single byte that was differing for the icon/cursor test
compared to rc.exe.

This is based on research/testing by Nico Weber.

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

llvm-svn: 332328
2018-05-15 06:35:20 +00:00
Sam Clegg
b0362616c3 Fix debug build by adding missing dependencies on libBinaryFormat
Debug BUILD_SHARED_LIBS build was broken by rL332305

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

llvm-svn: 332315
2018-05-15 00:46:43 +00:00
Vedant Kumar
80145bc64e [Debugify] Add -debugify-each for testing each pass in a pipeline
This adds a -debugify-each mode to opt which, when enabled, wraps each
{Module,Function}Pass in a pipeline with logic to add, check, and strip
synthetic debug info for testing purposes.

This mode can be used to test complex pipelines for debug info bugs, or
to collect statistics about the number of debug values & locations lost
throughout various stages of a pipeline.

Patch by Son Tuan Vu!

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

llvm-svn: 332312
2018-05-15 00:29:27 +00:00
Sid Manning
7e2ce4c73e Hexagon: Put relocations after instructions not packets.
Change relocation output so that relocation information follows
individual instructions rather than clustering them at the end
of packets.

This change required shifting block of code but the actual change
is in HexagonPrettyPrinter's PrintInst.

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

llvm-svn: 332283
2018-05-14 19:46:08 +00:00
Andrea Di Biagio
c6b21b2d69 [llvm-mca] Improved support for dependency-breaking instructions.
The tool assumes that a zero-latency instruction that doesn't consume hardware
resources is an optimizable dependency-breaking instruction. That means, it
doesn't have to wait on register input operands, and it doesn't consume any
physical register. The PRF knows how to optimize it at register renaming stage.

llvm-svn: 332249
2018-05-14 15:08:22 +00:00
Nicola Zaghen
9667127c14 Rename DEBUG macro to LLVM_DEBUG.
The DEBUG() macro is very generic so it might clash with other projects.
The renaming was done as follows:
- git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g'
- git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM
- Manual change to APInt
- Manually chage DOCS as regex doesn't match it.

In the transition period the DEBUG() macro is still present and aliased
to the LLVM_DEBUG() one.

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

llvm-svn: 332240
2018-05-14 12:53:11 +00:00
Clement Courbet
487f0c09ce [llvm-exegesis] Revert accidentally commited code.
llvm-svn: 332231
2018-05-14 11:35:37 +00:00
Clement Courbet
fcfd157966 [llvm-exegesis] Fix a warning in r332221
comparison of integers of different signs: 'const unsigned long' and 'const int' [-Werror,-Wsign-compare]

unittests/tools/llvm-exegesis/BenchmarkResultTest.cpp:60:5: note: in instantiation of function template specialization 'testing::internal::EqHelper<false>::Compare<unsigned long, int>' requested here
    ASSERT_EQ(FromDiskVector.size(), 1);

llvm-svn: 332230
2018-05-14 11:31:02 +00:00
Clement Courbet
7d328826c2 [llvm-exegesis] Add an analysis mode.
The analysis mode gives the user a clustered view of the measurement results and
highlights any inconsistencies with the checked-in data.

llvm-svn: 332229
2018-05-14 11:30:56 +00:00
Clement Courbet
2ae40f40c5 [llvm-exegesis] Allow lists of BenchmarkResults to be parsed as std::vector<BenchmarkResult>.
llvm-svn: 332221
2018-05-14 09:01:22 +00:00
Robert Widmann
b49c22ec9d [LLVM-C] Add Bindings For Module Flags
Summary:
The first foray into merging debug info into the echo tests.

- Add bindings to Module::getModuleFlagsMetadata() in the form of LLVMCopyModuleFlagsMetadata
- Add the opaque type LLVMModuleFlagEntry to represent Module::ModuleFlagEntry
- Add accessors for LLVMModuleFlagEntry's behavior, key, and metadata node.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: aprantl, JDevlieghere, llvm-commits, harlanhaskins

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

llvm-svn: 332219
2018-05-14 08:09:00 +00:00
Fangrui Song
d2ec706070 [llvm-ar] Make PositionalArgs static.
llvm-svn: 332216
2018-05-14 05:56:48 +00:00
JF Bastien
0502b749db llc: don't call llvm_shutdown twice
Summary:
InitLLVM already calls llvm_shutdown, but llc registers for shutdown
with llvm_shutdown_obj so it gets called twice. It's not hurting anything, but
it's also not useful, so don't do it.

Reviewers: ruiu

Subscribers: aheejin, llvm-commits

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

llvm-svn: 332174
2018-05-12 19:38:44 +00:00
David Blaikie
3c91607119 Move standard library inclusions to after internal inclusions.
llvm-svn: 332124
2018-05-11 19:21:40 +00:00
Nico Weber
a89e464fbd make add_llvm_fuzzer calls slightly more consisten with other cmake
llvm-svn: 332112
2018-05-11 17:58:52 +00:00
Alexander Shaposhnikov
099f0ecb8a [llvm-strip] Add support for -remove-section
This diff adds support for -remove-section to llvm-strip.

Test plan: make check-all

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

llvm-svn: 332081
2018-05-11 05:27:06 +00:00
Robert Widmann
da45726713 [LLVM-C] Consolidate llgo's DIBuilder Bindings
Summary: Move and correct LLVMDIBuilderCreateTypedef.  This is the last API in DIBuilderBindings.h, so it is being removed and the C API will now be re-exported from IRBindings.h.

Reviewers: whitequark, harlanhaskins, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 332041
2018-05-10 21:10:06 +00:00
Robert Widmann
527415c9d3 [LLVM-C] Move DIBuilder Bindings For Temporary MDNodes
Summary: Move LLVMTemporaryMDNode and LLVMMetadataReplaceAllUsesWith to the C bindings and add LLVMDeleteTemporaryMDNode for deleting non-RAUW'ed temporary nodes.

Reviewers: whitequark, harlanhaskins, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 332010
2018-05-10 18:09:53 +00:00
James Henderson
47d98c2dc3 [DWARF] Rework debug line parsing to use llvm::Error and callbacks
Reviewed by: dblaikie, JDevlieghere, espindola

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

Summary:
The .debug_line parser previously reported errors by printing to stderr and
return false. This is not particularly helpful for clients of the library code,
as it prevents them from handling the errors in a manner based on the calling
context. This change switches to using llvm::Error and callbacks to indicate
what problems were detected during parsing, and has updated clients to handle
the errors in a location-specific manner. In general, this means that they
continue to do the same thing to external users. Below, I have outlined what
the known behaviour changes are, relating to this change.

There are two levels of "errors" in the new error mechanism, to broadly
distinguish between different fail states of the parser, since not every
failure will prevent parsing of the unit, or of subsequent unit. Malformed
table errors that prevent reading the remainder of the table (reported by
returning them) and other minor issues representing problems with parsing that
do not prevent attempting to continue reading the table (reported by calling a
specified callback funciton). The only example of this currently is when the
last sequence of a unit is unterminated. However, I think it would be good to
change the handling of unrecognised opcodes to report as minor issues as well,
rather than just printing to the stream if --verbose is used (this would be a
subsequent change however).

I have substantially extended the DwarfGenerator to be able to handle
custom-crafted .debug_line sections, allowing for comprehensive unit-testing
of the parser code. For now, I am just adding unit tests to cover the basic
error reporting, and positive cases, and do not currently intend to test every
part of the parser, although the framework should be sufficient to do so at a
later point.

Known behaviour changes:
  - The dump function in DWARFContext now does not attempt to read subsequent
  tables when searching for a specific offset, if the unit length field of a
  table before the specified offset is a reserved value.
  - getOrParseLineTable now returns a useful Error if an invalid offset is
  encountered, rather than simply a nullptr.
  - The parse functions no longer use `WithColor::warning` directly to report
  errors, allowing LLD to call its own warning function.
  - The existing parse error messages have been updated to not specifically
  include "warning" in their message, allowing consumers to determine what
  severity the problem is.
  - If the line table version field appears to have a value less than 2, an
  informative error is returned, instead of just false.
  - If the line table unit length field uses a reserved value, an informative
  error is returned, instead of just false.
  - Dumping of .debug_line.dwo sections is now implemented the same as regular
  .debug_line sections.
  - Verbose dumping of .debug_line[.dwo] sections now prints the prologue, if
  there is a prologue error, just like non-verbose dumping.

As a helper for the generator code, I have re-added emitInt64 to the
AsmPrinter code. This previously existed, but was removed way back in r100296,
presumably because it was dead at the time.

This change also requires a change to LLD, which will be committed separately.

llvm-svn: 331971
2018-05-10 10:51:33 +00:00
Paul Semel
06b7a4574e [llvm-objcopy] Add --strip-symbol (-N) option
llvm-svn: 331924
2018-05-09 21:36:54 +00:00
Martin Storsjo
4b44f3b8e4 [llvm-rc] Handle C preprocessor output
When preprocessing resource scripts (which can easily be done outside
of llvm-rc), included headers can leave behind C declarations (despite
preprocessing with -DRC_INVOKED), that can't be parsed by a resource
compiler.

This is handled in all of rc.exe, by parsing the preprocessor output
line markers and ignoring content from files named *.h and *.c,
documented at [1].

In addition to this filtering, strip out any other preprocessor directive
that is left behind (like pragmas) which also can't be handled by the
tokenizer.

The added test uses both standard #line markers (supported by rc.exe) and
GNU style extended line markers, thus this test doesn't pass with rc.exe,
but passes with GNU windres. (Windres on the other hand doesn't filter
out files named *.c, only *.h.)

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

[1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa381033(v=vs.85).aspx

llvm-svn: 331903
2018-05-09 18:21:03 +00:00
Martin Storsjo
37d98c95b4 [llvm-rc] Add support for the RCDATA resource type
This is the same as any other user defined resource, but with
a specific allocated resource type number.

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

llvm-svn: 331902
2018-05-09 18:20:56 +00:00
Martin Storsjo
ccb3a2484c [llvm-rc] Allow -1 for control IDs in old style dialogs with 16 bit fields
-1 is commonly used as ID for controls that one don't want to
refer to later. For DIALOG resources, the IDs are 16 bit numbers,
and -1 gets interpreted as UINT32_MAX earlier, which then later is
too large to write into a uint16_t.

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

llvm-svn: 331901
2018-05-09 18:20:49 +00:00
David Blaikie
08c63c1dfe llvm-mca: Add missing includes
Move the header include in the primary source file to the top to
validate that it doesn't depend on any other inclusions.

llvm-svn: 331897
2018-05-09 17:28:10 +00:00
Nico Weber
8f0a16658d Make llvm-cfi-verify CMakeLists.txt formatting more consistent with the rest of LLVM.
llvm-svn: 331835
2018-05-09 01:07:02 +00:00
Nico Weber
7c4943e923 Inline contents of LLVM_XRAY_TOOLS variable into its only use.
No behavior change.
https://reviews.llvm.org/D46402

llvm-svn: 331830
2018-05-09 00:42:17 +00:00
Martin Storsjo
73a1fb1cfc [llvm-rc] Add support for all missing dialog controls
Differential Revision: https://reviews.llvm.org/D46507

llvm-svn: 331808
2018-05-08 20:55:58 +00:00
Alexander Shaposhnikov
9936f7fd02 [llvm-objcopy] Fix exit code
Set the exit code to 1 if no arguments are specified.

Test plan: make check-all

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

llvm-svn: 331776
2018-05-08 17:12:54 +00:00
Martin Storsjo
a3a6883a82 [llvm-rc] Update a stale comment. NFC.
The tokenizer handles comments since SVN r315207.

llvm-svn: 331761
2018-05-08 12:33:54 +00:00
Martin Storsjo
86c2d3ee20 [llvm-rc] Don't strictly require quotes around external file names
Regardless of what docs may say, existing resource files in the
wild can use this syntax.

Rename a file used in an existing test, to make it usable for unquoted
paths.

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

llvm-svn: 331747
2018-05-08 08:47:37 +00:00
Fangrui Song
84a6cf0ade [DebugInfo] Accept S in augmentation strings in CIE.
glibc libc.a(sigaction.o) compiled from sysdeps/unix/sysv/linux/x86_64/sigaction.c uses "zRS".

llvm-svn: 331738
2018-05-08 06:21:12 +00:00
Roman Lebedev
53db9423bc [llvm-rc] Fix build: missing 'override'.
llvm-svn: 331675
2018-05-07 21:06:53 +00:00
Martin Storsjo
3bb5b23c4a [llvm-rc] Implement the BITMAP resource type
Differential Revision: https://reviews.llvm.org/D46509

llvm-svn: 331670
2018-05-07 20:27:37 +00:00
Martin Storsjo
9ea045a3c6 [llvm-rc] Allow optional commas between the string table index and value
This form is even used in one of the examples at
https://msdn.microsoft.com/en-us/library/windows/desktop/aa381050(v=vs.85).aspx.

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

llvm-svn: 331669
2018-05-07 20:27:28 +00:00
Martin Storsjo
2e58ad8a52 [llvm-rc] Exclude padding from sizes in versioninfo resources
Normally when writing something that requires padding, we first
measure the length of the written payload data, then write
padding if necessary.

For a recursive structure like versioninfo, this means that the
padding is excluded from the size of the inner element, but
included in the size of the enclosing block.

Rc.exe excludes the final padding (but not the padding of earlier
children) from all levels of the hierarchy.

To achieve this, don't pad after each block or value, but only
before starting the next one. We still pad after completing the
toplevel versioninfo resource, so this won't affect other resource
types.

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

llvm-svn: 331668
2018-05-07 20:27:23 +00:00
Martin Storsjo
71a20e1f0f [llvm-rc] Fix alphabetical order of cases. NFC.
llvm-svn: 331667
2018-05-07 20:27:15 +00:00
Alexander Shaposhnikov
ebcba7c93c [tools] Introduce llvm-strip
llvm-strip is supposed to be a drop-in replacement for binutils strip.
To start the ball rolling this diff adds the initial bits for llvm-strip,
more features will be added incrementally over time.

Test plan: make check-all

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

llvm-svn: 331663
2018-05-07 19:32:09 +00:00
Matt Davis
3e43e69679 [llvm-mca] Avoid exposing index values in the MCA interfaces.
Summary:
This patch eliminates many places where we originally needed to  pass index
values to represent an instruction.  The index is still used as a key, in various parts of 
MCA.  I'm  not comfortable eliminating the index just yet.    By burying the index in
the instruction, we can avoid exposing that value in many places.

Eventually, we should consider removing the Instructions list in the Backend 
all together,   it's only used to hold and reclaim the memory for the allocated 
Instruction instances.  Instead we could pass around a smart pointer.  But that's
a separate discussion/patch.

Reviewers: andreadb, courbet, RKSimon

Reviewed By: andreadb

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

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

llvm-svn: 331660
2018-05-07 18:29:15 +00:00
Clement Courbet
ad35ed3ca7 Re-land r331622 "[llvm-exegesis] Add a library to cluster benchmark results."
Add missing move.

llvm-svn: 331624
2018-05-07 09:09:48 +00:00
Clement Courbet
f3e4460ec8 Revert r331622 "[llvm-exegesis] Add a library to cluster benchmark results."
Breaks build over llvm::Error copy construction.

llvm-svn: 331623
2018-05-07 08:30:18 +00:00
Clement Courbet
db7680fb4d [llvm-exegesis] Add a library to cluster benchmark results.
Reviewers: gchatelet

Subscribers: mgorny, tschuett, llvm-commits

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

llvm-svn: 331622
2018-05-07 08:20:00 +00:00
Fangrui Song
d77cc13cee [llvm-dwp] Define InitLLVM.
llvm-svn: 331610
2018-05-06 23:08:29 +00:00
Andrea Di Biagio
c6d4a11d75 [llvm-mca] removes flag -instruction-tables from the "View Options" category.
This patch also improves the description of a couple of flags in the view
options. With this change, the -help now specifies which views are enabled by
default.

llvm-svn: 331594
2018-05-05 15:36:47 +00:00
Andrea Di Biagio
bf53c91505 [llvm-mca] minor tweak to the resource pressure printing functionality. NFC.
llvm-svn: 331590
2018-05-05 12:21:54 +00:00
Teresa Johnson
af76bb65e2 [LTO] Allow pass remarks with hotness to be set when emitting to stderr
Summary:
Set setDiagnosticsHotnessRequested before the early exit check for a
diagnostic output file, so that pass remarks with hotness works when
emitting pass remarks to stderr (e.g. via -pass-remarks=.).

Also fix the llvm-lto2 diagnistic handler so that it only calls exit(1)
when the diagnistic is an error type. Otherwise the new test invocation
of llvm-lto2 with -pass-remarks causes it to fail. The new code is
consistent with the diagnostic handler elsewhere (e.g. on the
LLVMContext).

Reviewers: pcc, davide

Subscribers: fhahn, mehdi_amini, llvm-commits, inglorion

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

llvm-svn: 331569
2018-05-04 23:59:34 +00:00
Davide Italiano
efd3cd4d48 [llvm-mc-assemble-fuzzer] Catch up with API changes.
llvm-svn: 331568
2018-05-04 23:41:25 +00:00
Matt Davis
1b4230edab [llvm-mca] Add descriptive names for the TimelineView report characters. NFC.
Summary:
This change makes the TimelineView source simpler to read and easier to modify in the future.
This patch introduces a class of static chars used as the display values in the TimelineView report, this change just eliminates a few magic characters.

Reviewers: andreadb, courbet, RKSimon

Reviewed By: andreadb

Subscribers: tschuett, gbedwell, llvm-commits

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

llvm-svn: 331540
2018-05-04 17:19:40 +00:00
Peter Collingbourne
96cacec873 obj2yaml: Correctly round-trip default alignment.
Previously we were emitting the "cooked" alignment, which made it hard
to distinguish between that and the default alignment.

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

llvm-svn: 331537
2018-05-04 16:28:41 +00:00
Andrea Di Biagio
62309fcfae [llvm-mca] use colors for warnings and notes generated by InstrBuilder.
llvm-svn: 331517
2018-05-04 13:52:12 +00:00
Andrea Di Biagio
433c861c97 [llvm-mca] remove unused argument from method InstrBuilder::createInstrDescImpl.
We don't need to pass the instruction index to the method that constructs new
instruction descriptors.

No functional change intended.

llvm-svn: 331516
2018-05-04 13:10:10 +00:00
Nico Weber
56d8831d29 use LLVM's standard CMakeLists.txt layout for llvm-xray
llvm-svn: 331455
2018-05-03 14:25:57 +00:00
Martin Storsjo
214c7bcdc6 [llvm-rc] Default to writing the output next to the input, if no output is specified
This matches what rc.exe does if no output is specified.

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

llvm-svn: 331403
2018-05-02 21:15:24 +00:00
Martin Storsjo
cb354baeb1 [llvm-cvtres] Allow parameters preceded by '-' in addition to '/'
The real cvtres.exe also allows parameters in either form.

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

llvm-svn: 331402
2018-05-02 21:15:13 +00:00
Paul Semel
de5f098777 [llvm-objcopy] Add --discard-all (-x) option
llvm-svn: 331400
2018-05-02 20:19:22 +00:00
Paul Semel
9070f9fa91 [llvm-objcopy] Add --weaken option
llvm-svn: 331397
2018-05-02 20:14:49 +00:00
Martin Storsjo
6a5bc398fd [llvm-rc] Add rudimentary support for codepages
Only support UTF-8 (since LLVM contains UTF-8 parsing support
already, and the code even does that already) and Windows-1252
(where most code points has the same value in unicode). Keep the
existing default as only allowing ASCII input.

Using the option type JoinedOrSeparate, since the real rc.exe
handles options in this form, even if llvm-rc uses Separate for
other similar existing options.

Rename the struct SearchParams to WriterParams since it's now used
for more than just include paths.

Add a missing getResourceTypeName method to the BundleResource class,
to fix error printing from within STRINGTABLE resources (used in
tests).

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

llvm-svn: 331391
2018-05-02 19:43:44 +00:00
Dean Michael Berris
8b106b1ae1 [XRay][tools] Rename llvm-xray filenames from .cc -> .cpp (NFC)
Summary:
This brings the filenames in accordance to the style guide and LLVM
conventions for C++ filenames.

As suggested by rnk@ in D46068.

Reviewers: rnk

Subscribers: mgorny, mgrang, llvm-commits

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

llvm-svn: 331321
2018-05-02 00:43:17 +00:00
Matt Davis
d3d52a368f [llvm-mca] Lift the logic of the RetireControlUnit from the Dispatch translation unit into its own translation unit. NFC
The logic remains the same.  Eventually, I see the RCU acting as its own separate stage in the instruction pipeline.

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

llvm-svn: 331316
2018-05-01 23:04:01 +00:00
Sam Clegg
392c7111ea [WebAssembly] llvm-readobj: display symbols names in relocations
Differential Revision: https://reviews.llvm.org/D46296

llvm-svn: 331279
2018-05-01 16:35:16 +00:00
Adrian Prantl
0489ce9303 Remove @brief commands from doxygen comments, too.
This is a follow-up to r331272.

We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by
  for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done

https://reviews.llvm.org/D46290

llvm-svn: 331275
2018-05-01 16:10:38 +00:00
Adrian Prantl
076a6683eb Remove \brief commands from doxygen comments.
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

  for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done

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

llvm-svn: 331272
2018-05-01 15:54:18 +00:00
Nirav Dave
05e219cb7a [MC] Change AsmParser to leverage Assembler during evaluation
Teach AsmParser to check with Assembler for when evaluating constant
expressions.  This improves the handing of preprocessor expressions
that must be resolved at parse time. This idiom can be found as
assembling-time assertion checks in source-level assemblers. Note that
this relies on the MCStreamer to keep sufficient tabs on Section /
Fragment information which the MCAsmStreamer does not. As a result the
textual output may fail where the equivalent object generation would
pass. This can most easily be resolved by folding the MCAsmStreamer
and MCObjectStreamer together which is planned for in a separate
patch.

Currently, this feature is only enabled for assembly input, keeping IR
compilation consistent between assembly and object generation.

Reviewers: echristo, rnk, probinson, espindola, peter.smith

Reviewed By: peter.smith

Subscribers: eraman, peter.smith, arichardson, jyknight, hiraditya, llvm-commits

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

llvm-svn: 331218
2018-04-30 19:22:40 +00:00
Matt Arsenault
23fa05864d AMDGPU: Add Vega12 and Vega20
Changes by
  Matt Arsenault
  Konstantin Zhuravlyov

llvm-svn: 331215
2018-04-30 19:08:16 +00:00