1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
//===-- X86AsmParser.cpp - Parse X86 assembly to MCInst instructions ------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "X86.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/MC/MCAsmLexer.h"
#include "llvm/MC/MCAsmParser.h"
#include "llvm/Target/TargetRegistry.h"
#include "llvm/Target/TargetAsmParser.h"
using namespace llvm;
namespace {
struct X86Operand {
};
class X86ATTAsmParser : public TargetAsmParser {
MCAsmParser &Parser;
private:
bool ParseOperand(X86Operand &Op);
bool MatchInstruction(const StringRef &Name,
llvm::SmallVector<X86Operand, 3> &Operands,
MCInst &Inst);
MCAsmLexer &getLexer() const { return Parser.getLexer(); }
public:
X86ATTAsmParser(const Target &T, MCAsmParser &_Parser)
: TargetAsmParser(T), Parser(_Parser) {}
virtual bool ParseInstruction(MCAsmParser &AP, const StringRef &Name,
MCInst &Inst);
};
}
bool X86ATTAsmParser::ParseOperand(X86Operand &Op) {
return true;
}
bool
X86ATTAsmParser::MatchInstruction(const StringRef &Name,
llvm::SmallVector<X86Operand, 3> &Operands,
MCInst &Inst) {
return false;
}
bool X86ATTAsmParser::ParseInstruction(MCAsmParser &AP, const StringRef &Name,
MCInst &Inst) {
llvm::SmallVector<X86Operand, 3> Operands;
return MatchInstruction(Name, Operands, Inst);
}
// Force static initialization.
extern "C" void LLVMInitializeX86AsmParser() {
RegisterAsmParser<X86ATTAsmParser> X(TheX86_32Target);
RegisterAsmParser<X86ATTAsmParser> Y(TheX86_64Target);
}
|