[llvm-commits] [llvm] r131525 - /llvm/trunk/lib/MC/MCAsmStreamer.cpp
Charles Davis
cdavis at mines.edu
Tue May 17 21:58:05 PDT 2011
Author: cdavis
Date: Tue May 17 23:58:05 2011
New Revision: 131525
URL: http://llvm.org/viewvc/llvm-project?rev=131525&view=rev
Log:
Implement the Win64 EH directive methods for the assembly language streamer.
GAS has no such directives (not even mingw-w64 GAS has them), so I took
creative license with their names in assembly. I prefixed them all with
"w64_" to avoid namespace collisions, for example. If I discover that GAS
has taken a different approach, I'll change ours to match.
Modified:
llvm/trunk/lib/MC/MCAsmStreamer.cpp
Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=131525&r1=131524&r2=131525&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Tue May 17 23:58:05 2011
@@ -208,6 +208,15 @@
virtual void EmitCFIRelOffset(int64_t Register, int64_t Offset);
virtual void EmitCFIAdjustCfaOffset(int64_t Adjustment);
+ virtual void EmitWin64EHStartProc(MCSymbol *Symbol, MCSymbol *EHandler = 0);
+ virtual void EmitWin64EHEndProc();
+ virtual void EmitWin64EHPushReg(int64_t Register);
+ virtual void EmitWin64EHSetFrame(int64_t Register, int64_t Offset);
+ virtual void EmitWin64EHAllocStack(int64_t Size);
+ virtual void EmitWin64EHSaveReg(int64_t Register, int64_t Offset);
+ virtual void EmitWin64EHPushFrame(bool Code);
+ virtual void EmitWin64EHEndProlog();
+
virtual void EmitFnStart();
virtual void EmitFnEnd();
virtual void EmitCantUnwind();
@@ -915,6 +924,74 @@
EmitEOL();
}
+void MCAsmStreamer::EmitWin64EHStartProc(MCSymbol *Symbol, MCSymbol *EHandler)
+{
+ //MCStreamer::EmitWin64EHStartProc(Symbol, EHandler);
+
+ OS << ".w64_startproc " << *Symbol;
+ if (EHandler)
+ OS << ", " << *EHandler;
+ EmitEOL();
+}
+
+void MCAsmStreamer::EmitWin64EHEndProc()
+{
+ //MCStreamer::EmitWin64EHEndProc();
+
+ OS << "\t.w64_endproc";
+ EmitEOL();
+}
+
+void MCAsmStreamer::EmitWin64EHPushReg(int64_t Register)
+{
+ //MCStreamer::EmitWin64EHPushReg(Register);
+
+ OS << "\t.w64_pushreg " << Register;
+ EmitEOL();
+}
+
+void MCAsmStreamer::EmitWin64EHSetFrame(int64_t Register, int64_t Offset)
+{
+ //MCStreamer::EmitWin64EHSetFrame(Register, Offset);
+
+ OS << "\t.w64_setframe " << Register << ", " << Offset;
+ EmitEOL();
+}
+
+void MCAsmStreamer::EmitWin64EHAllocStack(int64_t Size)
+{
+ //MCStremaer::EmitWin64EHAllocStack(Size);
+
+ OS << "\t.w64_allocstack " << Size;
+ EmitEOL();
+}
+
+void MCAsmStreamer::EmitWin64EHSaveReg(int64_t Register, int64_t Offset)
+{
+ //MCStreamer::EmitWin64EHSaveReg(Register, Offset)
+
+ OS << "\t.w64_savereg " << Register << ", " << Offset;
+ EmitEOL();
+}
+
+void MCAsmStreamer::EmitWin64EHPushFrame(bool Code)
+{
+ //MCStreamer::EmitWin64EHPushFrame(Code);
+
+ OS << "\t.w64_pushframe";
+ if (Code)
+ OS << " " << "code";
+ EmitEOL();
+}
+
+void MCAsmStreamer::EmitWin64EHEndProlog(void)
+{
+ //MCStreamer::EmitWin64EHEndProlog();
+
+ OS << "\t.w64_endprolog";
+ EmitEOL();
+}
+
void MCAsmStreamer::AddEncodingComment(const MCInst &Inst) {
raw_ostream &OS = GetCommentOS();
SmallString<256> Code;
More information about the llvm-commits
mailing list