[llvm-commits] [llvm] r131899 - /llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp
Charles Davis
cdavis at mines.edu
Mon May 23 09:43:09 PDT 2011
Author: cdavis
Date: Mon May 23 11:43:09 2011
New Revision: 131899
URL: http://llvm.org/viewvc/llvm-project?rev=131899&view=rev
Log:
Implement .seh_stackalloc and .seh_pushframe parsing.
I haven't implemented any of the ones that take registers yet. The problem is
that for x86-64 the streamer methods expect a native x86 register number (note:
%r8-%r15 want 8-15 instead of 0-7; same for %xmm8-%xmm15). I haven't figured
out exactly how I want to do that yet.
Modified:
llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp
Modified: llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp?rev=131899&r1=131898&r2=131899&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp Mon May 23 11:43:09 2011
@@ -256,8 +256,17 @@
return Error(L, "not implemented yet");
}
-bool COFFAsmParser::ParseSEHDirectiveAllocStack(StringRef, SMLoc L) {
- return Error(L, "not implemented yet");
+bool COFFAsmParser::ParseSEHDirectiveAllocStack(StringRef, SMLoc) {
+ int64_t Size;
+ if (getParser().ParseAbsoluteExpression(Size))
+ return true;
+
+ if (getLexer().isNot(AsmToken::EndOfStatement))
+ return TokError("unexpected token in directive");
+
+ Lex();
+ getStreamer().EmitWin64EHAllocStack(Size);
+ return false;
}
bool COFFAsmParser::ParseSEHDirectiveSaveReg(StringRef, SMLoc L) {
@@ -268,8 +277,22 @@
return Error(L, "not implemented yet");
}
-bool COFFAsmParser::ParseSEHDirectivePushFrame(StringRef, SMLoc L) {
- return Error(L, "not implemented yet");
+bool COFFAsmParser::ParseSEHDirectivePushFrame(StringRef, SMLoc) {
+ bool Code;
+ StringRef CodeID;
+ SMLoc startLoc = getLexer().getLoc();
+ if (!getParser().ParseIdentifier(CodeID)) {
+ if (CodeID != "@code")
+ return Error(startLoc, "expected @code");
+ Code = true;
+ }
+
+ if (getLexer().isNot(AsmToken::EndOfStatement))
+ return TokError("unexpected token in directive");
+
+ Lex();
+ getStreamer().EmitWin64EHPushFrame(Code);
+ return false;
}
bool COFFAsmParser::ParseSEHDirectiveEndProlog(StringRef, SMLoc) {
More information about the llvm-commits
mailing list