Commit Graph

3032 Commits

Author SHA1 Message Date
Daniel Sanders
4d13f315d1 Replace string GNU Triples with llvm::Triple in MCSubtargetInfo and create*MCSubtargetInfo(). NFC.
Summary:
This continues the patch series to eliminate StringRef forms of GNU triples
from the internals of LLVM that began in r239036.

Reviewers: rafael

Reviewed By: rafael

Subscribers: rafael, ted, jfb, llvm-commits, rengolin, jholewinski

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239467 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-10 12:11:26 +00:00
Daniel Sanders
fff114c890 Replace string GNU Triples with llvm::Triple in create*MCRelocationInfo(). NFC.
Summary:
This continues the patch series to eliminate StringRef forms of GNU triples
from the internals of LLVM that began in r239036.

Reviewers: rafael

Reviewed By: rafael

Subscribers: rafael, llvm-commits, rengolin

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239465 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-10 10:54:40 +00:00
Reid Kleckner
c8e72e9126 [WinEH] Emit .safeseh directives for all 32-bit exception handlers
Use a "safeseh" string attribute to do this. You would think we chould
just accumulate the set of personalities like we do on dwarf, but this
fails to account for the LSDA-loading thunks we use for
__CxxFrameHandler3. Each of those needs to make it into .sxdata as well.
The string attribute seemed like the most straightforward approach.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239448 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-10 01:02:30 +00:00
Pete Cooper
be1349596d Fix warning of comparing different enums. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239443 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 23:33:35 +00:00
Pete Cooper
dbb0802eb6 Revert "Move MCSymbol Value in to the union of Offset and CommonSize."
This reverts commit 2e449ec5bcdf67b52b315b16c2128aaf25d5b73c.

This was svn r239440.  Its currently failing an ARM test so reverting while I work out
what to do next.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239441 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 22:35:55 +00:00
Pete Cooper
c11f1d8ae8 Move MCSymbol Value in to the union of Offset and CommonSize.
It wasn't possible to have a variable Symbol with offset or 'isCommon' so
this just enables better packing of the MCSymbol class.

Reviewed by Rafael Espindola.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239440 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 22:21:37 +00:00
Pete Cooper
a96fc7ab00 Use AlignOf traits to enable static_assert.
This is better than runtime asserts.  Thanks to David Blaikie for the help here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239431 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 20:58:03 +00:00
Pete Cooper
38f72d04ea Reduce duplication in MCSymbol Name handling. NFC>
Based on feedback to r239428 by David Blaikie, use const_cast to reduce
duplication of the const and non-const versions of getNameEntryPtr.

Also have that method return the pointer to the name directly instead
of users having to then get the name from the union.

Finally, add a FIXME that we should use a static_assert once available in
the new operator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239429 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 20:41:08 +00:00
Pete Cooper
5c8a22f11b Make MCSymbol::Name be a union of uint64_t and a pointer.
This should hopefully fix the 32-bit bots which were allocating space for a pointer
but needed to be aligned to 64-bits.

Now we allocate enough space for a uint64_t and a pointer and cast to the appropriate storage

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239428 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 19:56:05 +00:00
Pete Cooper
7178ff1974 Change from alignof to llvm::alignOf to appease Visual Studio
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239424 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 18:50:18 +00:00
Pete Cooper
79e04c5844 Allocate space for MCSymbol::Name only if required.
Similarly to User which allocates a number of Use's prior to the this pointer,
allocate space for the Name* for MCSymbol only when we need a name.

Given that an MCSymbol is 48-bytes on 64-bit systems, this saves a decent % of space.

Given the verify_uselistorder test case with debug info and llc, 50k symbols have names
out of 700k so this optimises for the common case of temporary unnamed symbols.

