Commit Graph

6771 Commits

Author SHA1 Message Date
Valery Pykhtin
393a60e73a fix r265645: target dependent printf formatting flags.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265649 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 08:38:20 +00:00
Valery Pykhtin
514b0038dd [AMDGPU] llvm-objdump: Minimal HSA Code Object disassembler support.
Reenable reverted r265550 with endianness issue fixed. Variables of
endian-aware types such as ulittle32_t should be explicitly casted
to their natural equivalent types before passing it as vararg to
printf like functions (format in my case). Added lit config file
depending on AMDGPU target as the testcase uses assembler.

Differential revision: http://reviews.llvm.org/D16998

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265645 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 07:24:01 +00:00
Amaury Sechet
e31b14487a Do some refactoring in the LLVM C API echo test to remove duplication. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265641 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 05:56:20 +00:00
Peter Zotov
2a41371ff7 [llvm-c] Add LLVMGetValueKind.
Patch by Nicole Mazzuca <npmazzuca@gmail.com>.

Differential Revision: http://reviews.llvm.org/D18729

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265608 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 22:21:29 +00:00
Kevin Enderby
c6bf9be16d Thread Expected<...> up from createMachOObjectFile() to allow llvm-objdump to produce a real error message
Produce the first specific error message for a malformed Mach-O file describing
the problem instead of the generic message for object_error::parse_failed of
"Invalid data was encountered while parsing the file”.  Many more good error
messages will follow after this first one.

This is built on Lang Hames’ great work of adding the ’Error' class for
structured error handling and threading Error through MachOObjectFile
construction.  And making createMachOObjectFile return Expected<...> .

So to to get the error to the llvm-obdump tool, I changed the stack of
these methods to also return Expected<...> :

  object::ObjectFile::createObjectFile()
  object::SymbolicFile::createSymbolicFile()
  object::createBinary()

Then finally in ParseInputMachO() in MachODump.cpp the error can
be reported and the specific error message can be printed in llvm-objdump
and can be seen in the existing test case for the existing malformed binary
but with the updated error message.

Converting these interfaces to Expected<> from ErrorOr<> does involve
touching a number of places. To contain the changes for now use of
errorToErrorCode() and errorOrToExpected() are used where the callers
are yet to be converted.

Also there some were bugs in the existing code that did not deal with the
old ErrorOr<> return values.  So now with Expected<> since they must be
checked and the error handled, I added a TODO and a comment:
“// TODO: Actually report errors helpfully” and a call something like
consumeError(ObjOrErr.takeError()) so the buggy code will not crash
since needed to deal with the Error.

Note there is one fix also needed to lld/COFF/InputFiles.cpp that goes along
with this that I will commit right after this.  So expect lld not to built
after this commit and before the next one.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265606 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 22:14:09 +00:00
Evgeniy Stepanov
d8c5d5c30e [gold] Save bitcode for module partitions (save-temps + split codegen).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265583 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 18:32:13 +00:00
Valery Pykhtin
8950a8d2f9 Revert "[AMDGPU] llvm-objdump: Minimal HSA Code Object disassembler support."
This reverts commit r265550. There're problems with endianness on dumping instruction bytes. Need to find out how to use support::ulittle32_t type properly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265554 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 16:30:21 +00:00
Valery Pykhtin
496db86011 [AMDGPU] llvm-objdump: Minimal HSA Code Object disassembler support.
Differential revision: http://reviews.llvm.org/D16998

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265550 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 15:55:10 +00:00
Duncan P. N. Exon Smith
2707ee3256 Revert "Fix Clang-tidy modernize-deprecated-headers warnings in remaining files; other minor fixes."
This reverts commit r265454 since it broke the build.  E.g.:

  http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/22413/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265459 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 20:45:04 +00:00
David Blaikie
46c3acf600 llvm-dwp: Handle GCC's use of multiple debug_types.dwo sections in a single .dwo file
(also includes the .test file missing from my previous commit, r265452)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265457 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 20:26:50 +00:00
Eugene Zelenko
9a7a3bcf29 Fix Clang-tidy modernize-deprecated-headers warnings in remaining files; other minor fixes.
Some Include What You Use suggestions were used too.

Use anonymous namespaces in source files.

