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

289 Commits

Author SHA1 Message Date
Daniel Dunbar
55c1bf55fe MC: Use accessors for access to MCAsmFixup.
llvm-svn: 104697
2010-05-26 15:18:31 +00:00
Daniel Dunbar
a06aa279f4 MC: Eliminate MCFragment vtable, which was unnecessary.
llvm-svn: 104689
2010-05-26 06:50:57 +00:00
Daniel Dunbar
7fee3c7b28 MC: Switch to completely lazy layout.
- The eliminates the last major algorithmic problem with MC.

llvm-svn: 103754
2010-05-14 00:51:14 +00:00
Daniel Dunbar
66c2ccec2d MC: Extend MCAsmLayout to explicitly track which fragments have been layed out, and enforce several invariants to LayoutFragment to ensure we only do layout in a sensible order.
llvm-svn: 103753
2010-05-14 00:37:21 +00:00
Daniel Dunbar
bfc0b2083d MC: Implicitly assign section addresses when the previous fragment is layed out.
llvm-svn: 103752
2010-05-14 00:37:17 +00:00
Daniel Dunbar
11467b2eaa MC: Switch MCFragment to storing the layout order index, not its index in the file.
llvm-svn: 103751
2010-05-14 00:37:14 +00:00
Daniel Dunbar
b2a98e0a16 MC: Change LayoutSection() to only do the section initializiation.
Also, elimminate MCAsmLayout::set*, which are no longer needed.

llvm-svn: 103750
2010-05-14 00:37:11 +00:00
Daniel Dunbar
86825a9719 MC: Move Layout{Fragment,Section} into MCAsmLayout, and add LayoutFile().
llvm-svn: 103738
2010-05-13 20:40:12 +00:00
Daniel Dunbar
b142c00db4 MC: Factor out MCAssembler::ComputeFragmentSize.
llvm-svn: 103724
2010-05-13 18:35:06 +00:00
Daniel Dunbar
5a601f9e09 MC: Add section layout order indices to MCSectionData.
llvm-svn: 103715
2010-05-13 15:17:26 +00:00
Daniel Dunbar
aa67ae072c MC: Move ordinal calculation, to make sure fragments synthesized for layout get assigned ordinals properly.
llvm-svn: 103711
2010-05-13 08:43:37 +00:00
Daniel Dunbar
e72ef430f7 MC: Create dummy fragments to avoid ever having empty sections, which simplifies layout.
llvm-svn: 103710
2010-05-13 08:43:34 +00:00
Daniel Dunbar
5ef1bcbb97 MC: Add MCAsmLayout::FragmentReplaced() helper function.
llvm-svn: 103709
2010-05-13 08:43:31 +00:00
Daniel Dunbar
5759287db9 Fix -Asserts warning.
llvm-svn: 103697
2010-05-13 03:50:50 +00:00
Daniel Dunbar
561f55c1af MC: Eliminate MCSectionData::{,Address,File}Size, which can now be computed by
utility functions.

llvm-svn: 103695
2010-05-13 03:19:50 +00:00
Daniel Dunbar
a81966a973 MC: Switch to using explicit MCAlignFragments with OnlyAlignAddress bit instead
of manually doing padding/editing layout in LayoutSection().
    - This probably seems like six-of-one and half-dozen of another, but there
      is a method to my madness.