Reviewed by David Blaikie.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239423 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 18:36:13 +00:00
Aaron Ballman
ff7ef6c5c9 Removing spurious semi colons; NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239399 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 12:03:46 +00:00
Matt Arsenault
d99ce2f630 MC: Add target hook to control symbol quoting
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239370 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 00:31:39 +00:00
Pete Cooper
d354befbbb Use a PointerUnion in MCSymbol for Section and Fragment. NFC.
The Fragment and Section, and a bool for HasFragment were all used to create
a PointerUnion.  Just use a pointer union instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239324 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 18:41:57 +00:00
Pete Cooper
e2101ba7b5 Remove includes of MCMachOSymbolFlags.h after it was deleted
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239318 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 17:25:57 +00:00
Pete Cooper
d3869ee8d2 Move all flags logic to MCSymbolMachO.
Also delete the now unused MCMachOSymbolFlags.h header as the only enum in there was moved to MCSymbolMachO.

Similarly to ELF and COFF, manipulating the flags is now done via helpers instead of spread
throughout the codebase.

Reviewed by Rafael Espíndola.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239316 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 17:17:28 +00:00
Pete Cooper
cae8bc4504 Add MCSymbolMachO which will be used to hide the MCSymbolMachO flags.
Reviewed by Rafael Espíndola.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239315 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 17:17:23 +00:00
Pete Cooper
e25e889c7c Move all of the MCSymbol COFF flags logic in to MCSymbolCOFF.
All flags setting/getting is now done in the class with helper methods instead
of users having to get the bits in the correct order.

Reviewed by Rafael Espíndola.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239314 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 17:17:19 +00:00
Pete Cooper
f560b88d7c Add MCSymbolCOFF class and use it to get and set the COFF type field.
Reviewed by Rafael Espíndola.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239312 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 17:17:12 +00:00
Pete Cooper
62f764a6c9 Change MCSymbol IsELF to an enum to support future MCSymbolCOFF and MCSymbolMachO.
Reviewed by Rafael Espíndola.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239311 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 17:17:09 +00:00
Colin LeMahieu
2ca8f0f5d6 [MC] Common symbols weren't being checked for redeclaration which allowed an assembly file to generate an assertion in setCommon(): !isCommon(). This change allows redeclaration as long as the size and alignment match exactly, otherwise report a fatal error.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239227 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-06 20:12:40 +00:00
Rafael Espindola
aa4466db93 Refactor padding writing into a helper function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239174 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-05 18:21:00 +00:00
Rafael Espindola
c1233a84b2 Save a map lookup. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239168 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-05 17:54:25 +00:00
John Brawn
c1c9bc1df7 [ARM] Add knowledge of FPU subtarget features to TargetParser
Add getFPUFeatures to TargetParser, which gets the list of subtarget features
that are enabled/disabled for each FPU, and use it when handling the .fpu
directive.

No functional change in this commit, though clang will start behaving
differently once it starts using this.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239150 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-05 13:29:24 +00:00
Jim Grosbach
22a5d492ef MC: Clean up naming in MCObjectFileInfo.h.
Init*() methods to init*().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239121 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 23:35:03 +00:00
Jim Grosbach
eafe465f2a MC: Clean up the naming for MCMachObjectWriter. NFC.
s/ExecutePostLayoutBinding/executePostLayoutBinding/
s/ComputeSymbolTable/computeSymbolTable/
s/BindIndirectSymbols/bindIndirectSymbols/
s/RecordTLVPRelocation/recordTLVPRelocation/
s/RecordScatteredRelocation/recordScatteredRelocation/
s/WriteLinkerOptionsLoadCommand/writeLinkerOptionsLoadCommand/
s/WriteLinkeditLoadCommand/writeLinkeditLoadCommand/
s/WriteNlist/writeNlist/
s/WriteDysymtabLoadCommand/writeDysymtabLoadCommand/
s/WriteSymtabLoadCommand/writeSymtabLoadCommand/
s/WriteSection/writeSection/
s/WriteSegmentLoadCommand/writeSegmentLoadCommand/
s/WriteHeader/writeHeader/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239119 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 23:25:54 +00:00
Jim Grosbach
bc81286cac MC: Clean up naming in MCObjectWriter. NFC.
s/WriteObject/writeObject/
s/RecordRelocation/recordRelocation/
s/IsSymbolRefDifferenceFullyResolved/isSymbolRefDifferenceFullyResolved/
s/Write8/write8/
s/WriteLE16/writeLE16/
s/WriteLE32/writeLE32/
s/WriteLE64/writeLE64/
s/WriteBE16/writeBE16/
s/WriteBE32/writeBE32/
s/WriteBE64/writeBE64/
s/Write16/write16/
s/Write32/write32/
s/Write64/write64/
s/WriteZeroes/writeZeroes/
s/WriteBytes/writeBytes/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239108 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 22:24:41 +00:00
Benjamin Kramer
5deb54f199 [MachOWriter] Use for-range and roll some duplicated code into loops.
No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239096 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 21:17:27 +00:00
Rafael Espindola
4dbd603825 Remove unused argument. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239092 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 20:55:49 +00:00
Jim Grosbach
aa48bf4e1c MC: Remove obsolete MachO UseAggressiveSymbolFolding.
Fix the FIXME and remove this old as(1) compat option. It was useful for
bringup of the integrated assembler to diff object files, but now it's
just causing more relocations than strictly necessary to be generated.

