[llvm-commits] [llvm] r99528 - in /llvm/trunk: include/llvm/MC/MCAssembler.h lib/MC/MCAssembler.cpp

Daniel Dunbar daniel at zuster.org
Thu Mar 25 11:16:38 PDT 2010


Author: ddunbar
Date: Thu Mar 25 13:16:38 2010
New Revision: 99528

URL: http://llvm.org/viewvc/llvm-project?rev=99528&view=rev
Log:
MC: Sink Section address assignment into LayoutSection.

Modified:
    llvm/trunk/include/llvm/MC/MCAssembler.h
    llvm/trunk/lib/MC/MCAssembler.cpp

Modified: llvm/trunk/include/llvm/MC/MCAssembler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAssembler.h?rev=99528&r1=99527&r2=99528&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAssembler.h (original)
+++ llvm/trunk/include/llvm/MC/MCAssembler.h Thu Mar 25 13:16:38 2010
@@ -651,10 +651,11 @@
   bool FragmentNeedsRelaxation(const MCInstFragment *IF,
                                const MCAsmLayout &Layout) const;
 
-  /// LayoutSection - Assign offsets and sizes to the fragments in the section
-  /// \arg SD, and update the section size. The section file offset should
-  /// already have been computed.
-  void LayoutSection(MCSectionData &SD, MCAsmLayout &Layout);
+  /// LayoutSection - Assign the section the given \arg StartAddress, and then
+  /// assign offsets and sizes to the fragments in the section \arg SD, and
+  /// update the section size.
+  void LayoutSection(MCSectionData &SD, MCAsmLayout &Layout,
+                     uint64_t StartAddress);
 
   /// LayoutOnce - Perform one layout iteration and return true if any offsets
   /// were adjusted.

Modified: llvm/trunk/lib/MC/MCAssembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=99528&r1=99527&r2=99528&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAssembler.cpp (original)
+++ llvm/trunk/lib/MC/MCAssembler.cpp Thu Mar 25 13:16:38 2010
@@ -365,9 +365,11 @@
 }
 
 void MCAssembler::LayoutSection(MCSectionData &SD,
-                                MCAsmLayout &Layout) {
-  uint64_t Address, StartAddress = Address = Layout.getSectionAddress(&SD);
+                                MCAsmLayout &Layout,
+                                uint64_t StartAddress) {
+  Layout.setSectionAddress(&SD, StartAddress);
 
+  uint64_t Address = StartAddress;
   for (MCSectionData::iterator it = SD.begin(), ie = SD.end(); it != ie; ++it) {
     MCFragment &F = *it;
 
@@ -690,8 +692,7 @@
     }
 
     // Layout the section fragments and its size.
-    Layout.setSectionAddress(&SD, Address);
-    LayoutSection(SD, Layout);
+    LayoutSection(SD, Layout, Address);
     Address += Layout.getSectionFileSize(&SD);
 
     Prev = &SD;
@@ -709,8 +710,7 @@
     if (uint64_t Pad = OffsetToAlignment(Address, it->getAlignment()))
       Address += Pad;
 
-    Layout.setSectionAddress(&SD, Address);
-    LayoutSection(SD, Layout);
+    LayoutSection(SD, Layout, Address);
     Address += Layout.getSectionSize(&SD);
   }
 





More information about the llvm-commits mailing list