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

11427 Commits

Author SHA1 Message Date
diggerlin
313f23df6f [NFC] Refactor the tuple of symbol information with structure for llvm-objdump
SUMMARY:

address  the comment of
https://reviews.llvm.org/D74240#inline-676127
https://reviews.llvm.org/D74240#inline-675875

Reviewers: daltenty, jason liu, xiangling liao
Subscribers: wuzish, nemanjai, hiraditya

Differential Revision: https://reviews.llvm.org/D74240
2020-02-11 14:41:24 -05:00
Justin Lebar
b77224b68f Use C++14-style return type deduction in LLVM.
Summary:
Simplifies the C++11-style "-> decltype(...)" return-type deduction.

Note that you have to be careful about whether the function return type
is `auto` or `decltype(auto)`.  The difference is that bare `auto`
strips const and reference, just like lambda return type deduction.  In
some cases that's what we want (or more likely, we know that the return
type is a value type), but whenever we're wrapping a templated function
which might return a reference, we need to be sure that the return type
is decltype(auto).

No functional change.

Subscribers: dexonsmith, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D74383
2020-02-11 07:38:42 -08:00
diggerlin
163f13ebd8 [NFC] Refactor the tuple of symbol information with structure for llvm-objdump
SUMMARY:

refator the std::tuple<uint64_t, StringRef, uint8_t> to structor

Reviewers: daltenty
Subscribers: wuzish, nemanjai, hiraditya

Differential Revision: https://reviews.llvm.org/D74240
2020-02-10 19:23:01 -05:00
Eric Christopher
ee4be934c0 Continue removing llgo. 2020-02-10 10:33:58 -08:00
Bill Wendling
0816222e8f Revert "Remove redundant "std::move"s in return statements"
The build failed with

  error: call to deleted constructor of 'llvm::Error'

errors.

