MC/X86: Fix an MCOperand link, when we parsing shrld $1,%eax and friends; I believe...
[oota-llvm.git] / lib / Target / X86 / AsmParser / X86AsmParser.cpp
1 //===-- X86AsmParser.cpp - Parse X86 assembly to MCInst instructions ------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "llvm/Target/TargetAsmParser.h"
11 #include "X86.h"
12 #include "llvm/ADT/SmallVector.h"
13 #include "llvm/ADT/StringSwitch.h"
14 #include "llvm/ADT/Twine.h"
15 #include "llvm/MC/MCStreamer.h"
16 #include "llvm/MC/MCExpr.h"
17 #include "llvm/MC/MCInst.h"
18 #include "llvm/MC/MCParser/MCAsmLexer.h"
19 #include "llvm/MC/MCParser/MCAsmParser.h"
20 #include "llvm/MC/MCParser/MCParsedAsmOperand.h"
21 #include "llvm/Support/SourceMgr.h"
22 #include "llvm/Target/TargetRegistry.h"
23 #include "llvm/Target/TargetAsmParser.h"
24 using namespace llvm;
25
26 namespace {
27 struct X86Operand;
28
29 class X86ATTAsmParser : public TargetAsmParser {
30   MCAsmParser &Parser;
31
32 protected:
33   unsigned Is64Bit : 1;
34
35 private:
36   MCAsmParser &getParser() const { return Parser; }
37
38   MCAsmLexer &getLexer() const { return Parser.getLexer(); }
39
40   void Warning(SMLoc L, const Twine &Msg) { Parser.Warning(L, Msg); }
41
42   bool Error(SMLoc L, const Twine &Msg) { return Parser.Error(L, Msg); }
43
44   bool ParseRegister(unsigned &RegNo, SMLoc &StartLoc, SMLoc &EndLoc);
45
46   X86Operand *ParseOperand();
47   X86Operand *ParseMemOperand();
48
49   bool ParseDirectiveWord(unsigned Size, SMLoc L);
50
51   void InstructionCleanup(MCInst &Inst);
52
53   /// @name Auto-generated Match Functions
54   /// {  
55
56   bool MatchInstruction(const SmallVectorImpl<MCParsedAsmOperand*> &Operands,
57                         MCInst &Inst);
58
59   /// }
60
61 public:
62   X86ATTAsmParser(const Target &T, MCAsmParser &_Parser)
63     : TargetAsmParser(T), Parser(_Parser) {}
64
65   virtual bool ParseInstruction(const StringRef &Name, SMLoc NameLoc,
66                                 SmallVectorImpl<MCParsedAsmOperand*> &Operands);
67
68   virtual bool ParseDirective(AsmToken DirectiveID);
69 };
70  
71 class X86_32ATTAsmParser : public X86ATTAsmParser {
72 public:
73   X86_32ATTAsmParser(const Target &T, MCAsmParser &_Parser)
74     : X86ATTAsmParser(T, _Parser) {
75     Is64Bit = false;
76   }
77 };
78
79 class X86_64ATTAsmParser : public X86ATTAsmParser {
80 public:
81   X86_64ATTAsmParser(const Target &T, MCAsmParser &_Parser)
82     : X86ATTAsmParser(T, _Parser) {
83     Is64Bit = true;
84   }
85 };
86
87 } // end anonymous namespace
88
89 /// @name Auto-generated Match Functions
90 /// {  
91
92 static unsigned MatchRegisterName(StringRef Name);
93
94 /// }
95
96 namespace {
97
98 /// X86Operand - Instances of this class represent a parsed X86 machine
99 /// instruction.
100 struct X86Operand : public MCParsedAsmOperand {
101   enum KindTy {
102     Token,
103     Register,
104     Immediate,
105     Memory
106   } Kind;
107
108   SMLoc StartLoc, EndLoc;
109   
110   union {
111     struct {
112       const char *Data;
113       unsigned Length;
114     } Tok;
115
116     struct {
117       unsigned RegNo;
118     } Reg;
119
120     struct {
121       const MCExpr *Val;
122     } Imm;
123
124     struct {
125       unsigned SegReg;
126       const MCExpr *Disp;
127       unsigned BaseReg;
128       unsigned IndexReg;
129       unsigned Scale;
130     } Mem;
131   };
132
133   X86Operand(KindTy K, SMLoc Start, SMLoc End)
134     : Kind(K), StartLoc(Start), EndLoc(End) {}
135   
136   /// getStartLoc - Get the location of the first token of this operand.
137   SMLoc getStartLoc() const { return StartLoc; }
138   /// getEndLoc - Get the location of the last token of this operand.
139   SMLoc getEndLoc() const { return EndLoc; }
140
141   StringRef getToken() const {
142     assert(Kind == Token && "Invalid access!");
143     return StringRef(Tok.Data, Tok.Length);
144   }
145
146   unsigned getReg() const {
147     assert(Kind == Register && "Invalid access!");
148     return Reg.RegNo;
149   }
150
151   const MCExpr *getImm() const {
152     assert(Kind == Immediate && "Invalid access!");
153     return Imm.Val;
154   }
155
156   const MCExpr *getMemDisp() const {
157     assert(Kind == Memory && "Invalid access!");
158     return Mem.Disp;
159   }
160   unsigned getMemSegReg() const {
161     assert(Kind == Memory && "Invalid access!");
162     return Mem.SegReg;
163   }
164   unsigned getMemBaseReg() const {
165     assert(Kind == Memory && "Invalid access!");
166     return Mem.BaseReg;
167   }
168   unsigned getMemIndexReg() const {
169     assert(Kind == Memory && "Invalid access!");
170     return Mem.IndexReg;
171   }
172   unsigned getMemScale() const {
173     assert(Kind == Memory && "Invalid access!");
174     return Mem.Scale;
175   }
176
177   bool isToken() const {return Kind == Token; }
178
179   bool isImm() const { return Kind == Immediate; }
180   
181   bool isImmSExt8() const { 
182     // Accept immediates which fit in 8 bits when sign extended, and
183     // non-absolute immediates.
184     if (!isImm())
185       return false;
186
187     if (const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm())) {
188       int64_t Value = CE->getValue();
189       return Value == (int64_t) (int8_t) Value;
190     }
191
192     return true;
193   }
194   
195   bool isMem() const { return Kind == Memory; }
196
197   bool isAbsMem() const {
198     return Kind == Memory && !getMemSegReg() && !getMemBaseReg() &&
199       !getMemIndexReg() && getMemScale() == 1;
200   }
201
202   bool isNoSegMem() const {
203     return Kind == Memory && !getMemSegReg();
204   }
205
206   bool isReg() const { return Kind == Register; }
207
208   void addExpr(MCInst &Inst, const MCExpr *Expr) const {
209     // Add as immediates when possible.
210     if (const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(Expr))
211       Inst.addOperand(MCOperand::CreateImm(CE->getValue()));
212     else
213       Inst.addOperand(MCOperand::CreateExpr(Expr));
214   }
215
216   void addRegOperands(MCInst &Inst, unsigned N) const {
217     assert(N == 1 && "Invalid number of operands!");
218     Inst.addOperand(MCOperand::CreateReg(getReg()));
219   }
220
221   void addImmOperands(MCInst &Inst, unsigned N) const {
222     assert(N == 1 && "Invalid number of operands!");
223     addExpr(Inst, getImm());
224   }
225
226   void addImmSExt8Operands(MCInst &Inst, unsigned N) const {
227     // FIXME: Support user customization of the render method.
228     assert(N == 1 && "Invalid number of operands!");
229     addExpr(Inst, getImm());
230   }
231
232   void addMemOperands(MCInst &Inst, unsigned N) const {
233     assert((N == 5) && "Invalid number of operands!");
234     Inst.addOperand(MCOperand::CreateReg(getMemBaseReg()));
235     Inst.addOperand(MCOperand::CreateImm(getMemScale()));
236     Inst.addOperand(MCOperand::CreateReg(getMemIndexReg()));
237     addExpr(Inst, getMemDisp());
238     Inst.addOperand(MCOperand::CreateReg(getMemSegReg()));
239   }
240
241   void addAbsMemOperands(MCInst &Inst, unsigned N) const {
242     assert((N == 1) && "Invalid number of operands!");
243     Inst.addOperand(MCOperand::CreateExpr(getMemDisp()));
244   }
245
246   void addNoSegMemOperands(MCInst &Inst, unsigned N) const {
247     assert((N == 4) && "Invalid number of operands!");
248     Inst.addOperand(MCOperand::CreateReg(getMemBaseReg()));
249     Inst.addOperand(MCOperand::CreateImm(getMemScale()));
250     Inst.addOperand(MCOperand::CreateReg(getMemIndexReg()));
251     addExpr(Inst, getMemDisp());
252   }
253
254   static X86Operand *CreateToken(StringRef Str, SMLoc Loc) {
255     X86Operand *Res = new X86Operand(Token, Loc, Loc);
256     Res->Tok.Data = Str.data();
257     Res->Tok.Length = Str.size();
258     return Res;
259   }
260
261   static X86Operand *CreateReg(unsigned RegNo, SMLoc StartLoc, SMLoc EndLoc) {
262     X86Operand *Res = new X86Operand(Register, StartLoc, EndLoc);
263     Res->Reg.RegNo = RegNo;
264     return Res;
265   }
266
267   static X86Operand *CreateImm(const MCExpr *Val, SMLoc StartLoc, SMLoc EndLoc){
268     X86Operand *Res = new X86Operand(Immediate, StartLoc, EndLoc);
269     Res->Imm.Val = Val;
270     return Res;
271   }
272
273   /// Create an absolute memory operand.
274   static X86Operand *CreateMem(const MCExpr *Disp, SMLoc StartLoc,
275                                SMLoc EndLoc) {
276     X86Operand *Res = new X86Operand(Memory, StartLoc, EndLoc);
277     Res->Mem.SegReg   = 0;
278     Res->Mem.Disp     = Disp;
279     Res->Mem.BaseReg  = 0;
280     Res->Mem.IndexReg = 0;
281     Res->Mem.Scale    = 1;
282     return Res;
283   }
284
285   /// Create a generalized memory operand.
286   static X86Operand *CreateMem(unsigned SegReg, const MCExpr *Disp,
287                                unsigned BaseReg, unsigned IndexReg,
288                                unsigned Scale, SMLoc StartLoc, SMLoc EndLoc) {
289     // We should never just have a displacement, that should be parsed as an
290     // absolute memory operand.
291     assert((SegReg || BaseReg || IndexReg) && "Invalid memory operand!");
292
293     // The scale should always be one of {1,2,4,8}.
294     assert(((Scale == 1 || Scale == 2 || Scale == 4 || Scale == 8)) &&
295            "Invalid scale!");
296     X86Operand *Res = new X86Operand(Memory, StartLoc, EndLoc);
297     Res->Mem.SegReg   = SegReg;
298     Res->Mem.Disp     = Disp;
299     Res->Mem.BaseReg  = BaseReg;
300     Res->Mem.IndexReg = IndexReg;
301     Res->Mem.Scale    = Scale;
302     return Res;
303   }
304 };
305
306 } // end anonymous namespace.
307
308
309 bool X86ATTAsmParser::ParseRegister(unsigned &RegNo,
310                                     SMLoc &StartLoc, SMLoc &EndLoc) {
311   RegNo = 0;
312   const AsmToken &TokPercent = Parser.getTok();
313   assert(TokPercent.is(AsmToken::Percent) && "Invalid token kind!");
314   StartLoc = TokPercent.getLoc();
315   Parser.Lex(); // Eat percent token.
316
317   const AsmToken &Tok = Parser.getTok();
318   if (Tok.isNot(AsmToken::Identifier))
319     return Error(Tok.getLoc(), "invalid register name");
320
321   // FIXME: Validate register for the current architecture; we have to do
322   // validation later, so maybe there is no need for this here.
323   RegNo = MatchRegisterName(Tok.getString());
324   
325   // Parse %st(1) and "%st" as "%st(0)"
326   if (RegNo == 0 && Tok.getString() == "st") {
327     RegNo = X86::ST0;
328     EndLoc = Tok.getLoc();
329     Parser.Lex(); // Eat 'st'
330     
331     // Check to see if we have '(4)' after %st.
332     if (getLexer().isNot(AsmToken::LParen))
333       return false;
334     // Lex the paren.
335     getParser().Lex();
336
337     const AsmToken &IntTok = Parser.getTok();
338     if (IntTok.isNot(AsmToken::Integer))
339       return Error(IntTok.getLoc(), "expected stack index");
340     switch (IntTok.getIntVal()) {
341     case 0: RegNo = X86::ST0; break;
342     case 1: RegNo = X86::ST1; break;
343     case 2: RegNo = X86::ST2; break;
344     case 3: RegNo = X86::ST3; break;
345     case 4: RegNo = X86::ST4; break;
346     case 5: RegNo = X86::ST5; break;
347     case 6: RegNo = X86::ST6; break;
348     case 7: RegNo = X86::ST7; break;
349     default: return Error(IntTok.getLoc(), "invalid stack index");
350     }
351     
352     if (getParser().Lex().isNot(AsmToken::RParen))
353       return Error(Parser.getTok().getLoc(), "expected ')'");
354     
355     EndLoc = Tok.getLoc();
356     Parser.Lex(); // Eat ')'
357     return false;
358   }
359   
360   if (RegNo == 0)
361     return Error(Tok.getLoc(), "invalid register name");
362
363   EndLoc = Tok.getLoc();
364   Parser.Lex(); // Eat identifier token.
365   return false;
366 }
367
368 X86Operand *X86ATTAsmParser::ParseOperand() {
369   switch (getLexer().getKind()) {
370   default:
371     return ParseMemOperand();
372   case AsmToken::Percent: {
373     // FIXME: if a segment register, this could either be just the seg reg, or
374     // the start of a memory operand.
375     unsigned RegNo;
376     SMLoc Start, End;
377     if (ParseRegister(RegNo, Start, End)) return 0;
378     return X86Operand::CreateReg(RegNo, Start, End);
379   }
380   case AsmToken::Dollar: {
381     // $42 -> immediate.
382     SMLoc Start = Parser.getTok().getLoc(), End;
383     Parser.Lex();
384     const MCExpr *Val;
385     if (getParser().ParseExpression(Val, End))
386       return 0;
387     return X86Operand::CreateImm(Val, Start, End);
388   }
389   }
390 }
391
392 /// ParseMemOperand: segment: disp(basereg, indexreg, scale)
393 X86Operand *X86ATTAsmParser::ParseMemOperand() {
394   SMLoc MemStart = Parser.getTok().getLoc();
395   
396   // FIXME: If SegReg ':'  (e.g. %gs:), eat and remember.
397   unsigned SegReg = 0;
398   
399   // We have to disambiguate a parenthesized expression "(4+5)" from the start
400   // of a memory operand with a missing displacement "(%ebx)" or "(,%eax)".  The
401   // only way to do this without lookahead is to eat the '(' and see what is
402   // after it.
403   const MCExpr *Disp = MCConstantExpr::Create(0, getParser().getContext());
404   if (getLexer().isNot(AsmToken::LParen)) {
405     SMLoc ExprEnd;
406     if (getParser().ParseExpression(Disp, ExprEnd)) return 0;
407     
408     // After parsing the base expression we could either have a parenthesized
409     // memory address or not.  If not, return now.  If so, eat the (.
410     if (getLexer().isNot(AsmToken::LParen)) {
411       // Unless we have a segment register, treat this as an immediate.
412       if (SegReg == 0)
413         return X86Operand::CreateMem(Disp, MemStart, ExprEnd);
414       return X86Operand::CreateMem(SegReg, Disp, 0, 0, 1, MemStart, ExprEnd);
415     }
416     
417     // Eat the '('.
418     Parser.Lex();
419   } else {
420     // Okay, we have a '('.  We don't know if this is an expression or not, but
421     // so we have to eat the ( to see beyond it.
422     SMLoc LParenLoc = Parser.getTok().getLoc();
423     Parser.Lex(); // Eat the '('.
424     
425     if (getLexer().is(AsmToken::Percent) || getLexer().is(AsmToken::Comma)) {
426       // Nothing to do here, fall into the code below with the '(' part of the
427       // memory operand consumed.
428     } else {
429       SMLoc ExprEnd;
430       
431       // It must be an parenthesized expression, parse it now.
432       if (getParser().ParseParenExpression(Disp, ExprEnd))
433         return 0;
434       
435       // After parsing the base expression we could either have a parenthesized
436       // memory address or not.  If not, return now.  If so, eat the (.
437       if (getLexer().isNot(AsmToken::LParen)) {
438         // Unless we have a segment register, treat this as an immediate.
439         if (SegReg == 0)
440           return X86Operand::CreateMem(Disp, LParenLoc, ExprEnd);
441         return X86Operand::CreateMem(SegReg, Disp, 0, 0, 1, MemStart, ExprEnd);
442       }
443       
444       // Eat the '('.
445       Parser.Lex();
446     }
447   }
448   
449   // If we reached here, then we just ate the ( of the memory operand.  Process
450   // the rest of the memory operand.
451   unsigned BaseReg = 0, IndexReg = 0, Scale = 1;
452   
453   if (getLexer().is(AsmToken::Percent)) {
454     SMLoc L;
455     if (ParseRegister(BaseReg, L, L)) return 0;
456   }
457   
458   if (getLexer().is(AsmToken::Comma)) {
459     Parser.Lex(); // Eat the comma.
460
461     // Following the comma we should have either an index register, or a scale
462     // value. We don't support the later form, but we want to parse it
463     // correctly.
464     //
465     // Not that even though it would be completely consistent to support syntax
466     // like "1(%eax,,1)", the assembler doesn't.
467     if (getLexer().is(AsmToken::Percent)) {
468       SMLoc L;
469       if (ParseRegister(IndexReg, L, L)) return 0;
470     
471       if (getLexer().isNot(AsmToken::RParen)) {
472         // Parse the scale amount:
473         //  ::= ',' [scale-expression]
474         if (getLexer().isNot(AsmToken::Comma)) {
475           Error(Parser.getTok().getLoc(),
476                 "expected comma in scale expression");
477           return 0;
478         }
479         Parser.Lex(); // Eat the comma.
480
481         if (getLexer().isNot(AsmToken::RParen)) {
482           SMLoc Loc = Parser.getTok().getLoc();
483
484           int64_t ScaleVal;
485           if (getParser().ParseAbsoluteExpression(ScaleVal))
486             return 0;
487           
488           // Validate the scale amount.
489           if (ScaleVal != 1 && ScaleVal != 2 && ScaleVal != 4 && ScaleVal != 8){
490             Error(Loc, "scale factor in address must be 1, 2, 4 or 8");
491             return 0;
492           }
493           Scale = (unsigned)ScaleVal;
494         }
495       }
496     } else if (getLexer().isNot(AsmToken::RParen)) {
497       // Otherwise we have the unsupported form of a scale amount without an
498       // index.
499       SMLoc Loc = Parser.getTok().getLoc();
500
501       int64_t Value;
502       if (getParser().ParseAbsoluteExpression(Value))
503         return 0;
504       
505       Error(Loc, "cannot have scale factor without index register");
506       return 0;
507     }
508   }
509   
510   // Ok, we've eaten the memory operand, verify we have a ')' and eat it too.
511   if (getLexer().isNot(AsmToken::RParen)) {
512     Error(Parser.getTok().getLoc(), "unexpected token in memory operand");
513     return 0;
514   }
515   SMLoc MemEnd = Parser.getTok().getLoc();
516   Parser.Lex(); // Eat the ')'.
517   
518   return X86Operand::CreateMem(SegReg, Disp, BaseReg, IndexReg, Scale,
519                                MemStart, MemEnd);
520 }
521
522 bool X86ATTAsmParser::
523 ParseInstruction(const StringRef &Name, SMLoc NameLoc,
524                  SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
525   // FIXME: Hack to recognize "sal..." and "rep..." for now. We need a way to
526   // represent alternative syntaxes in the .td file, without requiring
527   // instruction duplication.
528   StringRef PatchedName = StringSwitch<StringRef>(Name)
529     .Case("sal", "shl")
530     .Case("salb", "shlb")
531     .Case("sall", "shll")
532     .Case("salq", "shlq")
533     .Case("salw", "shlw")
534     .Case("repe", "rep")
535     .Case("repz", "rep")
536     .Case("repnz", "repne")
537     .Default(Name);
538   Operands.push_back(X86Operand::CreateToken(PatchedName, NameLoc));
539
540   if (getLexer().isNot(AsmToken::EndOfStatement)) {
541
542     // Parse '*' modifier.
543     if (getLexer().is(AsmToken::Star)) {
544       SMLoc Loc = Parser.getTok().getLoc();
545       Operands.push_back(X86Operand::CreateToken("*", Loc));
546       Parser.Lex(); // Eat the star.
547     }
548
549     // Read the first operand.
550     if (X86Operand *Op = ParseOperand())
551       Operands.push_back(Op);
552     else
553       return true;
554     
555     while (getLexer().is(AsmToken::Comma)) {
556       Parser.Lex();  // Eat the comma.
557
558       // Parse and remember the operand.
559       if (X86Operand *Op = ParseOperand())
560         Operands.push_back(Op);
561       else
562         return true;
563     }
564   }
565
566   // FIXME: Hack to handle recognizing s{hr,ar,hl}? $1.
567   if ((Name.startswith("shr") || Name.startswith("sar") ||
568        Name.startswith("shl")) &&
569       Operands.size() == 3 &&
570       static_cast<X86Operand*>(Operands[1])->isImm() &&
571       isa<MCConstantExpr>(static_cast<X86Operand*>(Operands[1])->getImm()) &&
572       cast<MCConstantExpr>(static_cast<X86Operand*>(Operands[1])->getImm())->getValue() == 1) {
573     delete Operands[1];
574     Operands.erase(Operands.begin() + 1);
575   }
576
577   return false;
578 }
579
580 bool X86ATTAsmParser::ParseDirective(AsmToken DirectiveID) {
581   StringRef IDVal = DirectiveID.getIdentifier();
582   if (IDVal == ".word")
583     return ParseDirectiveWord(2, DirectiveID.getLoc());
584   return true;
585 }
586
587 /// ParseDirectiveWord
588 ///  ::= .word [ expression (, expression)* ]
589 bool X86ATTAsmParser::ParseDirectiveWord(unsigned Size, SMLoc L) {
590   if (getLexer().isNot(AsmToken::EndOfStatement)) {
591     for (;;) {
592       const MCExpr *Value;
593       if (getParser().ParseExpression(Value))
594         return true;
595
596       getParser().getStreamer().EmitValue(Value, Size, 0 /*addrspace*/);
597
598       if (getLexer().is(AsmToken::EndOfStatement))
599         break;
600       
601       // FIXME: Improve diagnostic.
602       if (getLexer().isNot(AsmToken::Comma))
603         return Error(L, "unexpected token in directive");
604       Parser.Lex();
605     }
606   }
607
608   Parser.Lex();
609   return false;
610 }
611
612 // FIXME: Custom X86 cleanup function to implement a temporary hack to handle
613 // matching INCL/DECL correctly for x86_64. This needs to be replaced by a
614 // proper mechanism for supporting (ambiguous) feature dependent instructions.
615 void X86ATTAsmParser::InstructionCleanup(MCInst &Inst) {
616   if (!Is64Bit) return;
617
618   switch (Inst.getOpcode()) {
619   case X86::DEC16r: Inst.setOpcode(X86::DEC64_16r); break;
620   case X86::DEC16m: Inst.setOpcode(X86::DEC64_16m); break;
621   case X86::DEC32r: Inst.setOpcode(X86::DEC64_32r); break;
622   case X86::DEC32m: Inst.setOpcode(X86::DEC64_32m); break;
623   case X86::INC16r: Inst.setOpcode(X86::INC64_16r); break;
624   case X86::INC16m: Inst.setOpcode(X86::INC64_16m); break;
625   case X86::INC32r: Inst.setOpcode(X86::INC64_32r); break;
626   case X86::INC32m: Inst.setOpcode(X86::INC64_32m); break;
627   }
628 }
629
630 extern "C" void LLVMInitializeX86AsmLexer();
631
632 // Force static initialization.
633 extern "C" void LLVMInitializeX86AsmParser() {
634   RegisterAsmParser<X86_32ATTAsmParser> X(TheX86_32Target);
635   RegisterAsmParser<X86_64ATTAsmParser> Y(TheX86_64Target);
636   LLVMInitializeX86AsmLexer();
637 }
638
639 #include "X86GenAsmMatcher.inc"