llvm-svn: 103693
2010-05-13 02:34:14 +00:00
Daniel Dunbar
3fc379596a MC: Add MCAlignFragment::OnlyAlignAddress bit. This is a bit of magic that says the align fragment shouldn't contribute to the logical section size, it is will be used for cleaning up the code to handle section alignment.
llvm-svn: 103690
2010-05-13 01:10:26 +00:00
Daniel Dunbar
ec3a2ac5ed MC: Add MCSectionData::AddressSize, which is the size of the address space consumed by the section. This can differ from both the section logical size, and the section size on disk (although the current code handles this without making an explicit distinction).
llvm-svn: 103689
2010-05-13 01:10:22 +00:00
Daniel Dunbar
de7caed021 MC: Move MCAlignFragment::EmitNops value out of the constructor.
llvm-svn: 103665
2010-05-12 22:56:23 +00:00
Daniel Dunbar
cf11e2a0a5 MC: Eliminate MCZeroFillFragment, it is no longer needed.
llvm-svn: 103664
2010-05-12 22:51:38 +00:00
Daniel Dunbar
0040c2c393 MC: Explicitly check that only virtual fragments appear in virtual sections.
llvm-svn: 103663
2010-05-12 22:51:35 +00:00
Daniel Dunbar
08bcc3a6fc MC: Switch MCFillFragment to storing total fill size instead of a count. This allows using ValueSize==0 to represent a virtual fill.
llvm-svn: 103662
2010-05-12 22:51:32 +00:00
Daniel Dunbar
d3f60794d8 MC: Drop support for alignment in ZeroFill fragment, we can just use
MCAlignFragments for this.

llvm-svn: 103661
2010-05-12 22:51:27 +00:00
Daniel Dunbar
e8f8a29de5 Simplify.
llvm-svn: 103651
2010-05-12 21:47:55 +00:00
Daniel Dunbar
6a495507e5 MC: Factor out MCAssembler::LayoutFragment
llvm-svn: 103649
2010-05-12 21:35:25 +00:00
Daniel Dunbar
43dad4fc73 MC: Tweak section layout to not relying on accumulating address value.
llvm-svn: 103648
2010-05-12 21:35:22 +00:00
Daniel Dunbar
7b72c3c7a0 MC: Simplify LayoutSection to just take the index of the section to layout.
llvm-svn: 103627
2010-05-12 17:56:47 +00:00
Daniel Dunbar
adca38558e MC: Track section layout order explicitly, and use to simplify.
llvm-svn: 103616
2010-05-12 15:42:59 +00:00
Daniel Dunbar
e5a79692cf MC/Mach-O/x86_64: Add a new hook for checking whether a particular section can
be diced into atoms, and adjust getAtom() to take this into account.
 - This fixes relocations to symbols in fixed size literal sections, for
   example.

llvm-svn: 103532
2010-05-12 00:38:17 +00:00
Daniel Dunbar
7670f69e42 MC/Mach-O x86_64: Switch to using fragment atom symbol.
- This eliminates getAtomForAddress() (which was a linear search) and
   simplifies getAtom().
 - This also fixes some correctness problems where local labels at the same
   address as non-local labels could be assigned to the wrong atom.

llvm-svn: 103480
2010-05-11 17:22:50 +00:00
Daniel Dunbar
00ffbb63da MC/Mach-O: Explicitly track atoms, as represented by their defining symbol, for each fragment (not yet used).
llvm-svn: 103438
2010-05-10 22:45:09 +00:00
Daniel Dunbar
b7e0c07d88 llvm-mc: Fix case were we would skip a line in the .s file after an instruction
match failure.

Also, fixes a few memory leak FIXMEs.

llvm-svn: 102986
2010-05-04 00:33:07 +00:00
Chris Lattner
80b41881bc rename llvm::llvm_report_error -> llvm::report_fatal_error
llvm-svn: 100709
2010-04-07 22:58:41 +00:00
Daniel Dunbar
d04906b49e llvm-mc: Add a -mc-relax-all option, which relaxes every fixup. We always need
exactly two passes in that case, and don't ever need to recompute any layout,
so this is a nice baseline for relaxation performance.

llvm-svn: 99563
2010-03-25 22:49:09 +00:00
Daniel Dunbar
21e9834bc1 MC: Stop restarting layout on every relaxation.
- Still O(N^2), just a faster form, and now its the MCAsmLayout's fault.

On the .s I am tuning against (combine.s from 403.gcc):
--
ddunbar@lordcrumb:MC$ diff stats-before.txt stats-after.txt
5,10c5,10
<    1728 assembler - Number of assembler layout and relaxation steps
<    7707 assembler - Number of emitted assembler fragments
<  120588 assembler - Number of emitted object file bytes
< 2233448 assembler - Number of evaluated fixups
<    1727 assembler - Number of relaxed instructions
< 6723845 mcexpr    - Number of MCExpr evaluations
---
>      3 assembler - Number of assembler layout and relaxation steps
>   7707 assembler - Number of emitted assembler fragments
> 120588 assembler - Number of emitted object file bytes
>  14796 assembler - Number of evaluated fixups
>   1727 assembler - Number of relaxed instructions
>  67889 mcexpr    - Number of MCExpr evaluations
--
Feel free to LOL at the -before numbers, if you like.

