diff options
author | Charles Davis <cdavis@mines.edu> | 2011-05-23 16:43:09 +0000 |
---|---|---|
committer | Charles Davis <cdavis@mines.edu> | 2011-05-23 16:43:09 +0000 |
commit | d9eafdcfd5b308882fca65e90e7b357c0486757c (patch) | |
tree | 132c303c289bea2483893af488a4713ac1cd6a0e /llvm/lib/MC/MCParser/COFFAsmParser.cpp | |
parent | 4e3f9a4c5c548c52a70c91c24b3eb4bdbaebf1f4 (diff) | |
download | bcm5719-llvm-d9eafdcfd5b308882fca65e90e7b357c0486757c.tar.gz bcm5719-llvm-d9eafdcfd5b308882fca65e90e7b357c0486757c.zip |
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.
llvm-svn: 131899
Diffstat (limited to 'llvm/lib/MC/MCParser/COFFAsmParser.cpp')
-rw-r--r-- | llvm/lib/MC/MCParser/COFFAsmParser.cpp | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/llvm/lib/MC/MCParser/COFFAsmParser.cpp b/llvm/lib/MC/MCParser/COFFAsmParser.cpp index 0045950dcaa..63729a62161 100644 --- a/llvm/lib/MC/MCParser/COFFAsmParser.cpp +++ b/llvm/lib/MC/MCParser/COFFAsmParser.cpp @@ -256,8 +256,17 @@ bool COFFAsmParser::ParseSEHDirectiveSetFrame(StringRef, SMLoc L) { 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 @@ bool COFFAsmParser::ParseSEHDirectiveSaveXMM(StringRef, SMLoc L) { 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) { |