2009-07-21 02:55:04 +08:00
|
|
|
//===-- MCAsmParser.cpp - Abstract Asm Parser Interface -------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2010-01-22 09:44:57 +08:00
|
|
|
#include "llvm/MC/MCParser/MCAsmParser.h"
|
2012-12-04 00:50:05 +08:00
|
|
|
#include "llvm/ADT/Twine.h"
|
2010-01-22 09:44:57 +08:00
|
|
|
#include "llvm/MC/MCParser/MCAsmLexer.h"
|
|
|
|
#include "llvm/MC/MCParser/MCParsedAsmOperand.h"
|
2011-07-26 08:24:13 +08:00
|
|
|
#include "llvm/MC/MCTargetAsmParser.h"
|
2012-12-04 00:50:05 +08:00
|
|
|
#include "llvm/Support/Debug.h"
|
2010-01-16 03:28:38 +08:00
|
|
|
#include "llvm/Support/SourceMgr.h"
|
2011-07-13 23:34:57 +08:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2009-07-21 02:55:04 +08:00
|
|
|
using namespace llvm;
|
|
|
|
|
2010-08-11 14:37:09 +08:00
|
|
|
MCAsmParser::MCAsmParser() : TargetParser(0), ShowParsedOperands(0) {
|
2009-07-21 02:55:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
MCAsmParser::~MCAsmParser() {
|
|
|
|
}
|
2010-01-16 03:28:38 +08:00
|
|
|
|
2011-07-26 08:24:13 +08:00
|
|
|
void MCAsmParser::setTargetParser(MCTargetAsmParser &P) {
|
2010-07-17 10:26:10 +08:00
|
|
|
assert(!TargetParser && "Target parser is already initialized!");
|
|
|
|
TargetParser = &P;
|
|
|
|
TargetParser->Initialize(*this);
|
|
|
|
}
|
|
|
|
|
2010-01-20 05:44:56 +08:00
|
|
|
const AsmToken &MCAsmParser::getTok() {
|
|
|
|
return getLexer().getTok();
|
|
|
|
}
|
|
|
|
|
2011-10-16 12:47:35 +08:00
|
|
|
bool MCAsmParser::TokError(const Twine &Msg, ArrayRef<SMRange> Ranges) {
|
|
|
|
Error(getLexer().getLoc(), Msg, Ranges);
|
2010-07-13 01:18:45 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-02-21 06:21:35 +08:00
|
|
|
bool MCAsmParser::parseExpression(const MCExpr *&Res) {
|
2010-01-16 03:28:38 +08:00
|
|
|
SMLoc L;
|
2013-02-21 06:21:35 +08:00
|
|
|
return parseExpression(Res, L);
|
2010-01-16 03:28:38 +08:00
|
|
|
}
|
|
|
|
|
2011-07-13 23:34:57 +08:00
|
|
|
void MCParsedAsmOperand::dump() const {
|
2012-09-12 13:06:18 +08:00
|
|
|
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
2011-07-13 23:34:57 +08:00
|
|
|
dbgs() << " " << *this;
|
2012-09-07 03:55:56 +08:00
|
|
|
#endif
|
2011-07-13 23:34:57 +08:00
|
|
|
}
|