rdar://21201804

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239084 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 20:27:42 +00:00
Gabor Ballabas
3e2318fbb5 Test commit access.
Fix trailing whitespace.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239058 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 17:30:26 +00:00
Rafael Espindola
9f299abc05 Omit unused section symbols from the symbol table.
Section symbols exist as an optimization: instead of having multiple relocations
point to different symbols, many of them can point to a single section symbol.

When that optimization is unused, a section symbol is also unused and adds no
extra information to the object file.

This saves a bit of space on the object files and makes the output of
llvm-objdump -t easier to read and consequently some tests get quite a bit
simpler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239045 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 15:33:30 +00:00
Rafael Espindola
cddcabadf2 Bring back r239006 with a fix.
The fix is just that getOther had not been updated for packing the st_other
values in fewer bits and could return spurious values:

-  unsigned Other = (getFlags() & (0x3f << ELF_STO_Shift)) >> ELF_STO_Shift;
+  unsigned Other = (getFlags() & (0x7 << ELF_STO_Shift)) >> ELF_STO_Shift;

Original message:

Pack the MCSymbolELF bit fields into MCSymbol's Flags.

This reduces MCSymolfELF from 64 bytes to 56 bytes on x86_64.

While at it, also make getOther/setOther easier to use by accepting unshifted
STO_* values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239012 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 05:59:23 +00:00
Rafael Espindola
64a82a3d70 Revert "Pack the MCSymbolELF bit fields into MCSymbol's Flags."
This reverts commit r239006.

I am debugging the powerpc failures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239010 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 05:00:12 +00:00
Rafael Espindola
d90fd082f9 Pack the MCSymbolELF bit fields into MCSymbol's Flags.
This reduces MCSymolfELF from 64 bytes to 56 bytes on x86_64.

While at it, also make getOther/setOther easier to use by accepting unshifted
STO_* values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239006 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 02:32:20 +00:00
Rafael Espindola
c212856f78 Remove MCELFSymbolFlags.h. It is now internal to MCSymbolELF.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238996 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 00:47:43 +00:00
Rafael Espindola
5eb7481d03 Remember if a weakref of a symbol has been used.
This avoids yet another last minute patching of the binding.

While at it, also simplify the weakref implementation a bit by not walking
past it in the expression evaluation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238982 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 21:52:06 +00:00
Rafael Espindola
f3857c334f Store whether a symbol is a comdat signature in MCSymbolELF.
With this getBinging can now return the correct answer for all cases not
involving a .symver and the elf writer doesn't need to patch it last minute.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238980 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 21:41:59 +00:00
Rafael Espindola
2b9f4dc654 Record in a MCSymbolELF if it has been used in a relocation.
No functionality change, just saves an on the side map.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238979 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 21:30:10 +00:00
Rafael Espindola
a41438c5d8 Simplify the logic in ELFObjectWriter::isInSymtab. NFC.
_GLOBAL_OFFSET_TABLE_ is not magical and we can now directly check for a
symbol never getting an explicit binding.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238978 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 21:23:21 +00:00
Rafael Espindola
96fdaa4f50 Convert BindingExplicitlySet into a MCSymbolELF field.
I will pack it better in a followup patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238975 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 21:18:03 +00:00
Rafael Espindola
0ba7ba487d Clarify when we can avoid creating names for temp symbols.
Some temporary symbols are created by MC itself. These symbols are never used
for lookup and are never included in the object symbol table, so we can
avoid creating a name for them.