Differential revision: http://reviews.llvm.org/D18778


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265454 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 20:19:49 +00:00
David Blaikie
fe34a372e1 llvm-dwp: Handle dwo files produced by GCC
To start with, handle DW_FORM_string names. Follow up commit will handle
the interesting quirk with type units I was originally aiming for here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265452 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 20:16:38 +00:00
Lang Hames
cb6a5650f3 [llvm-rtdyld] Fix the return type on ErrorAndExit.
As suggested by Rafael - this function no longer returns a value as of r264425.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265451 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 20:11:24 +00:00
David Blaikie
037ba978f5 llvm-dwp: Simplify hashing code a bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265426 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 17:51:40 +00:00
Rafael Espindola
00d9a04525 Use ArrayRef for contiguous areas in ELF. NFC.
This just simplifies the code a bit. More so in lld.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265403 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 14:47:22 +00:00
Peter Zotov
2b8aed70d6 [llvm-c] Expose LLVM{Get,Set}ModuleIdentifier
Patch by Nicole Mazzuca <npmazzuca@gmail.com>.

Differential Revision: http://reviews.llvm.org/D18736

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265394 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 13:56:59 +00:00
Teresa Johnson
ee68481a50 Clean up calls to WriteBitcodeToFile (NFC)
Remove a default parameter value being passed unnecessarily, which
also reduces the changes required when this parameter is changed in
D18763.

Document the remaining non-default bool value passed for another
parameter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265348 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-04 21:19:31 +00:00
Teresa Johnson
566a35a121 clang-format llvm-as.cpp (NFC)
This reduces unrelated changes in other patches (such as D18763) when
changes to this file are clang formatted.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265346 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-04 21:06:17 +00:00
Duncan P. N. Exon Smith
eeb2c7e32c ValueMapper: Add support for seeding metadata with nullptr
Support seeding a ValueMap with nullptr for Metadata entries, a
situation I didn't consider in the Metadata/Value split.

I added a ValueMapper::getMappedMD accessor that returns an
Optional<Metadata*> with the mapped (possibly null) metadata.  IRMover
needs to use this to avoid modifying the map when it's checking for
unneeded subprograms.  I updated a call from bugpoint since I find the
new code clearer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265228 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-02 17:04:38 +00:00
Mehdi Amini
51f5548e2a Add a libLTO API to stop/restart ThinLTO between optimizations and CodeGen
This allows the linker to instruct ThinLTO to perform only the
optimization part or only the codegen part of the process.

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265113 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-01 06:47:02 +00:00
Mehdi Amini
d2f4701e4a Add a module Hash in the bitcode and the combined index, implementing a kind of "build-id"
This is intended to be used for ThinLTO incremental build.

Differential Revision: http://reviews.llvm.org/D18213

This is a recommit of r265095 after fixing the Windows issues.

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265111 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-01 05:33:11 +00:00
Mehdi Amini
d4b1021e3e Fix MSVC warning "comparison of integers of different signs" (NFC)
From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265110 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-01 05:19:14 +00:00
Mehdi Amini
1fc660ff51 Revert "Add support for computing SHA1 in LLVM"
This reverts commit r265096, r265095, and r265094.
Windows build is broken, and the validation does not pass.

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265102 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-01 03:03:21 +00:00
Mehdi Amini
515396cd38 Add a module Hash in the bitcode and the combined index, implementing a kind of "build-id"
This is intended to be used for ThinLTO incremental build.

Differential Revision: http://reviews.llvm.org/D18213

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265095 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-01 01:30:06 +00:00
Aaron Ballman
59a288b05f Silencing warnings from MSVC 2015 Update 2. All of these changes silence "C4334 '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)". NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264929 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-30 21:30:00 +00:00
Marianne Mailhot-Sarrasin
d9529c5cae gold-plugin: Fixed typo in an error message.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264860 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-30 12:20:53 +00:00
Kevin Enderby
ae7cf58516 Fix some bugs in the posix output of llvm-nm. Which is documented on
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/nm.html .

1) For Mach-O files the code was not printing the values in hex as is the default.
2) The values printed had leading zeros which they should not have.
3) The address for undefined symbols was printed as spaces instead of 0.
4) With the -A option with posix output for an archive did not use square
brackets around the archive member name.

