[llvm-commits] [llvm] r132173 - /llvm/trunk/lib/MC/MCStreamer.cpp
Charles Davis
cdavis at mines.edu
Thu May 26 18:42:17 PDT 2011
Author: cdavis
Date: Thu May 26 20:42:17 2011
New Revision: 132173
URL: http://llvm.org/viewvc/llvm-project?rev=132173&view=rev
Log:
Fix inverted conditional in SaveReg and SaveXMM. Err when the frame pointer is
already defined, and err when the PushMachFrame operation isn't the first
operation (if specified at all).
Modified:
llvm/trunk/lib/MC/MCStreamer.cpp
Modified: llvm/trunk/lib/MC/MCStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCStreamer.cpp?rev=132173&r1=132172&r2=132173&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCStreamer.cpp Thu May 26 20:42:17 2011
@@ -389,9 +389,11 @@
void MCStreamer::EmitWin64EHSetFrame(unsigned Register, unsigned Offset) {
EnsureValidW64UnwindInfo();
+ MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo;
+ if (CurFrame->LastFrameInst >= 0)
+ report_fatal_error("Frame register and offset already specified!");
if (Offset & 0x0F)
report_fatal_error("Misaligned frame pointer offset!");
- MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo;
MCWin64EHInstruction Inst(Win64EH::UOP_SetFPReg, Register, Offset);
CurFrame->LastFrameInst = CurFrame->Instructions.size();
CurFrame->Instructions.push_back(Inst);
@@ -412,7 +414,7 @@
report_fatal_error("Misaligned saved register offset!");
MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo;
MCWin64EHInstruction Inst(
- Offset > 512*1024-8 ? Win64EH::UOP_SaveNonVol : Win64EH::UOP_SaveNonVolBig,
+ Offset > 512*1024-8 ? Win64EH::UOP_SaveNonVolBig : Win64EH::UOP_SaveNonVol,
Register, Offset);
CurFrame->Instructions.push_back(Inst);
}
@@ -423,7 +425,7 @@
report_fatal_error("Misaligned saved vector register offset!");
MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo;
MCWin64EHInstruction Inst(
- Offset > 512*1024-16 ? Win64EH::UOP_SaveXMM128 : Win64EH::UOP_SaveXMM128Big,
+ Offset > 512*1024-16 ? Win64EH::UOP_SaveXMM128Big : Win64EH::UOP_SaveXMM128,
Register, Offset);
CurFrame->Instructions.push_back(Inst);
}
@@ -431,6 +433,8 @@
void MCStreamer::EmitWin64EHPushFrame(bool Code) {
EnsureValidW64UnwindInfo();
MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo;
+ if (CurFrame->Instructions.size() > 0)
+ report_fatal_error("If present, PushMachFrame must be the first UOP");
MCWin64EHInstruction Inst(Win64EH::UOP_PushMachFrame, Code);
CurFrame->Instructions.push_back(Inst);
}
More information about the llvm-commits
mailing list