Other temporaries are created by CodeGen or by the user by explicitly asking
for a name starting with .L (or L on MachO).

These temporaries behave like regular symbols, we just try to avoid including
them in the object symbol table, but sometimes they end up there:

const char *foo() {
  return "abc" + 3;
}

will have a relocation pointing to a .L symbol.

It just so happens that almost all MC created temporary has the AlwaysAddSuffix
option and CodeGen/user created ones don't.

One interesting future optimization would be to use unnamed symbols for
all temporaries, but that would require use an st_name of 0 or
having the object writer create the names if a symbol does end up in the
symbol table.

No testcase since this just avoid creating a few extra names for MC created
temporaries.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238887 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 22:52:13 +00:00
Rafael Espindola
4cc59a13c7 Pass a MCSymbolELF to a few ELF only functions. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238868 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 21:30:13 +00:00
Rafael Espindola
569f382a46 Merge MCELF.h into MCSymbolELF.h.
Now that we have a dedicated type for ELF symbol, these helper functions can
become member function of MCSymbolELF.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238864 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 20:38:46 +00:00
Daniel Sanders
92a1dad6d1 [mips] Make TTypeEncoding indirect to allow .eh_frame to be read-only.
Summary:
Following on from r209907 which made personality encodings indirect, do the
same for TType encodings. This fixes the case where a try/catch block needs
to generate references to, for example, std::exception in the
.gcc_except_table.

Previous attempts at committing this broke the buildbots due to bugs in IAS.
These bugs have now been fixed so trying again.

Reviewers: petarj

Reviewed By: petarj

Subscribers: srhines, joerg, tberghammer, llvm-commits

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238863 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 20:32:50 +00:00
Rafael Espindola
f7e0685b9a Create a MCSymbolELF.
This create a MCSymbolELF class and moves SymbolSize since only ELF
needs a size expression.

This reduces the size of MCSymbol from 56 to 48 bytes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238801 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 00:25:12 +00:00
Jim Grosbach
398f175c45 MC: Tidy up LOH naming a bit. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238800 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 23:55:06 +00:00
Rafael Espindola
ba9e3285d0 The fragment implies the section, don't store both.
This reduces MCSymbol from 64 to 56 bytes on x86_64.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238747 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 14:34:40 +00:00
David Majnemer
64f16f5332 [WinCOFF] Ignore .safeseh for non-x86 architectures
We don't want to bother with creating .sxdata sections on Win64; all the
relevant information is already in the .pdata section.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238730 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 07:34:26 +00:00
Rafael Espindola
223e58b67d Rename HasData to IsRegistered.
There is no MCSectionData, so the old name is now meaningless.

Also remove some asserts/checks that were there just because the information
they used was in MCSectionData.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238708 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 01:52:18 +00:00
Rafael Espindola
d1678240e5 Remove trivial forwarding function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238707 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 01:39:15 +00:00
Rafael Espindola
2dd8a67317 Store a bit in MCSection saying if it was registered with MCAssembler.
With this we can replace a SetVector with a plain std::vector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238706 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 01:30:01 +00:00
Rafael Espindola
13950e506d Use a bitfield. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238705 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 01:05:07 +00:00
Benjamin Kramer
d79915c6fe [MC] Simplify code. No functionality change intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238676 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-31 18:49:28 +00:00
Colin LeMahieu
32de7d791e [MC] Allow backends to decide relaxation for unresolved fixups.
Differential Revision: http://reviews.llvm.org/D8217

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238659 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-30 18:42:22 +00:00
David Majnemer
e0d2a2939d [WinCOFF] Add support for the .safeseh directive
.safeseh adds an entry to the .sxdata section to register all the
appropriate functions which may handle an exception.  This entry is not
a relocation to the symbol but instead the symbol table index of the
function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238641 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-30 04:56:02 +00:00
Jim Grosbach
586c0042da MC: Clean up MCExpr naming. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238634 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-30 01:25:56 +00:00
Rafael Espindola
cfac75ad0e Remove getData.
This completes the mechanical part of merging MCSymbol and MCSymbolData.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238617 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 21:45:01 +00:00
Rafael Espindola
5760c5fe31 Remove the MCSymbolData typedef.
The getData member function is next.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238611 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 20:41:47 +00:00
Rafael Espindola
63e7baf8f6 Merge MCSymbol and MCSymbolData.
As a transition hack leave MCSymbolData as a typedef of MCSymbol. I will be
removing that in a second.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238609 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 20:31:23 +00:00
Rafael Espindola
f00654bc0f Rename getOrCreateSymbolData to registerSymbol and return void.
Another step in merging MCSymbol and MCSymbolData.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238607 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 20:21:02 +00:00
Benjamin Kramer
9589ff8949 Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types
If the type isn't trivially moveable emplace can skip a potentially
expensive move. It also saves a couple of characters.