rdar://25311883 and rdar://25299678


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264778 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-29 20:18:07 +00:00
Hemant Kulkarni
7ef71aa221 [llvm-readobj] NFC: Remove unneeded parenthesis
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264731 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-29 14:20:20 +00:00
Hemant Kulkarni
d2695ae47b [llvm-readobj] Support GNU style dyn-relocations
http://reviews.llvm.org/D18534

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264693 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-29 02:41:49 +00:00
Evgeniy Stepanov
2b6ba77f19 Remove personality for declarations in CloneModule.
Personality is copied as part of copyFunctionAttributes, but it is
invalid on a declaration. Remove the personality attribute it the
function body is not cloned.

Also add a verifier run over output modules in the llvm-split tool.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264667 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-28 21:37:02 +00:00
Adrian Prantl
8d4b7e74e1 Add an IR Verifier check for orphaned DICompileUnits.
A DICompileUnit that is not listed in llvm.dbg.cu will cause assertion
failures and/or crashes in the backend. The Verifier should reject this.

rdar://problem/25369499

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264657 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-28 21:06:26 +00:00
Hemant Kulkarni
2de577cfbd [llvm-readobj] NFC Replace case by macros for PT_* enums
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264595 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-28 17:20:23 +00:00
Hemant Kulkarni
de009ecf70 [llvm-size] Implement --common option
Differential Revision: http://reviews.llvm.org/D16820

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264591 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-28 16:48:10 +00:00
Duncan P. N. Exon Smith
a73e509bf8 Reapply ~"Bitcode: Collect all MDString records into a single blob"
Spiritually reapply commit r264409 (reverted in r264410), albeit with a
bit of a redesign.

Firstly, avoid splitting the big blob into multiple chunks of strings.

r264409 imposed an arbitrary limit to avoid a massive allocation on the
shared 'Record' SmallVector.  The bug with that commit only reproduced
when there were more than "chunk-size" strings.  A test for this would
have been useless long-term, since we're liable to adjust the chunk-size
in the future.

Thus, eliminate the motivation for chunk-ing by storing the string sizes
in the blob.  Here's the layout:

    vbr6: # of strings
    vbr6: offset-to-blob
    blob:
       [vbr6]: string lengths
       [char]: concatenated strings

Secondly, make the output of llvm-bcanalyzer readable.

I noticed when debugging r264409 that llvm-bcanalyzer was outputting a
massive blob all in one line.  Past a small number, the strings were
impossible to split in my head, and the lines were way too long.  This
version adds support in llvm-bcanalyzer for pretty-printing.

    <STRINGS abbrevid=4 op0=3 op1=9/> num-strings = 3 {
      'abc'
      'def'
      'ghi'
    }

From the original commit:

Inspired by Mehdi's similar patch, http://reviews.llvm.org/D18342, this
should (a) slightly reduce bitcode size, since there is less record
overhead, and (b) greatly improve reading speed, since blobs are super
cheap to deserialize.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264551 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-27 23:17:54 +00:00
David Blaikie
3bcdc18cae llvm-dwp: Include the dwo name (if available) when diagnosing duplicate CU IDs from dwp input files
If you're building dwps from other dwps, it can be hard to track down a
duplicate CU ID if it comes from two compilations of the same file in
different modes, etc. By including the .dwo path (which is hopefully
more unique than the file path) it can help track down where the
duplicates came from.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264520 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-26 20:32:14 +00:00
Mehdi Amini
a324948f72 Rename ModuleSummaryIndex::modPathStringEntries() into modulePaths()
It now return the map instead of an iterator.

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264489 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-26 03:35:38 +00:00
Lang Hames
3e22297684 [Object] Start threading Error through MachOObjectFile construction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264425 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-25 17:25:34 +00:00
Hemant Kulkarni
f89f7a25a7 Fix Narrowing conversion warning introduced by r264415
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264419 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-25 16:37:03 +00:00
Hemant Kulkarni
7a9b28aa44 [llvm-readobj] Impl GNU style program headers print
readelf -lW

