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

29723 Commits

Author SHA1 Message Date
Greg Clayton
34f25a2606 Make a DWARF generator so we can unit test DWARF APIs with gtest.
The only tests we have for the DWARF parser are the tests that use llvm-dwarfdump and expect output from textual dumps.

More DWARF parser modification are coming in the next few weeks and I wanted to add tests that can verify that we can encode and decode all form types, as well as test some other basic DWARF APIs where we ask DIE objects for their children and siblings.

DwarfGenerator.cpp was added in the lib/CodeGen directory. This file contains the code necessary to easily create DWARF for tests:

dwarfgen::Generator DG;
Triple Triple("x86_64--");
bool success = DG.init(Triple, Version);
if (!success)
  return;
dwarfgen::CompileUnit &CU = DG.addCompileUnit();
dwarfgen::DIE CUDie = CU.getUnitDIE();

CUDie.addAttribute(DW_AT_name, DW_FORM_strp, "/tmp/main.c");
CUDie.addAttribute(DW_AT_language, DW_FORM_data2, DW_LANG_C);

dwarfgen::DIE SubprogramDie = CUDie.addChild(DW_TAG_subprogram);
SubprogramDie.addAttribute(DW_AT_name, DW_FORM_strp, "main");
SubprogramDie.addAttribute(DW_AT_low_pc, DW_FORM_addr, 0x1000U);
SubprogramDie.addAttribute(DW_AT_high_pc, DW_FORM_addr, 0x2000U);

dwarfgen::DIE IntDie = CUDie.addChild(DW_TAG_base_type);
IntDie.addAttribute(DW_AT_name, DW_FORM_strp, "int");
IntDie.addAttribute(DW_AT_encoding, DW_FORM_data1, DW_ATE_signed);
IntDie.addAttribute(DW_AT_byte_size, DW_FORM_data1, 4);

dwarfgen::DIE ArgcDie = SubprogramDie.addChild(DW_TAG_formal_parameter);
ArgcDie.addAttribute(DW_AT_name, DW_FORM_strp, "argc");
// ArgcDie.addAttribute(DW_AT_type, DW_FORM_ref4, IntDie);
ArgcDie.addAttribute(DW_AT_type, DW_FORM_ref_addr, IntDie);

StringRef FileBytes = DG.generate();
MemoryBufferRef FileBuffer(FileBytes, "dwarf");
auto Obj = object::ObjectFile::createObjectFile(FileBuffer);
EXPECT_TRUE((bool)Obj);
DWARFContextInMemory DwarfContext(*Obj.get());
This code is backed by the AsmPrinter code that emits DWARF for the actual compiler.

While adding unit tests it was discovered that DIEValue that used DIEEntry as their values had bugs where DW_FORM_ref1, DW_FORM_ref2, DW_FORM_ref8, and DW_FORM_ref_udata forms were not supported. These are all now supported. Added support for DW_FORM_string so we can emit inlined C strings.

Centralized the code to unique abbreviations into a new DIEAbbrevSet class and made both the dwarfgen::Generator and the llvm::DwarfFile classes use the new class.

Fixed comments in the llvm::DIE class so that the Offset is known to be the compile/type unit offset.

DIEInteger now supports more DW_FORM values.

There are also unit tests that cover:

Encoding and decoding all form types and values
Encoding and decoding all reference types (DW_FORM_ref1, DW_FORM_ref2, DW_FORM_ref4, DW_FORM_ref8, DW_FORM_ref_udata, DW_FORM_ref_addr) including cross compile unit references with that go forward one compile unit and backward on compile unit.

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

llvm-svn: 289010
2016-12-08 01:03:48 +00:00
Peter Collingbourne
d8b6e6119f LTO: Remove the unused Config::Features field.
We are currently initializing Features via MAttrs.

llvm-svn: 289007
2016-12-08 00:27:37 +00:00
Matthias Braun
ed9d5255b8 LivePhysReg: Use reference instead of pointer in init(); NFC
llvm-svn: 289002
2016-12-08 00:15:51 +00:00
Eugene Zelenko
0820a70f28 [ADT, IR] Fix some Clang-tidy modernize-use-equals-delete and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 288989
2016-12-07 22:06:02 +00:00
Davide Italiano
e638f91de2 [BDCE] Skip metadata while replacing uses.
The fix committed in r288851 doesn't cover all the cases.
In particular, if we have an instruction with side effects
which has a no non-dbg use not depending on the bits, we still
perform RAUW destroying the dbg.value's first argument.
Prevent metadata from being replaced here to avoid the issue.

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

llvm-svn: 288987
2016-12-07 21:47:32 +00:00
Tim Northover
cdda15523c GlobalISel: use correct builder for ConstantExprs.
ConstantExpr instances were emitting code into the current block rather than
the entry block. This meant they didn't necessarily dominate all uses, which is
clearly wrong.

