diff options
author | David Sehr <sehr@google.com> | 2012-08-13 14:31:14 -0700 |
---|---|---|
committer | Derek Schuff <dschuff@chromium.org> | 2012-08-13 14:31:14 -0700 |
commit | c1a9e1f9671aac40856979e0f68fd167c0b494f4 (patch) | |
tree | 7a878347b2522c9b1a0758364bdefcfdc55d27b8 /lib | |
parent | 35142769ccfaddc7e16bbc4314bb3d5530b005d0 (diff) |
The structure layout for MCFragment had gaps because of unions, bitfields, etc.,
and 64-bit values (uint64_t and pointers). I have permuted the fields so that
the struct is now 8 bytes (out of 64) smaller than before.
I have also incorporated Jan's suggestions and keyed inserting into the previous
fragment on the MCSectionData flags.
BUG= http://code.google.com/p/nativeclient/issues/detail?id=2545
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10828204/
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MC/MCELFStreamer.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/MC/MCELFStreamer.cpp b/lib/MC/MCELFStreamer.cpp index c569a4b3f4..26b171ed21 100644 --- a/lib/MC/MCELFStreamer.cpp +++ b/lib/MC/MCELFStreamer.cpp @@ -487,13 +487,16 @@ void MCELFStreamer::EmitInstToData(const MCInst &Inst) { } DF->getContents().append(Code.begin(), Code.end()); } else { + // Only create a new fragment if: + // 1) there is no current fragment, + // 2) we are not currently emitting a bundle locked sequence, or + // 3) we are emitting the first instruction of a bundle locked sequence. + // Otherwise, append to the current fragment to reduce the number of + // fragments. MCTinyFragment *TF = dyn_cast_or_null<MCTinyFragment>(getCurrentFragment()); - // A bundle group is a contiguous group of bytes aligned as a unit. We - // always try to append to the current bundle group, if there is one, to - // reduce the number of fragments created. - if (!TF || !TF->isBundleGroupStart() || TF->isBundleGroupEnd()) { - // We need to start a new bundle group. - TF = new MCTinyFragment(getCurrentSectionData()); + MCSectionData *SD = getCurrentSectionData(); + if (!TF || !SD->isBundleLocked() || SD->isBundleGroupFirstFrag()) { + TF = new MCTinyFragment(SD); } TF->getContents().append(Code.begin(), Code.end()); } |