forked from OSchip/llvm-project
prune #includes in TargetAsmParser.h
Pass in SMLoc of instr opcode into ParseInstruction. Make AsmToken be a class, not a struct. llvm-svn: 93457
This commit is contained in:
parent
0868567fc3
commit
77fd677111
|
@ -20,7 +20,8 @@ class SMLoc;
|
||||||
class Target;
|
class Target;
|
||||||
|
|
||||||
/// AsmToken - Target independent representation for an assembler token.
|
/// AsmToken - Target independent representation for an assembler token.
|
||||||
struct AsmToken {
|
class AsmToken {
|
||||||
|
public:
|
||||||
enum TokenKind {
|
enum TokenKind {
|
||||||
// Markers
|
// Markers
|
||||||
Eof, Error,
|
Eof, Error,
|
||||||
|
|
|
@ -18,8 +18,8 @@ namespace llvm {
|
||||||
/// between parsing an asm instruction and recognizing it.
|
/// between parsing an asm instruction and recognizing it.
|
||||||
class MCParsedAsmOperand {
|
class MCParsedAsmOperand {
|
||||||
public:
|
public:
|
||||||
MCParsedAsmOperand();
|
MCParsedAsmOperand() {}
|
||||||
virtual ~MCParsedAsmOperand() = 0;
|
virtual ~MCParsedAsmOperand() {}
|
||||||
// TODO: Out of line vfun.
|
// TODO: Out of line vfun.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,13 @@
|
||||||
#ifndef LLVM_TARGET_TARGETPARSER_H
|
#ifndef LLVM_TARGET_TARGETPARSER_H
|
||||||
#define LLVM_TARGET_TARGETPARSER_H
|
#define LLVM_TARGET_TARGETPARSER_H
|
||||||
|
|
||||||
#include "llvm/MC/MCAsmLexer.h"
|
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
class MCAsmParser;
|
class MCAsmParser;
|
||||||
class MCInst;
|
class MCInst;
|
||||||
class StringRef;
|
class StringRef;
|
||||||
class Target;
|
class Target;
|
||||||
|
class SMLoc;
|
||||||
|
class AsmToken;
|
||||||
|
|
||||||
/// TargetAsmParser - Generic interface to target specific assembly parsers.
|
/// TargetAsmParser - Generic interface to target specific assembly parsers.
|
||||||
class TargetAsmParser {
|
class TargetAsmParser {
|
||||||
|
@ -45,7 +45,8 @@ public:
|
||||||
/// \param Name - The instruction name.
|
/// \param Name - The instruction name.
|
||||||
/// \param Inst [out] - On success, the parsed instruction.
|
/// \param Inst [out] - On success, the parsed instruction.
|
||||||
/// \return True on failure.
|
/// \return True on failure.
|
||||||
virtual bool ParseInstruction(const StringRef &Name, MCInst &Inst) = 0;
|
virtual bool ParseInstruction(const StringRef &Name, SMLoc NameLoc,
|
||||||
|
MCInst &Inst) = 0;
|
||||||
|
|
||||||
/// ParseDirective - Parse a target specific assembler directive
|
/// ParseDirective - Parse a target specific assembler directive
|
||||||
///
|
///
|
||||||
|
|
|
@ -95,7 +95,8 @@ public:
|
||||||
ARMAsmParser(const Target &T, MCAsmParser &_Parser)
|
ARMAsmParser(const Target &T, MCAsmParser &_Parser)
|
||||||
: TargetAsmParser(T), Parser(_Parser) {}
|
: TargetAsmParser(T), Parser(_Parser) {}
|
||||||
|
|
||||||
virtual bool ParseInstruction(const StringRef &Name, MCInst &Inst);
|
virtual bool ParseInstruction(const StringRef &Name, SMLoc NameLoc,
|
||||||
|
MCInst &Inst);
|
||||||
|
|
||||||
virtual bool ParseDirective(AsmToken DirectiveID);
|
virtual bool ParseDirective(AsmToken DirectiveID);
|
||||||
};
|
};
|
||||||
|
@ -579,7 +580,8 @@ bool ARMAsmParser::ParseOperand(ARMOperand &Op) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parse an arm instruction mnemonic followed by its operands.
|
/// Parse an arm instruction mnemonic followed by its operands.
|
||||||
bool ARMAsmParser::ParseInstruction(const StringRef &Name, MCInst &Inst) {
|
bool ARMAsmParser::ParseInstruction(const StringRef &Name, SMLoc NameLoc,
|
||||||
|
MCInst &Inst) {
|
||||||
SmallVector<ARMOperand, 7> Operands;
|
SmallVector<ARMOperand, 7> Operands;
|
||||||
|
|
||||||
Operands.push_back(ARMOperand::CreateToken(Name));
|
Operands.push_back(ARMOperand::CreateToken(Name));
|
||||||
|
|
|
@ -60,7 +60,8 @@ public:
|
||||||
X86ATTAsmParser(const Target &T, MCAsmParser &_Parser)
|
X86ATTAsmParser(const Target &T, MCAsmParser &_Parser)
|
||||||
: TargetAsmParser(T), Parser(_Parser) {}
|
: TargetAsmParser(T), Parser(_Parser) {}
|
||||||
|
|
||||||
virtual bool ParseInstruction(const StringRef &Name, MCInst &Inst);
|
virtual bool ParseInstruction(const StringRef &Name, SMLoc NameLoc,
|
||||||
|
MCInst &Inst);
|
||||||
|
|
||||||
virtual bool ParseDirective(AsmToken DirectiveID);
|
virtual bool ParseDirective(AsmToken DirectiveID);
|
||||||
};
|
};
|
||||||
|
@ -401,7 +402,8 @@ bool X86ATTAsmParser::ParseMemOperand(X86Operand &Op) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool X86ATTAsmParser::ParseInstruction(const StringRef &Name, MCInst &Inst) {
|
bool X86ATTAsmParser::ParseInstruction(const StringRef &Name,
|
||||||
|
SMLoc NameLoc, MCInst &Inst) {
|
||||||
SmallVector<X86Operand, 8> Operands;
|
SmallVector<X86Operand, 8> Operands;
|
||||||
|
|
||||||
Operands.push_back(X86Operand::CreateToken(Name));
|
Operands.push_back(X86Operand::CreateToken(Name));
|
||||||
|
|
|
@ -711,7 +711,7 @@ bool AsmParser::ParseStatement() {
|
||||||
}
|
}
|
||||||
|
|
||||||
MCInst Inst;
|
MCInst Inst;
|
||||||
if (getTargetParser().ParseInstruction(IDVal, Inst))
|
if (getTargetParser().ParseInstruction(IDVal, IDLoc, Inst))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (Lexer.isNot(AsmToken::EndOfStatement))
|
if (Lexer.isNot(AsmToken::EndOfStatement))
|
||||||
|
|
Loading…
Reference in New Issue