llvm-svn: 288985
2016-12-07 21:29:15 +00:00
Chris Bieneman
816de2c0e8 [ObjectYAML] Pull DWARF support into DWARFYAML namespace
Since DWARF formatting is agnostic to the object file it is stored in, it doesn't make sense for this to be in the MachOYAML implementation. Pulling it into its own namespace means we could modify the ELF and COFF YAML tools to emit DWARF as well.

In a follow-up patch I will better abstract this in obj2yaml and yaml2obj so that the DWARF bits in the tools can be re-used too.

llvm-svn: 288984
2016-12-07 21:26:32 +00:00
Tim Northover
a947270b42 GlobalISel: store the current MachineFunction as direct state. NFC.
Having to ask the MIRBuilder for the current function is a little awkward, and
I'm intending to improve how that's threaded through anyway.

llvm-svn: 288983
2016-12-07 21:17:47 +00:00
Tim Northover
9cf8f9c151 GlobalISel: simplify MachineIRBuilder interface.
MachineIRBuilder had weird before/after and beginning/end flags for the insert
point. Unfortunately the non-default means that instructions will be inserted
in reverse order which is almost never what anyone wants.

Really, I think we just want (like IRBuilder has) the ability to insert at any
C++ iterator-style point (i.e. before any instruction or before MBB.end()). So
this fixes MIRBuilders to behave like IRBuilders in this respect.

llvm-svn: 288980
2016-12-07 21:05:38 +00:00
Chris Bieneman
98f9dd59fb [CMake] Add check for HAVE_CRASHREPORTER_INFO
This was also explicitly undef in CMake for some unknown reason.

Hopefully this one won't kill all the bots.

llvm-svn: 288977
2016-12-07 20:55:38 +00:00
Chris Bieneman
9d6cc61c6b Revert "[CMake] Use cmakedefine01 instead of cmakedefine"
This reverts commit r288959.

Apparently using cmakedefine01 explodes.

llvm-svn: 288961
2016-12-07 19:25:38 +00:00
Chris Bieneman
4b3fdbd311 [CMake] Use cmakedefine01 instead of cmakedefine
Looks like we need a 01 value for HAVE_CRASHREPORTERCLIENT_H.

llvm-svn: 288959
2016-12-07 19:13:32 +00:00
Chris Bieneman
636fc9decc [CMake] Add a check for HAVE_CRASHREPORTERCLIENT_H
The CMake build has been hardcoding this to undef forever, we shouldn't have been doing that.

llvm-svn: 288956
2016-12-07 18:53:04 +00:00
Chris Bieneman
144e4a2f00 [ObjectYAML] Support for DWARF __debug_abbrev section
This patch adds support for round-tripping DWARF debug abbreviations through the obj<->yaml tools.

llvm-svn: 288955
2016-12-07 18:52:59 +00:00
Chandler Carruth
793cb2eb5e [PM] Add some more logging to make it more clear when the CGSCC
infrastrucutre is skipping SCCs and RefSCCs.

llvm-svn: 288894
2016-12-07 10:33:15 +00:00
Tom Stellard
4f6c2a6b37 AMDGPU: Add llvm.amdgcn.interp.mov intrinsic
Reviewers: arsenm, nhaehnle

Subscribers: kzhuravl, wdng, yaxunl, tony-tye, llvm-commits

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

llvm-svn: 288865
2016-12-06 23:52:13 +00:00
Eugene Zelenko
94c0c35a1a [IR] Fix some Clang-tidy modernize-use-equals-delete and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 288853
2016-12-06 22:00:57 +00:00
Tim Northover
e51e65a279 GlobalISel: allow G_SELECT instructions for pointers.
llvm-svn: 288835
2016-12-06 18:38:34 +00:00
George Rimar
3a35f9da0b Removed trailing whitespaces. NFC.
llvm-svn: 288817
2016-12-06 15:40:02 +00:00
George Rimar
0f9a83f436 [Support/ELF] - Add OpenBSD PT_OPENBSD_BOOTDATA constant.
OpenBSD commit for reference:
d39116912b

llvm-svn: 288816
2016-12-06 15:38:15 +00:00
Simon Pilgrim
dd40c91cfb Fix MSVC -Wmicrosoft-enum-value 'enumerator value is not representable' warning
llvm-svn: 288798
2016-12-06 11:27:19 +00:00
Chris Bieneman
fd5462ba94 [ObjectYAML] First bit of support for encoding DWARF in MachO
This patch adds the starting support for encoding data from the MachO __DWARF segment. The first section supported is the __debug_str section because it is the simplest.

