Fix action No calculation in multiple-invoke-one-LP mode
authorAnton Korobeynikov <asl@math.spbu.ru>
Fri, 11 May 2007 08:23:57 +0000 (08:23 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Fri, 11 May 2007 08:23:57 +0000 (08:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36987 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/DwarfWriter.cpp

index 44809213f9fb0109a311b13cd9e5cb082d34df6a..29f428b7e9b798f95d4da89ea28707ce0b5c4f23 100644 (file)
@@ -2934,41 +2934,41 @@ private:
       unsigned SizeAction = 0;
       signed FirstAction;
 
-      for (unsigned j = 0, E = LandingPad.BeginLabels.size(); j != E; ++j) {
-        if (IsFilter) {
-          // FIXME - Assume there is only one filter typeinfo list per function
-          // time being.  I.E., Each call to eh_filter will have the same list.
-          // This can change if a function is inlined. 
-          Filter = &LandingPad;
-          SizeAction =  Asm->SizeSLEB128(-1) + Asm->SizeSLEB128(0);
+      if (IsFilter) {
+        // FIXME - Assume there is only one filter typeinfo list per function
+        // time being.  I.E., Each call to eh_filter will have the same list.
+        // This can change if a function is inlined. 
+        Filter = &LandingPad;
+        SizeAction =  Asm->SizeSLEB128(-1) + Asm->SizeSLEB128(0);
+        SizeSiteActions += SizeAction;
+        // Record the first action of the landing pad site.
+        FirstAction = SizeActions + SizeSiteActions - SizeAction + 1;
+      } else if (TypeIds.empty()) {
+        FirstAction = 0;
+      } else {
+        // Gather the action sizes
+        for (unsigned j = 0, M = TypeIds.size(); j != M; ++j) {
+          unsigned TypeID = TypeIds[j];
+          unsigned SizeTypeID = Asm->SizeSLEB128(TypeID);
+          signed Action = j ? -(SizeAction + SizeTypeID) : 0;
+          SizeAction = SizeTypeID + Asm->SizeSLEB128(Action);
           SizeSiteActions += SizeAction;
-          // Record the first action of the landing pad site.
-          FirstAction = SizeActions + SizeSiteActions - SizeAction + 1;
-        } else if (TypeIds.empty()) {
-          FirstAction = 0;
-        } else {
-          // Gather the action sizes
-          for (unsigned k = 0, M = TypeIds.size(); k != M; ++k) {
-            unsigned TypeID = TypeIds[k];
-            unsigned SizeTypeID = Asm->SizeSLEB128(TypeID);
-            signed Action = k ? -(SizeAction + SizeTypeID) : 0;
-            SizeAction = SizeTypeID + Asm->SizeSLEB128(Action);
-            SizeSiteActions += SizeAction;
-          }
-        
-          // Record the first action of the landing pad site.
-          FirstAction = SizeActions + SizeSiteActions - SizeAction + 1;
         }
-      
-        Actions.push_back(FirstAction);
         
-        // Compute this sites contribution to size.
-        SizeActions += SizeSiteActions;
-        SizeSites += sizeof(int32_t) + // Site start.
-                     sizeof(int32_t) + // Site length.
-                     sizeof(int32_t) + // Landing pad.
-                     Asm->SizeSLEB128(FirstAction); // Action.
+        // Record the first action of the landing pad site.
+        FirstAction = SizeActions + SizeSiteActions - SizeAction + 1;
       }
+
+      unsigned M = LandingPad.BeginLabels.size();
+      for (unsigned j = 0; j!=M; ++j)
+        Actions.push_back(FirstAction);
+        
+      // Compute this sites contribution to size.
+      SizeActions += SizeSiteActions*M;
+      SizeSites += M*(sizeof(int32_t) +               // Site start.
+                      sizeof(int32_t) +               // Site length.
+                      sizeof(int32_t) +               // Landing pad.
+                      Asm->SizeSLEB128(FirstAction)); // Action.
     }
     
     // Final tallies.