Commit Graph

144 Commits

Author SHA1 Message Date
Dan Gohman a76715fc88 Don't call flush() at a library level which isn't checking for errors
and doesn't know where the output is going.

llvm-svn: 105274
2010-06-01 16:31:34 +00:00
Daniel Dunbar b889fc987e MC: When running with -mc-relax-all, we can eagerly relax instructions and avoid creating unnecessary MCInstFragments.
llvm-svn: 104736
2010-05-26 20:37:03 +00:00
Daniel Dunbar 7c8bd0fc98 MC: Change RelaxInstruction to only take the input and output instructions.
llvm-svn: 104713
2010-05-26 18:15:06 +00:00
Daniel Dunbar a19838e107 MC: Simplify MayNeedRelaxation to not provide the fixups, so we can query it
before encoding.

llvm-svn: 104707
2010-05-26 17:45:29 +00:00
Daniel Dunbar b34440a6a8 MC: Eliminate MCAsmFixup, replace with MCFixup.
llvm-svn: 104699
2010-05-26 15:18:56 +00:00
Daniel Dunbar 353a91ff76 MC: Use accessors for access to MCAsmFixup.
llvm-svn: 104697
2010-05-26 15:18:31 +00:00
Daniel Dunbar 870e5759e7 MC: Eliminate MCFragment vtable, which was unnecessary.
llvm-svn: 104689
2010-05-26 06:50:57 +00:00
Daniel Dunbar 4bce748aa2 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 9abade1017 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 3eedc26e18 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 8f9d2266e6 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 a99a23b061 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 b9f6ac094a MC: Move Layout{Fragment,Section} into MCAsmLayout, and add LayoutFile().
llvm-svn: 103738
2010-05-13 20:40:12 +00:00
Daniel Dunbar 454ea716a3 MC: Factor out MCAssembler::ComputeFragmentSize.
llvm-svn: 103724
2010-05-13 18:35:06 +00:00
Daniel Dunbar 484c6fc825 MC: Add section layout order indices to MCSectionData.
llvm-svn: 103715
2010-05-13 15:17:26 +00:00
Daniel Dunbar aa8bd69886 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 e73353c720 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 e8845ef4db MC: Add MCAsmLayout::FragmentReplaced() helper function.
llvm-svn: 103709
2010-05-13 08:43:31 +00:00
Daniel Dunbar 5a93253fc8 Fix -Asserts warning.
llvm-svn: 103697
2010-05-13 03:50:50 +00:00
Daniel Dunbar d83889bd87 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 c7c53ea715 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 a6780da661 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 4dac59dcb7 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 b76df22a2e MC: Move MCAlignFragment::EmitNops value out of the constructor.
llvm-svn: 103665
2010-05-12 22:56:23 +00:00
Daniel Dunbar 4405ffc688 MC: Eliminate MCZeroFillFragment, it is no longer needed.
llvm-svn: 103664
2010-05-12 22:51:38 +00:00
Daniel Dunbar 7cd309f7dc MC: Explicitly check that only virtual fragments appear in virtual sections.
llvm-svn: 103663
2010-05-12 22:51:35 +00:00
Daniel Dunbar 597eb48168 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 51402b79e4 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 7d73564b82 Simplify.
llvm-svn: 103651
2010-05-12 21:47:55 +00:00
Daniel Dunbar a7cc32a7b6 MC: Factor out MCAssembler::LayoutFragment
llvm-svn: 103649
2010-05-12 21:35:25 +00:00
Daniel Dunbar 2abec791f1 MC: Tweak section layout to not relying on accumulating address value.
llvm-svn: 103648
2010-05-12 21:35:22 +00:00
Daniel Dunbar a11479eb49 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 e02c1f6834 MC: Track section layout order explicitly, and use to simplify.
llvm-svn: 103616
2010-05-12 15:42:59 +00:00
Daniel Dunbar ba2f4c3884 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 3937e28da0 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 aadb2cac49 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 ce0c1e11ce 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 2104b8d36e rename llvm::llvm_report_error -> llvm::report_fatal_error
llvm-svn: 100709
2010-04-07 22:58:41 +00:00
Daniel Dunbar d821f4ac60 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 6432bd744e 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 0ba6a671d4 MC: Simplify main section layout process by moving alignment into LayoutSection.
llvm-svn: 99529
2010-03-25 18:16:42 +00:00
Daniel Dunbar 25d114b2b2 MC: Sink Section address assignment into LayoutSection.
llvm-svn: 99528
2010-03-25 18:16:38 +00:00
Daniel Dunbar 4108802628 MC: Explicity track section and fragment ordinals.
llvm-svn: 99500
2010-03-25 07:10:11 +00:00
Daniel Dunbar 5b07334c0d MC: Route access to SectionData offset and file size through MCAsmLayout.
llvm-svn: 99474
2010-03-25 02:00:07 +00:00
Daniel Dunbar 2522dd1c49 MC: Route access to Fragment offset and effective size through MCAsmLayout.
llvm-svn: 99473
2010-03-25 02:00:02 +00:00
Daniel Dunbar 5d98824615 MC: Eliminate MC{Fragment,{Section,Symbol}Data}::getAddress.
llvm-svn: 99467
2010-03-25 01:03:24 +00:00
Daniel Dunbar 7c969558d9 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 5376c2a431 MC: Sprinkle in some more interesting statistics.
llvm-svn: 99350
2010-03-23 23:47:14 +00:00
Daniel Dunbar de04b3f62c 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 86face8333 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