This reverts commit 1c2241a7936bf85aa68aef94bd40c3ba77d8ddf2.
2020-02-10 07:07:40 -08:00
Bill Wendling
e45b5f33f3 Remove redundant "std::move"s in return statements 2020-02-10 06:39:44 -08:00
Georgii Rymar
c925ef3eed [llvm-readobj] - Change the error to warning when a section name is unknown.
We reported the error in this case.
But it was asked (https://reviews.llvm.org/D73193#inline-665595) to convert it
to a warning. This patch does it.

Differential revision: https://reviews.llvm.org/D74047
2020-02-10 16:01:30 +03:00
Djordje Todorovic
a79d241e28 [llvm-dwarfdump][Stats] Fix the License header
Fix the added License.

Differential Revision: https://reviews.llvm.org/D74207
2020-02-10 08:01:56 +01:00
Fangrui Song
db8bcae104 [DebugInfo] Add a DWARFDataExtractor constructor that takes ArrayRef<uint8_t>
Similar to D67797 (DataExtractor).
2020-02-09 17:45:32 -08:00
Fangrui Song
27590c1065 [dsymutil] Delete unneeded parameter Triple from DWARFLinker
Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D74173
2020-02-07 11:33:27 -08:00
Fangrui Song
fa095ee785 [yaml2obj] Add -D k=v to preprocess the input YAML
Examples:

```
yaml2obj -D MACHINE=EM_386 a.yaml -o a.o
yaml2obj -D MACHINE=0x1234 a.yaml -o a.o
```

where a.yaml contains:

```
--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2MSB
  Type:    ET_REL
  Machine: [[MACHINE]]
```

Reviewed By: grimar, jhenderson

Differential Revision: https://reviews.llvm.org/D73821
2020-02-07 09:35:00 -08:00
Miloš Stojanović
da93b53e65 [llvm-exegesis] Improve error reporting in BenchmarkRunner.cpp
Followup to D74085.
Replace the use of `report_fatal_error()` with returning the error to
`llvm-exegesis.cpp` and handling it there.
To facilitate this, a new `Error` type has been added which is only used
to log errors to the yaml output.

Differential Revision: https://reviews.llvm.org/D74215
2020-02-07 16:29:52 +01:00
Miloš Stojanović
8cfb3ffff7 Recommit: "[llvm-exegesis] Improve error reporting in Target.cpp"
Summary: Commit 141915963b6ab36ee4e577d1b27673fa4d05b409 was reverted in
abe01e17f648a97666d4fbed41f0861686a17972 because it broke builds testing
without libpfm. A preparatory commit <commit_sha1> was added to enable
this recommit.

Original commit message:

Followup to D74085.
Replace the use of `report_fatal_error()` with returning the error to
`llvm-exegesis.cpp` and handling it there.

Differential Revision: https://reviews.llvm.org/D74113
2020-02-07 14:34:58 +01:00
Miloš Stojanović
3b99feae59 Recommit: "[llvm-exegesis] Improve error reporting"
Summary: Commit b3576f60ebc8f660afad8120a72473be47517573 was reverted in
abe01e17f648a97666d4fbed41f0861686a17972 because it broke builds testing
without libpfm. A preparatory commit <commit_sha1> was added to enable
this recommit.

Original commit message:

Fix inconsistencies in error reporting created by mixing
`report_fatal_error()` and `ExitOnErr()`, and add additional information
to the error message to make it more user friendly. Minimize the use
`report_fatal_error()` because it's meant for use in very rare cases and
it results in low information density of the error messages.

Summary of the new design:

 * For command line argument errors output `llvm-exegesis: <error_message>`,
   which is consistent with the error output format emitted by the backend
   which checks correctness of the command line arguments.
 * For other errors the format `llvm-exegesis error: <error_message>` is used.
 ** If the error occurred during file access `<error_message>` will have
    of two parts: `'<file_name>': <rest_of_the_error_message>`

Differential Revision: https://reviews.llvm.org/D74085
2020-02-07 14:34:58 +01:00
Miloš Stojanović
f2ef1f01c4 [llvm-exegesis] Add a custom error for clustering
All errors of type `Failure` are `StringError`s. In order for exit code
mapping to detect that specifically a clustering error has occurred it
needs to have a different type.

This patch also prepares D74085 where termination `report_fatal_error()`
will be replaced with emitting `StringError`s.

Differential Revision: https://reviews.llvm.org/D74124
2020-02-07 14:34:57 +01:00
Djordje Todorovic
629577eaed [llvm-dwarfdump][Stats] Add the license header
Add the License header into the Statistics.cpp.

Differential Revision: https://reviews.llvm.org/D74207
2020-02-07 12:37:32 +01:00
Hans Wennborg
0e3aace88b Revert "[llvm-exegesis] Improve error reporting" and follow-up.
It broke e.g. all tests under tools/llvm-exegesis/X86/ when libpfm is
not available, see comment on D74085.

This reverts commit b3576f60ebc8f660afad8120a72473be47517573 and
141915963b6ab36ee4e577d1b27673fa4d05b409.
2020-02-06 12:53:16 +01:00
Miloš Stojanović
1896e03d2c [llvm-exegesis] Improve error reporting in Target.cpp
Followup to D74085.
Replace the use of `report_fatal_error()` with returning the error to
`llvm-exegesis.cpp` and handling it there.

Differential Revision: https://reviews.llvm.org/D74113
2020-02-06 12:26:08 +01:00
Miloš Stojanović
c02e81a2ad [llvm-exegesis] Improve error reporting
Fix inconsistencies in error reporting created by mixing
`report_fatal_error()` and `ExitOnErr()`, and add additional information
to the error message to make it more user friendly. Minimize the use
`report_fatal_error()` because it's meant for use in very rare cases and
it results in low information density of the error messages.

Summary of the new design:

 * For command line argument errors output `llvm-exegesis: <error_message>`,
   which is consistent with the error output format emitted by the backend
   which checks correctness of the command line arguments.
 * For other errors the format `llvm-exegesis error: <error_message>` is used.
 ** If the error occurred during file access `<error_message>` will have
    of two parts: `'<file_name>': <rest_of_the_error_message>`

Differential Revision: https://reviews.llvm.org/D74085
2020-02-06 12:26:08 +01:00
Fangrui Song
18c1f9730e [yaml2obj] Refactor command line parsing
* Hide unrelated options.
* Add "OVERVIEW: " to yaml2obj -h/--help.
* Place options under a yaml2obj category.
* Disallow -docnum. Currently -docnum is the only yaml2obj specific long option that is affected.
* Specify `cl::init("-")` and `cl::Prefix` for OutputFilename. The
  latter allows `-ofile`

Reviewed By: grimar, jhenderson

Differential Revision: https://reviews.llvm.org/D73982
2020-02-06 01:11:58 -08:00
Nico Weber
878db5393d Revert "[llvm-reduce] add ReduceAttribute delta pass"
This reverts commit fc62b36a000681c01e993242b583c5ec4ab48a3c.
Breaks tests on mac: http://45.33.8.238/mac/7301/step_11.txt
2020-02-05 14:15:11 -05:00
Nick Desaulniers
686a91a786 [llvm-reduce] add ReduceAttribute delta pass
Summary:
The output from llvm-reduce still has significantly more attributes than
bugpoint does.  Teach llvm-reduce to remove attributes.

Reviewers: diegotf, dblaikie, george.burgess.iv

Subscribers: mgorny, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D73853
2020-02-05 10:05:25 -08:00
Martin Storsjö
d6b7a01674 [CMake] Add missing component dependencies, to fix building for mingw with BUILD_SHARED_LIBS
Differential Revision: https://reviews.llvm.org/D73840
2020-02-05 13:10:27 +02:00
Georgii Rymar
38ad9710a6 [yaml2obj][obj2yaml] - Simplify format of the SHT_LLVM_ADDRSIG section.
Previously the description allowed to describe symbols with use of
`Name` and `Index` keys. This patch removes them and now it is still
possible to use either names or symbol indexes, but the code is simpler
and the format is slightly different.

Such a change will be useful for another patches, e.g:
https://reviews.llvm.org/D73788#inline-671077

Differential revision: https://reviews.llvm.org/D73888
2020-02-05 12:33:14 +03:00
Francis Visoiu Mistrih
57aee84cb1 [Remarks] Extend the RemarkStreamer to support other emitters
This extends the RemarkStreamer to allow for other emitters (e.g.
frontends, SIL, etc.) to emit remarks through a common interface.

See changes in llvm/docs/Remarks.rst for motivation and design choices.

Differential Revision: https://reviews.llvm.org/D73676
2020-02-04 17:16:02 -08:00
Simon Pilgrim
8bb306d76b Fix "expression is redundant [misc-redundant-expression]" warning (PR44768)
Be more specific that getOperandConstraint should return -1 or a uint8_t value
2020-02-04 21:24:21 +00:00
Georgii Rymar
e82624ffe2 [yaml2obj/obj2yaml] - Add support for the SHT_LLVM_CALL_GRAPH_PROFILE section.
This is a LLVM specific section that is well described here:
https://llvm.org/docs/Extensions.html#sht-llvm-call-graph-profile-section-call-graph-profile

This patch teaches yaml2obj and obj2yaml about how to work with it.

Differential revision: https://reviews.llvm.org/D73788
2020-02-04 15:13:20 +03:00
Michael Trent
7d03550470 Omit "Contents of" headers when -no-leading-headers is specified.
Summary:
llvm-objdump -macho will no longer print "Contents of" headers when
disassembling section contents when -no-leading-headers is specified.
For historical reasons, this flag is independent of -no-leading-addr.

Reviewers: ab, pete, jhenderson

Reviewed By: jhenderson

Subscribers: rupprecht, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D73574
2020-02-03 13:33:50 -08:00
Michael Trent
cd0c8f255c [llvm-objdump] Suppress spurious warnings when parsing Mach-O binaries.
Summary:
llvm-objdump started warning when asked to disassemble a section that
isn't present in the input files, in Yuanfang Chen's change:
d16c162c9453db855503134fe29ae4a3c0bec936. The problem is that the
logic was restricted only to the generic llvm-objdump parser, not to the
Mach-O-specific parser used for Apple toolchain compatibility. The
solution is to log section names from the Mach-O parser.

The macho-cstring-dump.test has been updated to fail if it encounters
this new warning in the future.

Reviewers: pete, ab, lhames, jhenderson, grimar, MaskRay, ychen

Reviewed By: jhenderson, grimar

Subscribers: rupprecht, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D73586
2020-02-03 10:59:36 -08:00
Clement Courbet
66d7e6fd7f [llvm-exegesis] Restrict the range of allowable rounding countrols.
Summary:
It turns out that CUR_DIRECTION is just an internal placeholder, not an actual
valid encoded value.

Reviewers: gchatelet

Subscribers: tschuett, mstojanovic, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D73343
2020-02-03 11:53:27 +01:00
Juneyoung Lee
92f700c60b [llvm-extract] Add -keep-const-init commandline option
Summary:
This adds -keep-const-init option to llvm-extract which preserves initializers of
used global constants.

For example:

```
$ cat a.ll
@g = constant i32 0
define i32 @f() {
  %v = load i32, i32* @g
  ret i32 %v
}

$ llvm-extract --func=f a.ll -S -o -
@g = external constant i32
define i32 @f() { .. }

$ llvm-extract --func=f a.ll -keep-const-init -S -o -
@g = constant i32 0
define i32 @f() { .. }
```

This option is useful in checking whether a function that uses a constant global is optimized correctly.

Reviewers: jsji, MaskRay, david2050

Reviewed By: MaskRay

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D73833
2020-02-03 14:30:28 +09:00
Fangrui Song
c80991b884 [yaml2obj] Internlize DocNum. NFC 2020-01-31 10:11:42 -08:00
Sjoerd Meijer
e961032e7d [llvm-objdump] avoid crash disassembling unknown instruction
Disassembly of instructions can fail when llvm-objdump is not given the right set of
architecture features, for example when the source is compiled with:

  clang -march=..+ext1+ext2

and disassembly is attempted with:

  llvm-objdump -mattr=+ext1

This patch avoids further analysing unknown instructions (as was happening
before) when disassembly has failed.

Differential Revision: https://reviews.llvm.org/D73531
2020-01-31 12:41:31 +00:00
Georgii Rymar
d3e0d6fc26 [llvm-readobj] - Don't crash when dumping invalid dynamic relocation.
Currently when we dump dynamic relocation with use of
DT_RELA/DT_RELASZ/DT_RELAENT tags, we crash when a symbol index
is larger than the number of dynamic symbols or
when there is no dynamic symbol table.

This patch adds test cases and fixes the issues.

Differential revision: https://reviews.llvm.org/D73560
2020-01-31 13:20:51 +03:00
Georgii Rymar
ca9e0184f9 [llvm-readobj] - Improve error message reported by DynRegionInfo.
DynRegionInfo is a helper class used to create memory ranges.
It is used for many things and can report errors.
Errors reported currently do not provide a good diagnostic.
This patch fixes it and adds a test for each possible case.

Differential revision: https://reviews.llvm.org/D73484
2020-01-30 14:34:20 +03:00
Georgii Rymar
565ea1f255 [llvm-readobj] - Add a few warnings for --gnu-hash-table.
The current implementation stops dumping in case of a single error
it handles, though we can continue dumping.
This patch refines it: it adds a few warnings and a few test cases.

Differential revision: https://reviews.llvm.org/D73269
2020-01-30 14:02:24 +03:00
Francesco Petrogalli
308e2db83d [llvm][VectorUtils] Tweak VFShape for scalable vector functions.
Summary:
This patch makes sure that the field VFShape.VF is greater than zero
when demangling the vector function name of scalable vector functions
encoded in the "vector-function-abi-variant" attribute.

This change is required to be able to provide instances of VFShape
that can be used to query the VFDatabase for the vectorization passes,
as such passes always require a positive value for the Vectorization Factor (VF)
needed by the vectorization process.

It is not possible to extract the value of VFShape.VF from the mangled
name of scalable vector functions, because it is encoded as
`x`. Therefore, the VFABI demangling function has been modified to
extract such information from the IR declaration of the vector
function, under the assumption that _all_ vectors in the signature of
the vector function have the same number of lanes. Such assumption is
valid because it is also assumed by the Vector Function ABI
specifications supported by the demangling function (x86, AArch64, and
LLVM internal one).

The unit tests that demangle scalable names have been modified by
adding the IR module that carries the declaration of the vector
function name being demangled.

In particular, the demangling function fails in the following cases:

1. When the declaration of the scalable vector function is not
    present in the module.

2. When the value of VFSHape.VF is not greater than 0.

Reviewers: jdoerfert, sdesmalen, andwar

Reviewed By: jdoerfert

Subscribers: mgorny, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D73286
2020-01-30 05:53:56 +00:00
Jonas Devlieghere
83ccf6171a [llvm] Replace SmallStr.str().str() with std::string conversion operator.
Use the std::string conversion operator introduced in
d7049213d0fcda691c9e79f9b41e357198d99738.
2020-01-29 21:16:46 -08:00
Derek Schuff
c56ad696b7 [llvm-objcopy] Initial support for wasm in llvm-objcopy
Currently only supports simple copying, other operations to follow.

Reviewers: sbc100, alexshap, jhenderson

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

This is a reland of a928d127a with a one-line fix to ensure that
the wasm version number is written as little-endian (it's the only
field in all of the binary format that's not a single byte or an
LEB, but we may have to watch out more when we start handling the
linking section).
2020-01-29 17:32:02 -08:00
Yuanfang Chen
0403252429 [opt viewer] Python compat - decode/encode string
Summary:
Use io.open instead of codecs.open according to here
https://stackoverflow.com/questions/10971033/backporting-python-3-openencoding-utf-8-to-python-2

Add `u` prefix to string literal to make them utf-8 in python2.

Reviewers: anemet, serge-sans-paille

Reviewed by: serge-sans-paille

Differential Revision: https://reviews.llvm.org/D73011
2020-01-29 14:49:24 -08:00
Derek Schuff
73b106d5b6 Revert "[llvm-objcopy] Initial support for wasm in llvm-objcopy"
This reverts commit a928d127a52a061733d2e42c4c9159a267f7dbd4.

It seems to cause issues with big-endian architectures.
2020-01-29 13:12:56 -08:00
Benjamin Kramer
c0bcd6fe73 One more bugpoitn fix for GCC5 2020-01-29 03:42:02 +01:00
Benjamin Kramer
9bf5dbee1c Try harder to fix bugpoint with GCC5 2020-01-29 03:30:47 +01:00
Benjamin Kramer
2d00d6fd92 Make bugpoint work with gcc5 again. 2020-01-29 03:11:00 +01:00
Benjamin Kramer
915a3355f8 Fix more implicit conversions. Getting closer to having clang working with gcc 5 again 2020-01-29 02:57:59 +01:00
Benjamin Kramer
9b427c8e8d Another stab at making the gold plugin compile again 2020-01-29 02:12:53 +01:00
Benjamin Kramer
3e6e191872 Fix one round of implicit conversions found by g++5. 2020-01-29 01:52:48 +01:00
Jonas Devlieghere
c3e5ca8b31 Fix more implicit conversions 2020-01-28 15:19:27 -08:00
Benjamin Kramer
87d13166c7 Make llvm::StringRef to std::string conversions explicit.
This is how it should've been and brings it more in line with
std::string_view. There should be no functional change here.

This is mostly mechanical from a custom clang-tidy check, with a lot of
manual fixups. It uncovers a lot of minor inefficiencies.

This doesn't actually modify StringRef yet, I'll do that in a follow-up.
2020-01-28 23:25:25 +01:00
Kristina Bessonova
561ebf7f17 [llvm-dwarfdump][Statistics] Make calculations of vars in global scope more accurate
It isn't known how many times we've seen the same variable or member in
the global scope (unlike in functions), but there still can be some duplicates
among different CUs.
So, this patch proposes to count variables in the global scope just as a sum of
the number of vars, constant members and artificial entities.

Reviewed by: aprantl

Differential Revision: https://reviews.llvm.org/D73004
2020-01-28 20:52:20 +02:00