aboutsummaryrefslogtreecommitdiff
path: root/lib/MC
diff options
context:
space:
mode:
authorCharles Davis <cdavis@mines.edu>2011-05-18 04:58:05 +0000
committerCharles Davis <cdavis@mines.edu>2011-05-18 04:58:05 +0000
commit0e30f02f44185b43d279b7b3ef8b3356f2b5c7cb (patch)
tree9aeb36a9c3e13ab7cedebb83ceb7c1f7cd2deda1 /lib/MC
parent54f0d1e02123683c957bc2c2c2a1adde4d374da4 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131525 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r--lib/MC/MCAsmStreamer.cpp77
1 files changed, 77 insertions, 0 deletions
diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp
index ee68a377e3..41a821dbb9 100644
--- a/lib/MC/MCAsmStreamer.cpp
+++ b/lib/MC/MCAsmStreamer.cpp
@@ -208,6 +208,15 @@ public:
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 @@ void MCAsmStreamer::EmitCFIAdjustCfaOffset(int64_t Adjustment) {
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;