1 //===-- X86AsmParser.cpp - Parse X86 assembly to MCInst instructions ------===//
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 //===----------------------------------------------------------------------===//
11 #include "llvm/ADT/SmallVector.h"
12 #include "llvm/MC/MCAsmParser.h"
13 #include "llvm/Target/TargetRegistry.h"
14 #include "llvm/Target/TargetAsmParser.h"
21 class X86ATTAsmParser : public TargetAsmParser {
22 bool ParseOperand(X86Operand &Op);
24 bool MatchInstruction(const StringRef &Name,
25 llvm::SmallVector<X86Operand, 3> &Operands,
29 explicit X86ATTAsmParser(const Target &);
31 virtual bool ParseInstruction(MCAsmParser &AP, const StringRef &Name,
36 X86ATTAsmParser::X86ATTAsmParser(const Target &T)
41 bool X86ATTAsmParser::ParseOperand(X86Operand &Op) {
46 X86ATTAsmParser::MatchInstruction(const StringRef &Name,
47 llvm::SmallVector<X86Operand, 3> &Operands,
52 bool X86ATTAsmParser::ParseInstruction(MCAsmParser &AP, const StringRef &Name,
54 llvm::SmallVector<X86Operand, 3> Operands;
56 return MatchInstruction(Name, Operands, Inst);
59 // Force static initialization.
60 extern "C" void LLVMInitializeX86AsmParser() {
61 RegisterAsmParser<X86ATTAsmParser> X(TheX86_32Target);
62 RegisterAsmParser<X86ATTAsmParser> Y(TheX86_64Target);