I am a little surprised we make more than 2 relaxation passes. It's pretty
trivial for us to do relaxation out-of-order if that would give a speedup.

llvm-svn: 99543
2010-03-25 19:35:56 +00:00
Daniel Dunbar
4935edfb58 MC: Simplify main section layout process by moving alignment into LayoutSection.
llvm-svn: 99529
2010-03-25 18:16:42 +00:00
Daniel Dunbar
8d2b718d91 MC: Sink Section address assignment into LayoutSection.
llvm-svn: 99528
2010-03-25 18:16:38 +00:00
Daniel Dunbar
de3fc7d4d8 MC: Explicity track section and fragment ordinals.
llvm-svn: 99500
2010-03-25 07:10:11 +00:00
Daniel Dunbar
797b44b26c MC: Route access to SectionData offset and file size through MCAsmLayout.
llvm-svn: 99474
2010-03-25 02:00:07 +00:00
Daniel Dunbar
4b6b2a1a1f MC: Route access to Fragment offset and effective size through MCAsmLayout.
llvm-svn: 99473
2010-03-25 02:00:02 +00:00
Daniel Dunbar
70fbcbc1cd MC: Eliminate MC{Fragment,{Section,Symbol}Data}::getAddress.
llvm-svn: 99467
2010-03-25 01:03:24 +00:00
Daniel Dunbar
3a79d30c6c MC: Direct all {fragment,section,symbol} address access through the MCAsmLayout object.
llvm-svn: 99380
2010-03-24 03:43:40 +00:00
Daniel Dunbar
0ce1e410cd MC: Sprinkle in some more interesting statistics.
llvm-svn: 99350
2010-03-23 23:47:14 +00:00
Daniel Dunbar
14c84e0c3b MC: Switch to using MCInst fragments to do relaxation.
Also, both MCMachOStreamer and MCAssembler are now target independent!

llvm-svn: 99256
2010-03-23 05:09:03 +00:00
Daniel Dunbar
47743ae59a MC: Add TargetAsmBackend::MayNeedRelaxation, for checking whether a particular instruction + fixups might need relaxation.
llvm-svn: 99249
2010-03-23 03:13:05 +00:00
Daniel Dunbar
b33d212057 MC: Add TargetAsmBackend::WriteNopData and use to eliminate some target dependencies in MCMachOStreamer and MCAssembler.
llvm-svn: 99248
2010-03-23 02:36:58 +00:00
Daniel Dunbar
ae8d914c58 MC: Tweak MCInstFragment to include the encoded data and fixups, so that we don't need to recompute them during relaxation. I will revisit this once all the other pieces of fast relaxation are in place.
llvm-svn: 99244
2010-03-23 01:39:05 +00:00
Daniel Dunbar
0f6983752f MC: Add MCInstFragment, not used yet.
llvm-svn: 99229
2010-03-22 23:16:48 +00:00
Daniel Dunbar
4b5c134c5b MC: Fix a few more cases we were passing an MCDataFragment when a MCFragment would do, and sprinkle in some const.
llvm-svn: 99218
2010-03-22 21:49:41 +00:00
Daniel Dunbar
a8a7a9b5aa Simplify.
llvm-svn: 99217
2010-03-22 21:49:38 +00:00
Daniel Dunbar
6a91d2767b MC: Change MCObjectWriter::RecordRelocation to take an MCFragment (instead of a MCDataFragment). Object files should only need the generic MCFragment features.
llvm-svn: 99205
2010-03-22 20:35:50 +00:00
Daniel Dunbar
264c33a099 MC: Eliminate MCFragment::getMaxFileSize.
llvm-svn: 99203
2010-03-22 20:35:43 +00:00
Daniel Dunbar
6ea8fe65e7 MC: Share the MCAsmLayout object, although its still not used for anything important.
llvm-svn: 99202
2010-03-22 20:35:35 +00:00
Daniel Dunbar
c687bf7cb4 MC: Add TargetAsmBackend::createObjectWriter.
- MCAssembler is now object-file independent, although we will surely need more work to fully support ELF/COFF.