llvm-svn: 288774
2016-12-06 06:00:49 +00:00
Mandeep Singh Grang
62bc2fc3e6 [llvm] Fix D26214: Move error handling out of MC and to the callers.
Summary: Related clang patch; https://reviews.llvm.org/D27360

Reviewers: t.p.northover, grosbach, compnerd, echristo

Subscribers: compnerd, mehdi_amini, llvm-commits

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

llvm-svn: 288763
2016-12-06 02:49:17 +00:00
Mehdi Amini
a1faf78cda Introduces cmake option LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING
Summary:
We recently introduced a feature that enforce at link-time that the
LLVM headers used by a clients are matching the ABI setting of the
LLVM library linked to.

However for clients that are using only headers from ADT and promise
they won't call into LLVM, this is forcing to link libSupport. This
new flag is intended to provide a way to configure LLVM with this
promise for such client.

Reviewers: bob.wilson, compnerd

Subscribers: mgorny, llvm-commits

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

llvm-svn: 288754
2016-12-06 01:23:04 +00:00
Weiming Zhao
404d8d84c6 Summary: Currently there is no way to disable deprecated warning from asm like this
clang  -target arm deprecated-asm.s -c
  deprecated-asm.s:30:9: warning: use of SP or PC in the list is deprecated
       stmia   r4!, {r12-r14}

We have to have an option what can disable it.

Patched by Yin Ma!

Reviewers: joey, echristo, weimingz

Subscribers: llvm-commits, aemerson

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

llvm-svn: 288734
2016-12-05 23:55:13 +00:00
Bob Haarman
73e631de3c [pdb] handle missing pdb streams more gracefully
Summary: The code we use to read PDBs assumed that streams we ask it to read exist, and would read memory outside a vector and crash if this wasn't the case. This would, for example, cause llvm-pdbdump to crash on PDBs generated by lld. This patch handles such cases more gracefully: the PDB reading code in LLVM now reports errors when asked to get a stream that is not present, and llvm-pdbdump will report missing streams and continue processing streams that are present.

Reviewers: ruiu, zturner

Subscribers: thakis, amccarth

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

llvm-svn: 288722
2016-12-05 22:44:00 +00:00
Eugene Zelenko
bbaa889bb6 [IR] Fix some Clang-tidy modernize-use-equals-delete and Include What You Use warnings; other minor fixes (NFC).
Also remove obsolete comment from CommandLine.h spotted by Malcolm Parsons.

llvm-svn: 288714
2016-12-05 21:55:02 +00:00
Tim Northover
eedc285652 GlobalISel: make G_CONSTANT take a ConstantInt rather than int64_t.
This makes it more similar to the floating-point constant, and also allows for
larger constants to be translated later. There's no real functional change in
this patch though, just syntax updates.

llvm-svn: 288712
2016-12-05 21:47:07 +00:00
Adrian Prantl
57907269da [DIExpression] Introduce a dedicated DW_OP_LLVM_fragment operation
so we can stop using DW_OP_bit_piece with the wrong semantics.

The entire back story can be found here:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20161114/405934.html

The gist is that in LLVM we've been misinterpreting DW_OP_bit_piece's
offset field to mean the offset into the source variable rather than
the offset into the location at the top the DWARF expression stack. In
order to be able to fix this in a subsequent patch, this patch
introduces a dedicated DW_OP_LLVM_fragment operation with the
semantics that we used to apply to DW_OP_bit_piece, which is what we
actually need while inside of LLVM. This patch is complete with a
bitcode upgrade for expressions using the old format. It does not yet
fix the DWARF backend to use DW_OP_bit_piece correctly.

Implementation note: We discussed several options for implementing
this, including reserving a dedicated field in DIExpression for the
fragment size and offset, but using an custom operator at the end of
the expression works just fine and is more efficient because we then
only pay for it when we need it.

Differential Revision: https://reviews.llvm.org/D27361
rdar://problem/29335809

llvm-svn: 288683
2016-12-05 18:04:47 +00:00
Diana Picus
63c7457853 [GlobalISel] Extract handleAssignments out of AArch64CallLowering
This function seems target-independent so far: all the target-specific behaviour
is isolated in the CCAssignFn and the ValueHandler (which we're also extracting
into the generic CallLowering).

The intention is to use this in the ARM backend.

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

llvm-svn: 288658
2016-12-05 10:40:33 +00:00
Matthias Braun
f4f8cc9e75 TableGen: Some more std::string->StringInit* replacements
llvm-svn: 288653
2016-12-05 07:35:13 +00:00
Matthias Braun
38cd0376b5 TableGen/Record: Shortcut member access in hottest function
This may seem unusual, but makes most debug tblgen builds ~10% faster.
Usually we wouldn't care about speed that much in debug builds, but for
tblgen that also translates into build time.

