25d4a6e330428048001b32b7e3c76ac9abb87cb9
[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 "X86.h"
11 #include "llvm/ADT/SmallVector.h"
12 #include "llvm/MC/MCAsmParser.h"
13 #include "llvm/Target/TargetRegistry.h"
14 #include "llvm/Target/TargetAsmParser.h"
15 using namespace llvm;
16
17 namespace {
18   struct X86Operand {
19   };
20
21   class X86ATTAsmParser : public TargetAsmParser {
22     bool ParseOperand(X86Operand &Op);
23     
24     bool MatchInstruction(const StringRef &Name, 
25                           llvm::SmallVector<X86Operand, 3> &Operands,
26                           MCInst &Inst);
27
28   public:
29     explicit X86ATTAsmParser(const Target &);
30     
31     virtual bool ParseInstruction(MCAsmParser &AP, const StringRef &Name, 
32                                   MCInst &Inst);
33   };
34 }
35
36 X86ATTAsmParser::X86ATTAsmParser(const Target &T) 
37   : TargetAsmParser(T)
38 {
39 }
40
41 bool X86ATTAsmParser::ParseOperand(X86Operand &Op) {
42   return true;
43 }
44
45 bool 
46 X86ATTAsmParser::MatchInstruction(const StringRef &Name, 
47                                   llvm::SmallVector<X86Operand, 3> &Operands,
48                                   MCInst &Inst) {
49   return false;
50 }
51
52 bool X86ATTAsmParser::ParseInstruction(MCAsmParser &AP, const StringRef &Name, 
53                                        MCInst &Inst) {
54   llvm::SmallVector<X86Operand, 3> Operands;
55   
56   return MatchInstruction(Name, Operands, Inst);
57 }
58
59 // Force static initialization.
60 extern "C" void LLVMInitializeX86AsmParser() {
61   RegisterAsmParser<X86ATTAsmParser> X(TheX86_32Target);
62   RegisterAsmParser<X86ATTAsmParser> Y(TheX86_64Target);
63 }