teach the x86 asm parser how to handle segment prefixes
[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(unsigned SegReg, SMLoc StartLoc);
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     // Parse a memory operand with no segment register.
372     return ParseMemOperand(0, Parser.getTok().getLoc());
373   case AsmToken::Percent: {
374     // Read the register.
375     unsigned RegNo;
376     SMLoc Start, End;
377     if (ParseRegister(RegNo, Start, End)) return 0;
378     
379     // If this is a segment register followed by a ':', then this is the start
380     // of a memory reference, otherwise this is a normal register reference.
381     if (getLexer().isNot(AsmToken::Colon))
382       return X86Operand::CreateReg(RegNo, Start, End);
383     
384     
385     getParser().Lex(); // Eat the colon.
386     return ParseMemOperand(RegNo, Start);
387   }
388   case AsmToken::Dollar: {
389     // $42 -> immediate.
390     SMLoc Start = Parser.getTok().getLoc(), End;
391     Parser.Lex();
392     const MCExpr *Val;
393     if (getParser().ParseExpression(Val, End))
394       return 0;
395     return X86Operand::CreateImm(Val, Start, End);
396   }
397   }
398 }
399
400 /// ParseMemOperand: segment: disp(basereg, indexreg, scale).  The '%ds:' prefix
401 /// has already been parsed if present.
402 X86Operand *X86ATTAsmParser::ParseMemOperand(unsigned SegReg, SMLoc MemStart) {
403  
404   // We have to disambiguate a parenthesized expression "(4+5)" from the start
405   // of a memory operand with a missing displacement "(%ebx)" or "(,%eax)".  The
406   // only way to do this without lookahead is to eat the '(' and see what is
407   // after it.
408   const MCExpr *Disp = MCConstantExpr::Create(0, getParser().getContext());
409   if (getLexer().isNot(AsmToken::LParen)) {
410     SMLoc ExprEnd;
411     if (getParser().ParseExpression(Disp, ExprEnd)) return 0;
412     
413     // After parsing the base expression we could either have a parenthesized
414     // memory address or not.  If not, return now.  If so, eat the (.
415     if (getLexer().isNot(AsmToken::LParen)) {
416       // Unless we have a segment register, treat this as an immediate.
417       if (SegReg == 0)
418         return X86Operand::CreateMem(Disp, MemStart, ExprEnd);
419       return X86Operand::CreateMem(SegReg, Disp, 0, 0, 1, MemStart, ExprEnd);
420     }
421     
422     // Eat the '('.
423     Parser.Lex();
424   } else {
425     // Okay, we have a '('.  We don't know if this is an expression or not, but
426     // so we have to eat the ( to see beyond it.
427     SMLoc LParenLoc = Parser.getTok().getLoc();
428     Parser.Lex(); // Eat the '('.
429     
430     if (getLexer().is(AsmToken::Percent) || getLexer().is(AsmToken::Comma)) {
431       // Nothing to do here, fall into the code below with the '(' part of the
432       // memory operand consumed.
433     } else {
434       SMLoc ExprEnd;
435       
436       // It must be an parenthesized expression, parse it now.
437       if (getParser().ParseParenExpression(Disp, ExprEnd))
438         return 0;
439       
440       // After parsing the base expression we could either have a parenthesized
441       // memory address or not.  If not, return now.  If so, eat the (.
442       if (getLexer().isNot(AsmToken::LParen)) {
443         // Unless we have a segment register, treat this as an immediate.
444         if (SegReg == 0)
445           return X86Operand::CreateMem(Disp, LParenLoc, ExprEnd);
446         return X86Operand::CreateMem(SegReg, Disp, 0, 0, 1, MemStart, ExprEnd);
447       }
448       
449       // Eat the '('.
450       Parser.Lex();
451     }
452   }
453   
454   // If we reached here, then we just ate the ( of the memory operand.  Process
455   // the rest of the memory operand.
456   unsigned BaseReg = 0, IndexReg = 0, Scale = 1;
457   
458   if (getLexer().is(AsmToken::Percent)) {
459     SMLoc L;
460     if (ParseRegister(BaseReg, L, L)) return 0;
461   }
462   
463   if (getLexer().is(AsmToken::Comma)) {
464     Parser.Lex(); // Eat the comma.
465
466     // Following the comma we should have either an index register, or a scale
467     // value. We don't support the later form, but we want to parse it
468     // correctly.
469     //
470     // Not that even though it would be completely consistent to support syntax
471     // like "1(%eax,,1)", the assembler doesn't.
472     if (getLexer().is(AsmToken::Percent)) {
473       SMLoc L;
474       if (ParseRegister(IndexReg, L, L)) return 0;
475     
476       if (getLexer().isNot(AsmToken::RParen)) {
477         // Parse the scale amount:
478         //  ::= ',' [scale-expression]
479         if (getLexer().isNot(AsmToken::Comma)) {
480           Error(Parser.getTok().getLoc(),
481                 "expected comma in scale expression");
482           return 0;
483         }
484         Parser.Lex(); // Eat the comma.
485
486         if (getLexer().isNot(AsmToken::RParen)) {
487           SMLoc Loc = Parser.getTok().getLoc();
488
489           int64_t ScaleVal;
490           if (getParser().ParseAbsoluteExpression(ScaleVal))
491             return 0;
492           
493           // Validate the scale amount.
494           if (ScaleVal != 1 && ScaleVal != 2 && ScaleVal != 4 && ScaleVal != 8){
495             Error(Loc, "scale factor in address must be 1, 2, 4 or 8");
496             return 0;
497           }
498           Scale = (unsigned)ScaleVal;
499         }
500       }
501     } else if (getLexer().isNot(AsmToken::RParen)) {
502       // Otherwise we have the unsupported form of a scale amount without an
503       // index.
504       SMLoc Loc = Parser.getTok().getLoc();
505
506       int64_t Value;
507       if (getParser().ParseAbsoluteExpression(Value))
508         return 0;
509       
510       Error(Loc, "cannot have scale factor without index register");
511       return 0;
512     }
513   }
514   
515   // Ok, we've eaten the memory operand, verify we have a ')' and eat it too.
516   if (getLexer().isNot(AsmToken::RParen)) {
517     Error(Parser.getTok().getLoc(), "unexpected token in memory operand");
518     return 0;
519   }
520   SMLoc MemEnd = Parser.getTok().getLoc();
521   Parser.Lex(); // Eat the ')'.
522   
523   return X86Operand::CreateMem(SegReg, Disp, BaseReg, IndexReg, Scale,
524                                MemStart, MemEnd);
525 }
526
527 bool X86ATTAsmParser::
528 ParseInstruction(const StringRef &Name, SMLoc NameLoc,
529                  SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
530   // FIXME: Hack to recognize "sal..." and "rep..." for now. We need a way to
531   // represent alternative syntaxes in the .td file, without requiring
532   // instruction duplication.
533   StringRef PatchedName = StringSwitch<StringRef>(Name)
534     .Case("sal", "shl")
535     .Case("salb", "shlb")
536     .Case("sall", "shll")
537     .Case("salq", "shlq")
538     .Case("salw", "shlw")
539     .Case("repe", "rep")
540     .Case("repz", "rep")
541     .Case("repnz", "repne")
542     .Default(Name);
543   Operands.push_back(X86Operand::CreateToken(PatchedName, NameLoc));
544
545   if (getLexer().isNot(AsmToken::EndOfStatement)) {
546
547     // Parse '*' modifier.
548     if (getLexer().is(AsmToken::Star)) {
549       SMLoc Loc = Parser.getTok().getLoc();
550       Operands.push_back(X86Operand::CreateToken("*", Loc));
551       Parser.Lex(); // Eat the star.
552     }
553
554     // Read the first operand.
555     if (X86Operand *Op = ParseOperand())
556       Operands.push_back(Op);
557     else
558       return true;
559     
560     while (getLexer().is(AsmToken::Comma)) {
561       Parser.Lex();  // Eat the comma.
562
563       // Parse and remember the operand.
564       if (X86Operand *Op = ParseOperand())
565         Operands.push_back(Op);
566       else
567         return true;
568     }
569   }
570
571   // FIXME: Hack to handle recognizing s{hr,ar,hl}? $1.
572   if ((Name.startswith("shr") || Name.startswith("sar") ||
573        Name.startswith("shl")) &&
574       Operands.size() == 3 &&
575       static_cast<X86Operand*>(Operands[1])->isImm() &&
576       isa<MCConstantExpr>(static_cast<X86Operand*>(Operands[1])->getImm()) &&
577       cast<MCConstantExpr>(static_cast<X86Operand*>(Operands[1])->getImm())->getValue() == 1) {
578     delete Operands[1];
579     Operands.erase(Operands.begin() + 1);
580   }
581
582   return false;
583 }
584
585 bool X86ATTAsmParser::ParseDirective(AsmToken DirectiveID) {
586   StringRef IDVal = DirectiveID.getIdentifier();
587   if (IDVal == ".word")
588     return ParseDirectiveWord(2, DirectiveID.getLoc());
589   return true;
590 }
591
592 /// ParseDirectiveWord
593 ///  ::= .word [ expression (, expression)* ]
594 bool X86ATTAsmParser::ParseDirectiveWord(unsigned Size, SMLoc L) {
595   if (getLexer().isNot(AsmToken::EndOfStatement)) {
596     for (;;) {
597       const MCExpr *Value;
598       if (getParser().ParseExpression(Value))
599         return true;
600
601       getParser().getStreamer().EmitValue(Value, Size, 0 /*addrspace*/);
602
603       if (getLexer().is(AsmToken::EndOfStatement))
604         break;
605       
606       // FIXME: Improve diagnostic.
607       if (getLexer().isNot(AsmToken::Comma))
608         return Error(L, "unexpected token in directive");
609       Parser.Lex();
610     }
611   }
612
613   Parser.Lex();
614   return false;
615 }
616
617 // FIXME: Custom X86 cleanup function to implement a temporary hack to handle
618 // matching INCL/DECL correctly for x86_64. This needs to be replaced by a
619 // proper mechanism for supporting (ambiguous) feature dependent instructions.
620 void X86ATTAsmParser::InstructionCleanup(MCInst &Inst) {
621   if (!Is64Bit) return;
622
623   switch (Inst.getOpcode()) {
624   case X86::DEC16r: Inst.setOpcode(X86::DEC64_16r); break;
625   case X86::DEC16m: Inst.setOpcode(X86::DEC64_16m); break;
626   case X86::DEC32r: Inst.setOpcode(X86::DEC64_32r); break;
627   case X86::DEC32m: Inst.setOpcode(X86::DEC64_32m); break;
628   case X86::INC16r: Inst.setOpcode(X86::INC64_16r); break;
629   case X86::INC16m: Inst.setOpcode(X86::INC64_16m); break;
630   case X86::INC32r: Inst.setOpcode(X86::INC64_32r); break;
631   case X86::INC32m: Inst.setOpcode(X86::INC64_32m); break;
632   }
633 }
634
635 extern "C" void LLVMInitializeX86AsmLexer();
636
637 // Force static initialization.
638 extern "C" void LLVMInitializeX86AsmParser() {
639   RegisterAsmParser<X86_32ATTAsmParser> X(TheX86_32Target);
640   RegisterAsmParser<X86_64ATTAsmParser> Y(TheX86_64Target);
641   LLVMInitializeX86AsmLexer();
642 }
643
644 #include "X86GenAsmMatcher.inc"