llvm-svn: 288652
2016-12-05 07:35:09 +00:00
Matthias Braun
5d6cd19170 TableGen/Record: Replace std::vector with SmallVector/ArrayRef
llvm-svn: 288648
2016-12-05 06:41:51 +00:00
Matthias Braun
2bcd3146a4 TableGen: Use StringInit instead of std::string for DagInit arg names
llvm-svn: 288644
2016-12-05 06:00:46 +00:00
Matthias Braun
b307bcfb02 TableGen: Use StringInit instead of std::string for DagInit name
llvm-svn: 288643
2016-12-05 06:00:41 +00:00
Matthias Braun
520d3c4f83 TableGen: Use more StringInit instead of StringRef
This forces the code to call StringInit::get on the string early and
avoids storing duplicates in std::string and sometimes allows pointer
comparisons instead of string comparisons.

llvm-svn: 288642
2016-12-05 06:00:36 +00:00
Matthias Braun
b98b5a9b5e TableGen/Record: Move PointerIntPair to less used field of RecordVal
llvm-svn: 288638
2016-12-05 05:21:13 +00:00
Craig Topper
70c261dca0 [X86] Mark 256-bit DPPS intrinsic as commutable to increase load matching opportunities.
llvm-svn: 288622
2016-12-04 21:13:05 +00:00
Craig Topper
2cc60d8d0d [X86] Add Commutative property to several MMX arithmetic and logic intrinsics.
I think these intrinsics were added after the Commutative was added to most of the rest of the intrinsics and it must have been forgotten.

llvm-svn: 288621
2016-12-04 21:13:01 +00:00
Michael Gottesman
0ded632cc4 [stl-extras] Provide an adaptor of std::count for ranges.
llvm-svn: 288619
2016-12-04 10:26:53 +00:00
Matthias Braun
3fb138a4a5 TableGen: Store Records on a BumpPtrAllocator
All these records are internalized and will live until exit.  This makes
them perfect candidates for a fast BumpPtrAllocator.

llvm-svn: 288613
2016-12-04 05:48:20 +00:00
Matthias Braun
9e5ef1c46f TableGen: Use StringRef instead of const std::string& in return vals.
This will allow to switch to a different string storage in an upcoming
commit.

llvm-svn: 288612
2016-12-04 05:48:16 +00:00
Matthias Braun
61888f54ba TableGen: Use StringRef instead of const std::string& for parameters
This avoid an extra construction of a std::string (and a heap
allocation) when the caller only has a StringRef but no std::string at
hand.

llvm-svn: 288610
2016-12-04 05:48:03 +00:00
Dan Gohman
787b1fe9b1 [MC] Generalize MCContext's SectionSymbols field.
Change SectionSymbols so that it doesn't hard-code ELF types, so that
it can be used for non-ELF targets.

llvm-svn: 288607
2016-12-03 23:55:57 +00:00
Justin Lebar
58d9d057cd [PM] Rename lookupPass to lookUpPass.
Summary:
"Lookup" is a noun ("lookup table"), "look up" is a verb ("look up
'table' in the dictionary").

Reviewers: chandlerc

Subscribers: silvas, llvm-commits, mehdi_amini

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

llvm-svn: 288598
2016-12-03 19:49:35 +00:00
Justin Lebar
a62db213e3 [PM] Get rid of an unused variable in AnalysisManager::clear(IRUnitT&).
Reviewers: chandlerc

Subscribers: silvas, llvm-commits, mehdi_amini

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

llvm-svn: 288597
2016-12-03 19:49:31 +00:00
Justin Lebar
13a5215569 [PM] Consistently use curly braces rather than std::make_pair in AnalysisResults.find().
Reviewers: chandlerc

Subscribers: silvas, llvm-commits, mehdi_amini

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

llvm-svn: 288596
2016-12-03 19:49:27 +00:00
Justin Lebar
51209d722e [PM] Don't walk the AM's ResultsList if nothing was invalidated.
Summary:
Previously in AnalysisManager::invalidate(), we would walk the full
ResultsList even if we knew that nothing was invalidated.

Reviewers: chandlerc

Subscribers: silvas, llvm-commits, mehdi_amini

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

llvm-svn: 288595
2016-12-03 19:49:23 +00:00
Justin Lebar
1582171e16 [PM] Make AnalysisManager::registerPass take its parameter by universal reference.
Summary:
Previously, we were forcing a copy if you passed an lvalue argument; now
we'll take it by reference.

Reviewers: chandlerc

Subscribers: mehdi_amini, silvas, llvm-commits

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

llvm-svn: 288594
2016-12-03 19:49:19 +00:00
Justin Lebar
ef64abe524 [PM] Make PassManager's constructor explicit.
Reviewers: chandlerc

Subscribers: silvas, llvm-commits, mehdi_amini

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

llvm-svn: 288593
2016-12-03 19:49:15 +00:00