[PATCH] [MC] Write padding into fragments when -mc-relax-all flag is used
Eli Bendersky
eliben at google.com
Wed Mar 11 08:39:32 PDT 2015
================
Comment at: include/llvm/MC/MCAssembler.h:1252
@@ -1251,1 +1251,3 @@
+ void writeFragmentPadding(const MCFragment &F, uint64_t FSize,
+ MCObjectWriter *OW) const;
----------------
Please place all method comments consistently on the method declaration, rather than definition
================
Comment at: include/llvm/MC/MCAssembler.h:1261
@@ +1260,3 @@
+/// \brief Compute the amount of padding required before this fragment to
+/// obey bundling restrictions.
+uint64_t computeBundlePadding(const MCAssembler &Assembler,
----------------
Describe FOffest and FSize
================
Comment at: include/llvm/MC/MCELFStreamer.h:117
@@ -114,1 +116,3 @@
+
+ llvm::SmallVector<MCDataFragment *, 4> BundleGroups;
};
----------------
Describe this new data structure
================
Comment at: lib/MC/MCAssembler.cpp:657
@@ -654,2 +656,3 @@
//
- if (Assembler.isBundlingEnabled() && F->hasInstructions()) {
+ // When relax all flag is used, we optimize the bundling by writting the
+ // padding directly into fragments as the instructions are emitted in the
----------------
writing
================
Comment at: lib/MC/MCAssembler.cpp:725
@@ +724,3 @@
+
+ // FIXME: Embed in fragments instead?
+ uint64_t FragmentSize = Asm.computeFragmentSize(Layout, F);
----------------
So this FIXME is potentially addressed?
================
Comment at: lib/MC/MCELFStreamer.cpp:496
@@ +495,3 @@
+ if (Assembler.getRelaxAll() && SD->isBundleLocked())
+ DF = BundleGroups.back();
+ else if (Assembler.getRelaxAll() && !SD->isBundleLocked())
----------------
Each clause here had a comment explaining what's going on - please preserve that
================
Comment at: lib/MC/MCELFStreamer.cpp:568
@@ -511,1 +567,3 @@
+ if (getAssembler().getRelaxAll() && !SD->isBundleLocked()) {
+ // TODO: drop the lock state and set directly in the fragment
----------------
Add a comment above this block explaining what it's doing
================
Comment at: lib/MC/MCELFStreamer.cpp:589
@@ -526,2 +588,3 @@
- SD->setBundleLockState(MCSectionData::NotBundleLocked);
+ if (getAssembler().getRelaxAll()) {
+ assert(!BundleGroups.empty() && "There are no bundle groups");
----------------
Add a comment above this block explaining what it's doing
http://reviews.llvm.org/D8072
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list