Call sites were found with the ASTMatcher + some semi-automated cleanup.

memberCallExpr(
    argumentCountIs(1), callee(methodDecl(hasName("push_back"))),
    on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))),
    hasArgument(0, bindTemporaryExpr(
                       hasType(recordDecl(hasNonTrivialDestructor())),
                       has(constructExpr()))),
    unless(isInTemplateInstantiation()))

No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238602 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 19:43:39 +00:00
Rafael Espindola
071c3df378 Move Flags from MCSymbolData to MCSymbol.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238598 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 19:07:51 +00:00
Rafael Espindola
21a7b73e04 Fix build without asserts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238597 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 19:04:38 +00:00
Rafael Espindola
5b68a837c7 Pass MCSymbols to the helper functions in MCELF.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238596 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 18:47:23 +00:00
Rafael Espindola
e97d937576 Pass a MCSymbol to needsRelocateWithSymbol.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238589 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 18:26:09 +00:00
Rafael Espindola
82fdcc0e7f Move common symbol related information from MCSectionData to MCSymbol.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238583 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 17:48:04 +00:00
Rafael Espindola
052a7becbe Store MCSymbols in PendingLabels.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238582 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 17:41:59 +00:00
Rafael Espindola
28afbf2421 Move SymbolSize from MCSymbolData to MCSymbol.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238580 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 17:24:52 +00:00
Pete Cooper
b2faffd63a Fix crash in MCExpr::print.
Symbols are no longer required to be named, but this leads to a crash here if an
unnamed symbol checks that its first character is '$'.

Change the code to first check for a name, then check its first character.

No test case i'm afraid as this is debugging code, but any test case with temp labels
and 'llc --debug --filetype=obj' would have crashed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238579 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 17:19:11 +00:00
Reid Kleckner
16e4a624c4 [WinEH] Emit EH tables for __CxxFrameHandler3 on 32-bit x86
Small (really small!) C++ exception handling examples work on 32-bit x86
now.

This change disables the use of .seh_* directives in WinException when
CFI is not in use. It also uses absolute symbol references in the tables
instead of imagerel32 relocations.

Also fixes a cache invalidation bug in MMI personality classification.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238575 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 17:00:57 +00:00
Rafael Espindola
616c7afb70 Simplify now that symbols contain the correct section.
The complexity in here was because before r233995 variable symbols would report
the incorrect section.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238559 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 15:07:27 +00:00
Rafael Espindola
3b08750746 Fix ELFObjectWriter::isLocal for signature symbols.
And with that simplify the logic for inserting them in ExternalSymbolData or
LocalSymbolData.

No functionality change overall since the old code avoided the isLocal bug.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238555 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 14:20:40 +00:00
Rafael Espindola
fb48de619e Don't special case undefined symbol when deciding the symbol order.
ELF has no restrictions on where undefined symbols go relative to other defined
symbols. In fact, gas just sorts them together. Do the same.

