OSDN Git Service

Add missing break statements. Align UNWIND_INFO and RUNTIME_FUNCTION structs
authorCharles Davis <cdavis@mines.edu>
Fri, 27 May 2011 02:43:19 +0000 (02:43 +0000)
committerCharles Davis <cdavis@mines.edu>
Fri, 27 May 2011 02:43:19 +0000 (02:43 +0000)
to 4 bytes.

I'm surprised no one caught the missing break statements.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132176 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCWin64EH.cpp

index fc39450..2511e91 100644 (file)
@@ -27,17 +27,21 @@ static uint8_t CountOfUnwindCodes(std::vector<MCWin64EHInstruction> &instArray){
     case Win64EH::UOP_SetFPReg:
     case Win64EH::UOP_PushMachFrame:
       count += 1;
+      break;
     case Win64EH::UOP_SaveNonVol:
     case Win64EH::UOP_SaveXMM128:
       count += 2;
+      break;
     case Win64EH::UOP_SaveNonVolBig:
     case Win64EH::UOP_SaveXMM128Big:
       count += 3;
+      break;
     case Win64EH::UOP_AllocLarge:
       if (I->getSize() > 512*1024-8)
         count += 3;
       else
         count += 2;
+      break;
     }
   }
   return count;
@@ -113,6 +117,7 @@ static void EmitRuntimeFunction(MCStreamer &streamer,
                                 const MCWin64EHUnwindInfo *info) {
   MCContext &context = streamer.getContext();
 
+  streamer.EmitValueToAlignment(4);
   streamer.EmitValue(MCSymbolRefExpr::Create(info->Begin, context), 4);
   streamer.EmitValue(MCSymbolRefExpr::Create(info->End, context), 4);
   streamer.EmitValue(MCSymbolRefExpr::Create(info->Symbol, context), 4);
@@ -123,6 +128,7 @@ static void EmitUnwindInfo(MCStreamer &streamer, MCWin64EHUnwindInfo *info) {
   if (info->Symbol) return;
 
   MCContext &context = streamer.getContext();
+  streamer.EmitValueToAlignment(4);
   // Upper 3 bits are the version number (currently 1).
   uint8_t flags = 0x20;
   info->Symbol = context.CreateTempSymbol();