Differential Revision: http://reviews.llvm.org/D18372

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264415 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-25 16:04:48 +00:00
Duncan P. N. Exon Smith
d49b92d802 Revert "Bitcode: Collect all MDString records into a single blob"
This reverts commit r264409 since it failed to bootstrap:
http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_build/8302/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264410 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-25 15:22:27 +00:00
Duncan P. N. Exon Smith
d7084fcebd Bitcode: Collect all MDString records into a single blob
Optimize output of MDStrings in bitcode.  This emits them in big blocks
(currently 1024) in a pair of records:
  - BULK_STRING_SIZES: the sizes of the strings in the block, and
  - BULK_STRING_DATA: a single blob, which is the concatenation of all
    the strings.

Inspired by Mehdi's similar patch, http://reviews.llvm.org/D18342, this
should (a) slightly reduce bitcode size, since there is less record
overhead, and (b) greatly improve reading speed, since blobs are super
cheap to deserialize.

I needed to add support for blobs to streaming input to get the test
suite passing.
  - StreamingMemoryObject::getPointer reads ahead and returns the
    address of the blob.
  - To avoid a possible reallocation of StreamingMemoryObject::Bytes,
    BitstreamCursor::readRecord needs to move the call to JumpToEnd
    forward so that getPointer is the last bitstream operation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264409 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-25 14:40:18 +00:00
Duncan P. N. Exon Smith
f206a2c034 Bitcode: Stop using MODULE_CODE_METADATA_VALUES
The motivation for MODULE_CODE_METADATA_VALUES was to enable an
-flto=thin scheme where:

 1. First, one function is cherry-picked from a bitcode file.
 2. Later, another function is cherry-picked.
 3. Later, ...
 4. Finally, the metadata needed by all the previous functions is
    loaded.

This was abandoned in favour of:

 1. Calculate the superset of functions needed from a Module.
 2. Link all functions at once.

Delayed metadata reading no longer serves a purpose.  It also adds
a few complication, since we can't count on metadata being properly
parsed when exiting the BitcodeReader.  After discussing with Teresa, we
agreed to remove it.

The code that depended on this was removed/updated in r264326.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264378 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-25 01:29:50 +00:00
David Blaikie
dfb4013c58 llvm-dwp: Coalesce code for reading the CU's DW_AT_GNU_dwo_id and DW_AT_name
Going to be reading the DW_AT_GNU_dwo_name shortly as well, and there
was already enough duplication here that it was worth refactoring
rather than adding even more.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264350 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-24 22:17:08 +00:00
Mike Aizatsky
b5f62ceff2 [sancov] renaming statistics fields.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264349 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-24 21:49:55 +00:00
Mike Aizatsky
452d923857 [sancov] adding leading zeros to coverage pct.
Summary:
Using leading zeroes allows you to search for "000%" to find non-covered
items.

Differential Revision: http://reviews.llvm.org/D18420

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264336 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-24 20:41:18 +00:00
Teresa Johnson
e3c0e7f6cf [ThinLTO] Use bulk importing in llvm-link
Summary:
Use bulk importing so we can avoid the use of post-pass metadata
linking. Cloned the ModuleLazyLoaderCache from the FunctionImport pass
to facilitate this.

Reviewers: joker.eph

Subscribers: dexonsmith, llvm-commits, joker.eph

Differential Revision: http://reviews.llvm.org/D18455

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264326 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-24 19:52:20 +00:00
Simon Atanasyan
cc6b0d4dd4 [llvm-readobj] Decode st_other symbol's flags
The patch supports common STV_xxx visibility flags and MIPS specific
STO_MIPS_xxx flags.

Differential Revision: http://reviews.llvm.org/D18447

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264300 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-24 16:10:37 +00:00
James Molloy
66d1cd5130 [llvm-nm] Fix r264247
I committed the test changes successfully but managed to miss the actual code change! (lack of git -a)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264249 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-24 09:23:51 +00:00
Mike Aizatsky
9647ee51e2 [sancov] -print-coverage-stats option to print various coverage statistics.
Differential Revision: http://reviews.llvm.org/D18418

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264222 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-24 00:00:08 +00:00
Kevin Enderby
67e57feb4e Fix a cut-and-paste error in the changes for r264187 which I think is
the cause of the tools/llvm-objdump/X86/macho-symbolized-disassembly.test
crashing on linux.  Either way clearly incorrect code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264198 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-23 21:45:21 +00:00