This was there since r111174 probably just because the MachO writer has it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238513 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 21:59:34 +00:00
Rafael Espindola
9886da621d Remove a trivial forwarding function. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238506 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 21:36:02 +00:00
Rafael Espindola
db8eb52635 Inline trivial method. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238492 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 20:53:09 +00:00
Daniel Sanders
1348f57925 Revert r238427 - [mips] Make TTypeEncoding indirect to allow .eh_frame to be read-only.
It caused a smaller number of failures than the previous attempt at committing but still caused a couple on the llvm-linux-mips builder. Reverting while I investigate the remainder.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238483 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 20:30:32 +00:00
Rafael Espindola
c66c8e7730 Remove structure field that can be computed just before use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238480 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 20:25:29 +00:00
Rafael Espindola
f3344cdffb Avoid warnings when building without asserts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238479 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 20:19:31 +00:00
Rafael Espindola
7978ab3ad9 Move these vectors to the only function where they are used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238477 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 20:11:34 +00:00
Rafael Espindola
86c0a109d8 Merge redundant loops. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238471 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 20:00:13 +00:00
Rafael Espindola
48f886b9de Simplify LastLocalSymbolIndex computation. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238465 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 19:46:36 +00:00
Rafael Espindola
b665c2b05e Use range loops. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238463 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 19:43:20 +00:00
Rafael Espindola
24441414a3 Remove temporary FileSymbolData. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238461 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 19:29:15 +00:00
Colin LeMahieu
58dd70dced [llvm] Parameterizing the output stream for dumpbytes and outputting directly to stream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238453 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 18:39:50 +00:00
Rafael Espindola
fd64e0f71a Use range loops for accessing file names. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238446 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 18:03:20 +00:00
Rafael Espindola
b9ffeb0979 Merge computeSymbolTable and writeSymbolTable.
For now this just saves a few loops, but it will allow more simplifications
in the future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238444 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 17:54:01 +00:00
Rafael Espindola
c4e38f605e Don't create an unused _GLOBAL_OFFSET_TABLE_.
This was a bug for bug compatibility with gas that is completely unnecessary.
If a _GLOBAL_OFFSET_TABLE_ symbol is used, it will already be created by
the time we get to the ELF writer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238432 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 15:20:00 +00:00
Daniel Sanders
8bf191d139 [mips] Make TTypeEncoding indirect to allow .eh_frame to be read-only.
Summary:
Following on from r209907 which made personality encodings indirect, do the
same for TType encodings. This fixes the case where a try/catch block needs
to generate references to, for example, std::exception in the
.gcc_except_table.

Reviewers: petarj

Reviewed By: petarj

Subscribers: srhines, joerg, tberghammer, llvm-commits

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238427 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 14:52:15 +00:00
Benjamin Kramer
7f4bf08286 [MC] Replace custom string join function with the one from StringExtras.
NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238414 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 11:45:32 +00:00
Benjamin Kramer
24bccaf9f9 Don't call utostr in Twine/raw_ostream contexts.
Creating temporary std::strings there is unnecessary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238412 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 11:24:24 +00:00
Rafael Espindola
792e158397 Rename and move getCurrentSectionData.
I think this concludes the merge of MCSectionData and MCSection.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238358 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 21:04:14 +00:00
Rafael Espindola
41cea417fa There is only one current section.
Both MCStreamer and MCObjectStreamer were maintaining a current section
variable and they were slightly out of sync. I don't think this was observable,
but was inefficient and error prone.

Changing this requires a few cascading changes:

* SwitchSection has to call ChangeSection earlier for ChangeSection to see
  the old section.
* With that change, ChangeSection cannot call EmitLabel, since during
  ChangeSection we are still in the old section.
* When the object streamer requires a begin label, just reused the existing
  generic support for begin labels instead of calling EmitLabel directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238357 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 20:52:32 +00:00
Rafael Espindola
3e6e3602d5 Fix NDEBUG build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238332 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 15:18:34 +00:00
Rafael Espindola
899cab6126 Delete MCSectionData.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238331 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 15:14:11 +00:00
Rafael Espindola
b167996819 Delete dead code. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238330 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 14:55:09 +00:00
Rafael Espindola
7e5614efc2 Stop using MCSectionData in WinCOFFObjectWriter.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238329 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 14:45:54 +00:00
Rafael Espindola
1da0f919d5 clang-format WinCOFFObjectWriter.cpp. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238328 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 14:37:12 +00:00
Rafael Espindola
faf287243a Remove uses of MCSectionData from MachObjectWriter.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238327 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 14:33:39 +00:00
Rafael Espindola
919ce81d38 Move getSubsectionInsertionPoint to MCSection.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238320 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 13:37:28 +00:00