1 //===- COFFAsmParser.cpp - COFF Assembly Parser ---------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/MC/MCParser/MCAsmParserExtension.h"
11 #include "llvm/ADT/StringSwitch.h"
12 #include "llvm/ADT/Twine.h"
13 #include "llvm/MC/MCAsmInfo.h"
14 #include "llvm/MC/MCContext.h"
15 #include "llvm/MC/MCExpr.h"
16 #include "llvm/MC/MCObjectFileInfo.h"
17 #include "llvm/MC/MCParser/MCAsmLexer.h"
18 #include "llvm/MC/MCRegisterInfo.h"
19 #include "llvm/MC/MCSectionCOFF.h"
20 #include "llvm/MC/MCStreamer.h"
21 #include "llvm/MC/MCTargetAsmParser.h"
22 #include "llvm/Support/COFF.h"
27 class COFFAsmParser : public MCAsmParserExtension {
28 template<bool (COFFAsmParser::*HandlerMethod)(StringRef, SMLoc)>
29 void addDirectiveHandler(StringRef Directive) {
30 MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
31 this, HandleDirective<COFFAsmParser, HandlerMethod>);
32 getParser().addDirectiveHandler(Directive, Handler);
35 bool ParseSectionSwitch(StringRef Section,
36 unsigned Characteristics,
39 bool ParseSectionSwitch(StringRef Section, unsigned Characteristics,
40 SectionKind Kind, StringRef COMDATSymName,
41 COFF::COMDATType Type);
43 bool ParseSectionName(StringRef &SectionName);
44 bool ParseSectionFlags(StringRef FlagsString, unsigned* Flags);
46 void Initialize(MCAsmParser &Parser) override {
47 // Call the base implementation.
48 MCAsmParserExtension::Initialize(Parser);
50 addDirectiveHandler<&COFFAsmParser::ParseSectionDirectiveText>(".text");
51 addDirectiveHandler<&COFFAsmParser::ParseSectionDirectiveData>(".data");
52 addDirectiveHandler<&COFFAsmParser::ParseSectionDirectiveBSS>(".bss");
53 addDirectiveHandler<&COFFAsmParser::ParseDirectiveSection>(".section");
54 addDirectiveHandler<&COFFAsmParser::ParseDirectiveDef>(".def");
55 addDirectiveHandler<&COFFAsmParser::ParseDirectiveScl>(".scl");
56 addDirectiveHandler<&COFFAsmParser::ParseDirectiveType>(".type");
57 addDirectiveHandler<&COFFAsmParser::ParseDirectiveEndef>(".endef");
58 addDirectiveHandler<&COFFAsmParser::ParseDirectiveSecRel32>(".secrel32");
59 addDirectiveHandler<&COFFAsmParser::ParseDirectiveSecIdx>(".secidx");
60 addDirectiveHandler<&COFFAsmParser::ParseDirectiveLinkOnce>(".linkonce");
62 // Win64 EH directives.
63 addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveStartProc>(
65 addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveEndProc>(
67 addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveStartChained>(
69 addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveEndChained>(
71 addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveHandler>(
73 addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveHandlerData>(
75 addDirectiveHandler<&COFFAsmParser::ParseSEHDirectivePushReg>(
77 addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveSetFrame>(
79 addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveAllocStack>(
81 addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveSaveReg>(
83 addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveSaveXMM>(
85 addDirectiveHandler<&COFFAsmParser::ParseSEHDirectivePushFrame>(
87 addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveEndProlog>(
89 addDirectiveHandler<&COFFAsmParser::ParseDirectiveSymbolAttribute>(".weak");
92 bool ParseSectionDirectiveText(StringRef, SMLoc) {
93 return ParseSectionSwitch(".text",
94 COFF::IMAGE_SCN_CNT_CODE
95 | COFF::IMAGE_SCN_MEM_EXECUTE
96 | COFF::IMAGE_SCN_MEM_READ,
97 SectionKind::getText());
99 bool ParseSectionDirectiveData(StringRef, SMLoc) {
100 return ParseSectionSwitch(".data",
101 COFF::IMAGE_SCN_CNT_INITIALIZED_DATA
102 | COFF::IMAGE_SCN_MEM_READ
103 | COFF::IMAGE_SCN_MEM_WRITE,
104 SectionKind::getDataRel());
106 bool ParseSectionDirectiveBSS(StringRef, SMLoc) {
107 return ParseSectionSwitch(".bss",
108 COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA
109 | COFF::IMAGE_SCN_MEM_READ
110 | COFF::IMAGE_SCN_MEM_WRITE,
111 SectionKind::getBSS());
114 bool ParseDirectiveSection(StringRef, SMLoc);
115 bool ParseDirectiveDef(StringRef, SMLoc);
116 bool ParseDirectiveScl(StringRef, SMLoc);
117 bool ParseDirectiveType(StringRef, SMLoc);
118 bool ParseDirectiveEndef(StringRef, SMLoc);
119 bool ParseDirectiveSecRel32(StringRef, SMLoc);
120 bool ParseDirectiveSecIdx(StringRef, SMLoc);
121 bool parseCOMDATType(COFF::COMDATType &Type);
122 bool ParseDirectiveLinkOnce(StringRef, SMLoc);
124 // Win64 EH directives.
125 bool ParseSEHDirectiveStartProc(StringRef, SMLoc);
126 bool ParseSEHDirectiveEndProc(StringRef, SMLoc);
127 bool ParseSEHDirectiveStartChained(StringRef, SMLoc);
128 bool ParseSEHDirectiveEndChained(StringRef, SMLoc);
129 bool ParseSEHDirectiveHandler(StringRef, SMLoc);
130 bool ParseSEHDirectiveHandlerData(StringRef, SMLoc);
131 bool ParseSEHDirectivePushReg(StringRef, SMLoc);
132 bool ParseSEHDirectiveSetFrame(StringRef, SMLoc);
133 bool ParseSEHDirectiveAllocStack(StringRef, SMLoc);
134 bool ParseSEHDirectiveSaveReg(StringRef, SMLoc);
135 bool ParseSEHDirectiveSaveXMM(StringRef, SMLoc);
136 bool ParseSEHDirectivePushFrame(StringRef, SMLoc);
137 bool ParseSEHDirectiveEndProlog(StringRef, SMLoc);
139 bool ParseAtUnwindOrAtExcept(bool &unwind, bool &except);
140 bool ParseSEHRegisterNumber(unsigned &RegNo);
141 bool ParseDirectiveSymbolAttribute(StringRef Directive, SMLoc);
146 } // end annonomous namespace.
148 static SectionKind computeSectionKind(unsigned Flags) {
149 if (Flags & COFF::IMAGE_SCN_MEM_EXECUTE)
150 return SectionKind::getText();
151 if (Flags & COFF::IMAGE_SCN_MEM_READ &&
152 (Flags & COFF::IMAGE_SCN_MEM_WRITE) == 0)
153 return SectionKind::getReadOnly();
154 return SectionKind::getDataRel();
157 bool COFFAsmParser::ParseSectionFlags(StringRef FlagsString, unsigned* Flags) {
170 bool ReadOnlyRemoved = false;
171 unsigned SecFlags = None;
173 for (unsigned i = 0; i < FlagsString.size(); ++i) {
174 switch (FlagsString[i]) {
179 case 'b': // bss section
181 if (SecFlags & InitData)
182 return TokError("conflicting section flags 'b' and 'd'.");
186 case 'd': // data section
187 SecFlags |= InitData;
188 if (SecFlags & Alloc)
189 return TokError("conflicting section flags 'b' and 'd'.");
190 SecFlags &= ~NoWrite;
191 if ((SecFlags & NoLoad) == 0)
195 case 'n': // section is not loaded
200 case 'r': // read-only
201 ReadOnlyRemoved = false;
203 if ((SecFlags & Code) == 0)
204 SecFlags |= InitData;
205 if ((SecFlags & NoLoad) == 0)
209 case 's': // shared section
210 SecFlags |= Shared | InitData;
211 SecFlags &= ~NoWrite;
212 if ((SecFlags & NoLoad) == 0)
216 case 'w': // writable
217 SecFlags &= ~NoWrite;
218 ReadOnlyRemoved = true;
221 case 'x': // executable section
223 if ((SecFlags & NoLoad) == 0)
225 if (!ReadOnlyRemoved)
229 case 'y': // not readable
230 SecFlags |= NoRead | NoWrite;
234 return TokError("unknown flag");
240 if (SecFlags == None)
244 *Flags |= COFF::IMAGE_SCN_CNT_CODE | COFF::IMAGE_SCN_MEM_EXECUTE;
245 if (SecFlags & InitData)
246 *Flags |= COFF::IMAGE_SCN_CNT_INITIALIZED_DATA;
247 if ((SecFlags & Alloc) && (SecFlags & Load) == 0)
248 *Flags |= COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA;
249 if (SecFlags & NoLoad)
250 *Flags |= COFF::IMAGE_SCN_LNK_REMOVE;
251 if ((SecFlags & NoRead) == 0)
252 *Flags |= COFF::IMAGE_SCN_MEM_READ;
253 if ((SecFlags & NoWrite) == 0)
254 *Flags |= COFF::IMAGE_SCN_MEM_WRITE;
255 if (SecFlags & Shared)
256 *Flags |= COFF::IMAGE_SCN_MEM_SHARED;
261 /// ParseDirectiveSymbolAttribute
262 /// ::= { ".weak", ... } [ identifier ( , identifier )* ]
263 bool COFFAsmParser::ParseDirectiveSymbolAttribute(StringRef Directive, SMLoc) {
264 MCSymbolAttr Attr = StringSwitch<MCSymbolAttr>(Directive)
265 .Case(".weak", MCSA_Weak)
266 .Default(MCSA_Invalid);
267 assert(Attr != MCSA_Invalid && "unexpected symbol attribute directive!");
268 if (getLexer().isNot(AsmToken::EndOfStatement)) {
272 if (getParser().parseIdentifier(Name))
273 return TokError("expected identifier in directive");
275 MCSymbol *Sym = getContext().GetOrCreateSymbol(Name);
277 getStreamer().EmitSymbolAttribute(Sym, Attr);
279 if (getLexer().is(AsmToken::EndOfStatement))
282 if (getLexer().isNot(AsmToken::Comma))
283 return TokError("unexpected token in directive");
292 bool COFFAsmParser::ParseSectionSwitch(StringRef Section,
293 unsigned Characteristics,
295 return ParseSectionSwitch(Section, Characteristics, Kind, "", (COFF::COMDATType)0);
298 bool COFFAsmParser::ParseSectionSwitch(StringRef Section,
299 unsigned Characteristics,
301 StringRef COMDATSymName,
302 COFF::COMDATType Type) {
303 if (getLexer().isNot(AsmToken::EndOfStatement))
304 return TokError("unexpected token in section switching directive");
307 getStreamer().SwitchSection(getContext().getCOFFSection(
308 Section, Characteristics, Kind, COMDATSymName, Type));
313 bool COFFAsmParser::ParseSectionName(StringRef &SectionName) {
314 if (!getLexer().is(AsmToken::Identifier))
317 SectionName = getTok().getIdentifier();
322 // .section name [, "flags"] [, identifier [ identifier ], identifier]
326 // b: BSS section (uninitialized data)
327 // d: data section (initialized data)
328 // n: Discardable section
329 // r: Readable section
331 // w: Writable section
332 // x: Executable section
333 // y: Not-readable section (clears 'r')
335 // Subsections are not supported.
336 bool COFFAsmParser::ParseDirectiveSection(StringRef, SMLoc) {
337 StringRef SectionName;
339 if (ParseSectionName(SectionName))
340 return TokError("expected identifier in directive");
342 unsigned Flags = COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
343 COFF::IMAGE_SCN_MEM_READ |
344 COFF::IMAGE_SCN_MEM_WRITE;
346 if (getLexer().is(AsmToken::Comma)) {
349 if (getLexer().isNot(AsmToken::String))
350 return TokError("expected string in directive");
352 StringRef FlagsStr = getTok().getStringContents();
355 if (ParseSectionFlags(FlagsStr, &Flags))
359 COFF::COMDATType Type = (COFF::COMDATType)0;
360 StringRef COMDATSymName;
361 if (getLexer().is(AsmToken::Comma)) {
362 Type = COFF::IMAGE_COMDAT_SELECT_ANY;;
365 Flags |= COFF::IMAGE_SCN_LNK_COMDAT;
367 if (parseCOMDATType(Type))
370 if (getLexer().isNot(AsmToken::Comma))
371 return TokError("expected comma in directive");
374 if (getParser().parseIdentifier(COMDATSymName))
375 return TokError("expected identifier in directive");
378 if (getLexer().isNot(AsmToken::EndOfStatement))
379 return TokError("unexpected token in directive");
381 SectionKind Kind = computeSectionKind(Flags);
383 const Triple &T = getContext().getObjectFileInfo()->getTargetTriple();
384 if (T.getArch() == Triple::arm || T.getArch() == Triple::thumb)
385 Flags |= COFF::IMAGE_SCN_MEM_16BIT;
387 ParseSectionSwitch(SectionName, Flags, Kind, COMDATSymName, Type);
391 bool COFFAsmParser::ParseDirectiveDef(StringRef, SMLoc) {
392 StringRef SymbolName;
394 if (getParser().parseIdentifier(SymbolName))
395 return TokError("expected identifier in directive");
397 MCSymbol *Sym = getContext().GetOrCreateSymbol(SymbolName);
399 getStreamer().BeginCOFFSymbolDef(Sym);
405 bool COFFAsmParser::ParseDirectiveScl(StringRef, SMLoc) {
406 int64_t SymbolStorageClass;
407 if (getParser().parseAbsoluteExpression(SymbolStorageClass))
410 if (getLexer().isNot(AsmToken::EndOfStatement))
411 return TokError("unexpected token in directive");
414 getStreamer().EmitCOFFSymbolStorageClass(SymbolStorageClass);
418 bool COFFAsmParser::ParseDirectiveType(StringRef, SMLoc) {
420 if (getParser().parseAbsoluteExpression(Type))
423 if (getLexer().isNot(AsmToken::EndOfStatement))
424 return TokError("unexpected token in directive");
427 getStreamer().EmitCOFFSymbolType(Type);
431 bool COFFAsmParser::ParseDirectiveEndef(StringRef, SMLoc) {
433 getStreamer().EndCOFFSymbolDef();
437 bool COFFAsmParser::ParseDirectiveSecRel32(StringRef, SMLoc) {
439 if (getParser().parseIdentifier(SymbolID))
440 return TokError("expected identifier in directive");
442 if (getLexer().isNot(AsmToken::EndOfStatement))
443 return TokError("unexpected token in directive");
445 MCSymbol *Symbol = getContext().GetOrCreateSymbol(SymbolID);
448 getStreamer().EmitCOFFSecRel32(Symbol);
452 bool COFFAsmParser::ParseDirectiveSecIdx(StringRef, SMLoc) {
454 if (getParser().parseIdentifier(SymbolID))
455 return TokError("expected identifier in directive");
457 if (getLexer().isNot(AsmToken::EndOfStatement))
458 return TokError("unexpected token in directive");
460 MCSymbol *Symbol = getContext().GetOrCreateSymbol(SymbolID);
463 getStreamer().EmitCOFFSectionIndex(Symbol);
467 /// ::= [ identifier ]
468 bool COFFAsmParser::parseCOMDATType(COFF::COMDATType &Type) {
469 StringRef TypeId = getTok().getIdentifier();
471 Type = StringSwitch<COFF::COMDATType>(TypeId)
472 .Case("one_only", COFF::IMAGE_COMDAT_SELECT_NODUPLICATES)
473 .Case("discard", COFF::IMAGE_COMDAT_SELECT_ANY)
474 .Case("same_size", COFF::IMAGE_COMDAT_SELECT_SAME_SIZE)
475 .Case("same_contents", COFF::IMAGE_COMDAT_SELECT_EXACT_MATCH)
476 .Case("associative", COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE)
477 .Case("largest", COFF::IMAGE_COMDAT_SELECT_LARGEST)
478 .Case("newest", COFF::IMAGE_COMDAT_SELECT_NEWEST)
479 .Default((COFF::COMDATType)0);
482 return TokError(Twine("unrecognized COMDAT type '" + TypeId + "'"));
489 /// ParseDirectiveLinkOnce
490 /// ::= .linkonce [ identifier ]
491 bool COFFAsmParser::ParseDirectiveLinkOnce(StringRef, SMLoc Loc) {
492 COFF::COMDATType Type = COFF::IMAGE_COMDAT_SELECT_ANY;
493 if (getLexer().is(AsmToken::Identifier))
494 if (parseCOMDATType(Type))
497 const MCSectionCOFF *Current = static_cast<const MCSectionCOFF*>(
498 getStreamer().getCurrentSection().first);
500 if (Type == COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE)
501 return Error(Loc, "cannot make section associative with .linkonce");
503 if (Current->getCharacteristics() & COFF::IMAGE_SCN_LNK_COMDAT)
504 return Error(Loc, Twine("section '") + Current->getSectionName() +
505 "' is already linkonce");
507 Current->setSelection(Type);
509 if (getLexer().isNot(AsmToken::EndOfStatement))
510 return TokError("unexpected token in directive");
515 bool COFFAsmParser::ParseSEHDirectiveStartProc(StringRef, SMLoc) {
517 if (getParser().parseIdentifier(SymbolID))
520 if (getLexer().isNot(AsmToken::EndOfStatement))
521 return TokError("unexpected token in directive");
523 MCSymbol *Symbol = getContext().GetOrCreateSymbol(SymbolID);
526 getStreamer().EmitWinCFIStartProc(Symbol);
530 bool COFFAsmParser::ParseSEHDirectiveEndProc(StringRef, SMLoc) {
532 getStreamer().EmitWinCFIEndProc();
536 bool COFFAsmParser::ParseSEHDirectiveStartChained(StringRef, SMLoc) {
538 getStreamer().EmitWinCFIStartChained();
542 bool COFFAsmParser::ParseSEHDirectiveEndChained(StringRef, SMLoc) {
544 getStreamer().EmitWinCFIEndChained();
548 bool COFFAsmParser::ParseSEHDirectiveHandler(StringRef, SMLoc) {
550 if (getParser().parseIdentifier(SymbolID))
553 if (getLexer().isNot(AsmToken::Comma))
554 return TokError("you must specify one or both of @unwind or @except");
556 bool unwind = false, except = false;
557 if (ParseAtUnwindOrAtExcept(unwind, except))
559 if (getLexer().is(AsmToken::Comma)) {
561 if (ParseAtUnwindOrAtExcept(unwind, except))
564 if (getLexer().isNot(AsmToken::EndOfStatement))
565 return TokError("unexpected token in directive");
567 MCSymbol *handler = getContext().GetOrCreateSymbol(SymbolID);
570 getStreamer().EmitWinEHHandler(handler, unwind, except);
574 bool COFFAsmParser::ParseSEHDirectiveHandlerData(StringRef, SMLoc) {
576 getStreamer().EmitWinEHHandlerData();
580 bool COFFAsmParser::ParseSEHDirectivePushReg(StringRef, SMLoc L) {
582 if (ParseSEHRegisterNumber(Reg))
585 if (getLexer().isNot(AsmToken::EndOfStatement))
586 return TokError("unexpected token in directive");
589 getStreamer().EmitWinCFIPushReg(Reg);
593 bool COFFAsmParser::ParseSEHDirectiveSetFrame(StringRef, SMLoc L) {
596 if (ParseSEHRegisterNumber(Reg))
598 if (getLexer().isNot(AsmToken::Comma))
599 return TokError("you must specify a stack pointer offset");
602 SMLoc startLoc = getLexer().getLoc();
603 if (getParser().parseAbsoluteExpression(Off))
607 return Error(startLoc, "offset is not a multiple of 16");
609 if (getLexer().isNot(AsmToken::EndOfStatement))
610 return TokError("unexpected token in directive");
613 getStreamer().EmitWinCFISetFrame(Reg, Off);
617 bool COFFAsmParser::ParseSEHDirectiveAllocStack(StringRef, SMLoc) {
619 SMLoc startLoc = getLexer().getLoc();
620 if (getParser().parseAbsoluteExpression(Size))
624 return Error(startLoc, "size is not a multiple of 8");
626 if (getLexer().isNot(AsmToken::EndOfStatement))
627 return TokError("unexpected token in directive");
630 getStreamer().EmitWinCFIAllocStack(Size);
634 bool COFFAsmParser::ParseSEHDirectiveSaveReg(StringRef, SMLoc L) {
637 if (ParseSEHRegisterNumber(Reg))
639 if (getLexer().isNot(AsmToken::Comma))
640 return TokError("you must specify an offset on the stack");
643 SMLoc startLoc = getLexer().getLoc();
644 if (getParser().parseAbsoluteExpression(Off))
648 return Error(startLoc, "size is not a multiple of 8");
650 if (getLexer().isNot(AsmToken::EndOfStatement))
651 return TokError("unexpected token in directive");
654 // FIXME: Err on %xmm* registers
655 getStreamer().EmitWinCFISaveReg(Reg, Off);
659 // FIXME: This method is inherently x86-specific. It should really be in the
661 bool COFFAsmParser::ParseSEHDirectiveSaveXMM(StringRef, SMLoc L) {
664 if (ParseSEHRegisterNumber(Reg))
666 if (getLexer().isNot(AsmToken::Comma))
667 return TokError("you must specify an offset on the stack");
670 SMLoc startLoc = getLexer().getLoc();
671 if (getParser().parseAbsoluteExpression(Off))
674 if (getLexer().isNot(AsmToken::EndOfStatement))
675 return TokError("unexpected token in directive");
678 return Error(startLoc, "offset is not a multiple of 16");
681 // FIXME: Err on non-%xmm* registers
682 getStreamer().EmitWinCFISaveXMM(Reg, Off);
686 bool COFFAsmParser::ParseSEHDirectivePushFrame(StringRef, SMLoc) {
689 if (getLexer().is(AsmToken::At)) {
690 SMLoc startLoc = getLexer().getLoc();
692 if (!getParser().parseIdentifier(CodeID)) {
693 if (CodeID != "code")
694 return Error(startLoc, "expected @code");
699 if (getLexer().isNot(AsmToken::EndOfStatement))
700 return TokError("unexpected token in directive");
703 getStreamer().EmitWinCFIPushFrame(Code);
707 bool COFFAsmParser::ParseSEHDirectiveEndProlog(StringRef, SMLoc) {
709 getStreamer().EmitWinCFIEndProlog();
713 bool COFFAsmParser::ParseAtUnwindOrAtExcept(bool &unwind, bool &except) {
714 StringRef identifier;
715 if (getLexer().isNot(AsmToken::At))
716 return TokError("a handler attribute must begin with '@'");
717 SMLoc startLoc = getLexer().getLoc();
719 if (getParser().parseIdentifier(identifier))
720 return Error(startLoc, "expected @unwind or @except");
721 if (identifier == "unwind")
723 else if (identifier == "except")
726 return Error(startLoc, "expected @unwind or @except");
730 bool COFFAsmParser::ParseSEHRegisterNumber(unsigned &RegNo) {
731 SMLoc startLoc = getLexer().getLoc();
732 if (getLexer().is(AsmToken::Percent)) {
733 const MCRegisterInfo *MRI = getContext().getRegisterInfo();
736 if (getParser().getTargetParser().ParseRegister(LLVMRegNo,startLoc,endLoc))
740 // FIXME: TargetAsmInfo::getCalleeSavedRegs() commits a serious layering
741 // violation so this validation code is disabled.
743 // Check that this is a non-volatile register.
744 const unsigned *NVRegs = TAI.getCalleeSavedRegs();
746 for (i = 0; NVRegs[i] != 0; ++i)
747 if (NVRegs[i] == LLVMRegNo)
750 return Error(startLoc, "expected non-volatile register");
753 int SEHRegNo = MRI->getSEHRegNum(LLVMRegNo);
755 return Error(startLoc,"register can't be represented in SEH unwind info");
760 if (getParser().parseAbsoluteExpression(n))
763 return Error(startLoc, "register number is too high");
772 MCAsmParserExtension *createCOFFAsmParser() {
773 return new COFFAsmParser;