llvm-svn: 98955
2010-03-19 10:43:26 +00:00
Daniel Dunbar
7252b48af1 MCCodeEmitter: Add target independent fixup flag for is-pc-relative.
llvm-svn: 98954
2010-03-19 10:43:23 +00:00
Daniel Dunbar
c47468760e MC: Sink code emitter into MCAssembler.
llvm-svn: 98953
2010-03-19 10:43:18 +00:00
Daniel Dunbar
74330a6389 MC/Mach-O: Move to MachObjectWriter.{h,cpp}.
llvm-svn: 98952
2010-03-19 10:43:15 +00:00
Daniel Dunbar
287ff291e3 MC: Add TargetAsmBackend::isVirtualSection hook.
llvm-svn: 98950
2010-03-19 09:29:03 +00:00
Daniel Dunbar
c9bcbc86a8 MC: Split MCObjectWriter out of MCAssembler.cpp.
llvm-svn: 98949
2010-03-19 09:28:59 +00:00
Daniel Dunbar
1053342967 MCAssembler: Pull out MCObjectWriter class.
llvm-svn: 98948
2010-03-19 09:28:55 +00:00
Daniel Dunbar
3444d755d2 MCAssembler: Move ApplyFixup to the TargetAsmBackend, this is a target specific not object writer specific task.
llvm-svn: 98947
2010-03-19 09:28:12 +00:00
Daniel Dunbar
b2aafb5fe9 MC/Mach-O: Lift the fixup evaluation and application up (to the same place), and eliminate MCAsmFixup::FixedValue.
llvm-svn: 98944
2010-03-19 07:09:47 +00:00
Daniel Dunbar
01aca21857 MC/Mach-O: Factor out ExecutePostLayoutBinding, to separate the post-layout changes the object writer may need to make to the assembler from the actual .o writing.
llvm-svn: 98943
2010-03-19 07:09:33 +00:00
Daniel Dunbar
9fac4ed7f7 MC/Mach-O: Lift relocation emission logic a bit higher to separate evaluation / relocation handling from the actual .o writing.
llvm-svn: 98942
2010-03-19 07:09:18 +00:00
Daniel Dunbar
d2393ccdad MC/Mach-O: Add isScatteredFixupFullyResolved, which implements the correct algorithm (used on x86_64) for determining whether an evaluated fixup is fully resolved (doesn't need relocation).
- Test cases will follow, once we have x86_64 relocation support.

llvm-svn: 98926
2010-03-19 03:18:18 +00:00
Daniel Dunbar
0a3b893a3e MC/Mach-O/x86_64: Add getAtom[ForAddress].
- These find the defining symbol which identifies the containing atom for a symbol or address. They are currently very slow, but will be eliminated eventually.

llvm-svn: 98925
2010-03-19 03:18:15 +00:00
Daniel Dunbar
f8e4be91ff MC/Mach-O: Factor out isScatteredFixupFullyResolvedSimple predicate, and fix some corner cases.
llvm-svn: 98924
2010-03-19 03:18:12 +00:00
Daniel Dunbar
377fb36813 MC/Mach-O: Factor out isSymbolLinkerVisible method; "linker visible" is a made up term to refer to non-temporary labels + temporary labels in sections-which-require symbols. For Darwin, it corresponds to symbols which effectively define an atom.
llvm-svn: 98923
2010-03-19 03:18:09 +00:00
Daniel Dunbar
8b149ce7fd MCValue: Change to holding MCSymbolRefExprs instead of MCSymbols, we will need this for accessing to symbol modifiers.
llvm-svn: 98791
2010-03-18 00:59:10 +00:00
Daniel Dunbar
476b525e01 MC/Mach-O/x86_64: Temporary labels in cstring sections require symbols (and external relocations, but we don't have x86_64 relocations yet).
llvm-svn: 98583
2010-03-15 21:56:50 +00:00
Daniel Dunbar
27eab8e4f7 MC/Mach-O: Add MCSectionMachO::getType()
llvm-svn: 98582
2010-03-15 21:56:38 +00:00
Daniel Dunbar
eb158a88db MC/X86_64: Symbol support.
llvm-svn: 98456
2010-03-13 22:49:35 +00:00
Daniel Dunbar
fec15da5d7 MC/Mach-O: Initial x86_64 support.
llvm-svn: 98454
2010-03-13 22:10:17 +00:00
Daniel Dunbar
e8b67adb94 MC/Mach-O: PCrel relocations weren't using the right base address, they are
relative to the fragment address, not its offset. This was masked by the text
section normally being at address 0.

llvm-svn: 98420
2010-03-13 02:38:00 +00:00
Daniel Dunbar
8ad9589475 MC/Mach-O: Implement initial support for relaxation.
- The implementation is currently very brain dead and inefficient, but I have a
   clear plan on how to fix it.

 - The good news is, it works and correctly assembles 403.gcc (when built with
   Clang, at '-Os', '-Os -g', and '-O3'). Even better, at '-Os' and '-Os -g',
   the resulting binary is exactly equivalent to that when built with the system
   assembler. So it probably works! :)

llvm-svn: 98396
2010-03-12 22:07:14 +00:00
Daniel Dunbar
642fbbe84d MC: Factor out MCAssembler::EvaluateFixup, and simplify.
llvm-svn: 98381
2010-03-12 21:00:49 +00:00
Daniel Dunbar
8790f4ce4b MC/Mach-O: Add MCSymbolData::getAddress() utility.
llvm-svn: 98266
2010-03-11 18:22:51 +00:00
Daniel Dunbar
ee26fc9e9f MC/Mach-O: Implement "absolutizing" semantics of .set, by evaluating the assembly time value of variables.
llvm-svn: 98241
2010-03-11 05:53:37 +00:00
Daniel Dunbar
aefde2abfd MC/Mach-O: Start passing in the basic MCAsmLayout object.
- Also, drop the current location part of AsmLayout, I think I prefer to implement this via explicit symbols.

llvm-svn: 98240
2010-03-11 05:53:33 +00:00
Daniel Dunbar
687d99cfa8 MC: Provide MCAssembler with a TargetAsmBackend.
llvm-svn: 98222
2010-03-11 01:34:27 +00:00
Daniel Dunbar
a1827f9853 MC/Mach-O: Use the MCAssembler symbol map instead of reconstructing.
llvm-svn: 98187
2010-03-10 20:58:31 +00:00
Daniel Dunbar
54df3cead6 MC/Mach-O: Resolve a FIXME; these relocation types are no longer semanticaly different.
llvm-svn: 98120
2010-03-10 02:10:29 +00:00
Daniel Dunbar
14b4e621b0 MC/Mach-O: Use the SECTDIFF relocation type for (A - B + constant) where A is external.
- I'm not sure why, but this is what 'as' does.

llvm-svn: 98115
2010-03-10 00:58:25 +00:00
Daniel Dunbar
f33a8c5ab6 MC/Mach-O: For PCrel relocations, we need to compensate for the PCrel adjustment when determining if we need a scattered relocation.
llvm-svn: 98082
2010-03-09 21:27:58 +00:00
Daniel Dunbar
94ed4ba5e0 MC/Mach-O: Also set the PCrel bit in the second half of paired relocation entries.
llvm-svn: 98081
2010-03-09 21:27:47 +00:00
Daniel Dunbar
90e934ff65 MC/Mach-O: Don't generate relocations for PCrel fixups to local labels.
llvm-svn: 98080
2010-03-09 21:27:30 +00:00
Daniel Dunbar
8e3e2688b5 MC/Mach-O: Tweak .dump() formatting.
llvm-svn: 98028
2010-03-09 01:12:23 +00:00
Daniel Dunbar
e3986eb967 MC/Mach-O: Don't adjust section sizes when aligning zero fill sections, just pad the address.
llvm-svn: 98027
2010-03-09 01:12:20 +00:00
Daniel Dunbar
42f1b1b255 MC/Macho-O: Align the zerofill section itself to the maximum alignment.
llvm-svn: 97991
2010-03-08 22:03:42 +00:00
Daniel Dunbar
3292ad448b MC/Mach-O: Fix address compution for zero fill sections.
llvm-svn: 97984
2010-03-08 21:10:42 +00:00
Daniel Dunbar
ea24e77d30 MC/Mach-O: Error out instead of crashing on invalid scattered relocation expressions.
llvm-svn: 97983
2010-03-08 21:10:39 +00:00
Kevin Enderby
69d643ba20 This is the second patch to allow x86 code to be aligned with optimal nops.
With the compiler changed to use EmitCodeAlignment() it does change the
functionality.  But X86 assembly code assembled with llvm-mc does not change
its output.  For that we will eventually change the assembler frontend to
detect a '.align x, 0x90' when used in a section that 'hasInstructions' and use
EmitCodeAlignment, but will wait until we have better target hooks.

llvm-svn: 96988
2010-02-23 21:41:24 +00:00
Kevin Enderby
c11390f758 This is the first patch to put the needed bits in place to eventually allow code
to be aligned with optimal nops.  This patch does not change any functionality
and when the compiler is changed to use EmitCodeAlignment() it should also not
change the resulting output.  Once the compiler change is made and everything
looks good the next patch with the table of optimal X86 nops will be added to
WriteNopData() changing the output.  There are many FIXMEs in this patch which
will be removed when we have better target hooks (coming soon I hear).

llvm-svn: 96963
2010-02-23 18:26:34 +00:00
Daniel Dunbar
2f311d34fb MC/Mach-O: Update fixup values for change to X86 offsets.
llvm-svn: 96532
2010-02-17 23:45:16 +00:00
Duncan Sands
e2bc75b41e Pacify gcc-4.5, which warns (correctly) that these switches have
cases that are not part of the enum.

llvm-svn: 96477
2010-02-17 14:52:22 +00:00
Daniel Dunbar
e6679afaa7 MCAssembler: Fix pcrel relocations. Oh and,
--
ddunbar@ozzy:tmp$ clang -m32 -integrated-as hello.c && ./a.out
hello world!
--

llvm-svn: 96096
2010-02-13 09:45:59 +00:00
Daniel Dunbar
c05a38a3d3 MC/Mach-O: Start emitting fixups/relocations for instructions.
llvm-svn: 96095
2010-02-13 09:29:02 +00:00
Daniel Dunbar
7a1fd21459 MCAssembler: Switch MCAsmFixup to storing MCFixupKind instead of just a size.
llvm-svn: 96094
2010-02-13 09:28:54 +00:00
Daniel Dunbar
8e9044353a MCAssembler: Sink fixup list into MCDataFragment.
llvm-svn: 96093
2010-02-13 09:28:43 +00:00
Daniel Dunbar
95ae012b0e MCAssembler: Switch MCFillFragment to only taking constant values. Symbolic expressions can always be emitted as data + fixups.
llvm-svn: 96092
2010-02-13 09:28:32 +00:00
Daniel Dunbar
481e926468 MCAssembler: Start applying fixups in the data section.
llvm-svn: 96090
2010-02-13 09:28:15 +00:00
Daniel Dunbar
a699e834fb MCAssembler: Add assorted dump() methods.
llvm-svn: 96089
2010-02-13 09:28:03 +00:00
Daniel Dunbar
3ee9e4a9a5 MC: Move assembler-backend's fixup list into the fragment.
llvm-svn: 95926
2010-02-11 21:29:46 +00:00
Daniel Dunbar
fa324dd09b MC: Move MCSectionData::Fixup out to MCAsmFixup.
llvm-svn: 95925
2010-02-11 21:29:29 +00:00
Daniel Dunbar
1b050afd4e llvm-mc: Add --show-fixups option, for displaying the instruction fixup information in the asm comments.
llvm-svn: 95710
2010-02-09 23:00:14 +00:00
Daniel Dunbar
eb0b81040a MC/Mach-O: Set SOME_INSTRUCTIONS bit for sections.
llvm-svn: 95135
2010-02-02 21:44:01 +00:00
Chris Lattner
3cae149179 Add a new top-level MachO.h file for manifest constants, fixing
a layering violation from MC -> Target.

llvm-svn: 95113
2010-02-02 19:38:14 +00:00
Nate Begeman
3c96073ce7 Remove this fixme, looking at the linker source, all targets pad to 4 bytes.
llvm-svn: 93835
2010-01-19 01:32:44 +00:00
Daniel Dunbar
4daaf9d3f4 Pass StringRef by value.
llvm-svn: 86251
2009-11-06 10:58:06 +00:00
Daniel Dunbar
4943610506 Minor formatting tweaks.
llvm-svn: 84235
2009-10-16 01:58:15 +00:00
Daniel Dunbar
0df659c00b MC: Switch assembler API to using MCExpr instead of MCValue.
llvm-svn: 84234
2009-10-16 01:58:03 +00:00
Daniel Dunbar
fbe8d5891a llvm-mc: Store MCSymbolData value as a pointer (to make MSVC happy).
llvm-svn: 80652
2009-09-01 04:09:03 +00:00
Daniel Dunbar
be245a258c llvm-mc: Make MCSymbolData symbol member const.
llvm-svn: 80573
2009-08-31 08:08:06 +00:00
Daniel Dunbar
1689464a71 llvm-mc: Add MCContext to MCAssembler.
llvm-svn: 80572
2009-08-31 08:07:55 +00:00
Daniel Dunbar
eec2764d55 llvm-mc: Support .comm emission.
llvm-svn: 80351
2009-08-28 07:08:35 +00:00
Daniel Dunbar
5749caa698 llvm-mc: Support .zerofill emission.
- I'm still trying to figure out the cleanest way to implement this and match the assembler, currently there are some substantial differences.

llvm-svn: 80347
2009-08-28 05:49:21 +00:00
Daniel Dunbar
1935aed414 llvm-mc: Tweak section alignment and size computation to match 'as' closer.
llvm-svn: 80345
2009-08-28 05:49:04 +00:00
Daniel Dunbar
7cf576d72f llvm-mc: Fix thinko in emitting values.
llvm-svn: 80340
2009-08-28 05:48:10 +00:00
Daniel Dunbar
efbcc2daf9 Try to make MSVC just a little happier.
llvm-svn: 80187
2009-08-27 00:38:04 +00:00
Daniel Dunbar
1f70368155 llvm-mc/Mach-O: Don't put assembler temporary labels in the symbol table.
- I moved section creation back into AsmParser. I think policy decisions like
   this should be pushed higher, not lower, when possible (in addition the
   assembler has flags which change this behavior, for example).

llvm-svn: 80162
2009-08-26 22:13:22 +00:00
Daniel Dunbar
5e9b7483b7 llvm-mc/Mach-O: Set .subsections_via_symbols flag properly.
llvm-svn: 80144
2009-08-26 21:22:22 +00:00
Daniel Dunbar
8c38017009 llvm-mc/Mach-O: Add support for relocations.
- I haven't really tried to find the "right" way to store the fixups or apply
   them, yet. This works, but isn't particularly elegant or fast.

 - Still no evaluation support, so we don't actually ever not turn a fixup into
   a relocation entry.

llvm-svn: 80089
2009-08-26 13:58:10 +00:00
Daniel Dunbar
45d03f2bbb llvm-mc/Mach-O: Move symbol indices into the MCSymbolData structure.
llvm-svn: 80088
2009-08-26 13:57:54 +00:00
Daniel Dunbar
982f304aac llvm-mc/Mach-O: Add section padding where needed (to align the next section).
Also, simplify some of Mach-O writer code which can now use section addresses.

llvm-svn: 80067
2009-08-26 04:13:32 +00:00
Daniel Dunbar
a36793b5b5 llvm-mc/Mach-O: Set addresses for symbols.
llvm-svn: 80065
2009-08-26 02:48:04 +00:00
Daniel Dunbar
6bb1f76970 llvm-mc: Improve indirect symbol support (add the indirect index table).
llvm-svn: 80059
2009-08-26 00:18:21 +00:00
Daniel Dunbar
d9b0efd553 llvm-mc: Add statistic for number of fragments emitted by the assembler.
llvm-svn: 80033
2009-08-25 21:10:45 +00:00
Daniel Dunbar
344ea15334 llvm-mc/Mach-O: Preliminary support for indirect symbols.
- The indirect table itself isn't being filled in yet.

 - This isn't factored properly and is rather FIXMEd, but at the moment I'm more
   focused on figuring out what it needs to do.

llvm-svn: 79910
2009-08-24 11:56:58 +00:00
Daniel Dunbar
937b745b68 llvm-mc/Mach-O: Support symbol attributes.
- This is mostly complete, the main thing missing is .indirect_symbol support
   (which would be straight-forward, except that the way it is implemented in
   'as' makes getting an exact .o match interesting).

llvm-svn: 79899
2009-08-24 08:40:12 +00:00
Daniel Dunbar
82bf59da54 llvm-mc: Tweak undefined symbol handling.
llvm-svn: 79898
2009-08-24 08:39:57 +00:00
Chris Lattner
39262eb119 prune the #includes in raw_ostream.h by moving a
member out of line. ftostr is not particularly speedy,
so that method is presumably not perf sensitive.

llvm-svn: 79885
2009-08-24 03:52:50 +00:00
Chris Lattner
d786e8929e tweak #includes
llvm-svn: 79744
2009-08-22 19:19:12 +00:00
Daniel Dunbar
4c3cf93d1d llvm-mc/Mach-O: Improve symbol table support:
- Honor .globl.

 - Set symbol type and section correctly ('nm' now works), and order symbols
   appropriately.

 - Take care to the string table so that the .o matches 'as' exactly (for ease
   of testing).

llvm-svn: 79740
2009-08-22 11:41:10 +00:00
Daniel Dunbar
d22c0d4d49 llvm-mc/Mach-O: Sketch symbol table support.
- The only .s syntax this honors right now is emitting labels, and some parts
   of the symbol table generation are wrong or faked.

 - This is enough to get nm to report such symbols... incorrectly, but still.

Also, fixed byte emission to extend the previous fragment if possible.

llvm-svn: 79739
2009-08-22 10:13:24 +00:00
Daniel Dunbar
2b6db55380 llvm-mc/Mach-O: Move more logic for writing the Mach-O file into the writer
class, and kill off MCSectionData::FileOffset.

llvm-svn: 79735
2009-08-22 08:28:27 +00:00
Daniel Dunbar
b367c1724d llvm-mc: Rename / redefine MCFragment::FileOffset to MCFragment::Offset (the
section offset).

llvm-svn: 79734
2009-08-22 08:27:54 +00:00
Daniel Dunbar
aa60fad397 llvm-mc/Mach-O: Support .o emission for .org and .align.
llvm-svn: 79684
2009-08-21 23:07:38 +00:00
Daniel Dunbar
ca9ad524dc llvm-mc/Mach-O: Support byte and fill value emission.
llvm-svn: 79652
2009-08-21 18:29:01 +00:00
Daniel Dunbar
7e81ff0f87 llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.

 - MCAssembler is the actual assembler backend, which is designed to have a
   reasonable API. This will eventually grow to support multiple object file
   implementations, but for now its Mach-O/i386 only.

 - MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
   e.g. converting the various directives into fragments, managing state like
   the current section, and so on.

 - llvm-mc will use the new backend via '-filetype=obj', which may eventually
   be, but is not yet, since I hear that people like assemblers which actually
   assemble.

 - The only thing that works at the moment is changing sections. For the time
   being I have a Python Mach-O dumping tool in test/scripts so this stuff can
   be easily tested, eventually I expect to replace this with a real LLVM tool.

 - More doxyments to come.

I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.

llvm-svn: 79612
2009-08-21 09:11:24 +00:00