2009-07-20 20:55:04 +02: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 02:44:57 +01:00
|
|
|
#include "llvm/MC/MCParser/MCAsmParser.h"
|
|
|
|
#include "llvm/MC/MCParser/MCAsmLexer.h"
|
|
|
|
#include "llvm/MC/MCParser/MCParsedAsmOperand.h"
|
2011-07-26 02:24:13 +02:00
|
|
|
#include "llvm/MC/MCTargetAsmParser.h"
|
2010-01-15 20:28:38 +01:00
|
|
|
#include "llvm/Support/SourceMgr.h"
|
2011-07-13 17:34:57 +02:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
#include "llvm/Support/Debug.h"
|
2011-07-23 02:45:41 +02:00
|
|
|
#include "llvm/ADT/Twine.h"
|
2009-07-20 20:55:04 +02:00
|
|
|
using namespace llvm;
|
|
|
|
|
2010-08-11 08:37:09 +02:00
|
|
|
MCAsmParser::MCAsmParser() : TargetParser(0), ShowParsedOperands(0) {
|
2009-07-20 20:55:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
MCAsmParser::~MCAsmParser() {
|
|
|
|
}
|
2010-01-15 20:28:38 +01:00
|
|
|
|
2011-07-26 02:24:13 +02:00
|
|
|
void MCAsmParser::setTargetParser(MCTargetAsmParser &P) {
|
2010-07-17 04:26:10 +02:00
|
|
|
assert(!TargetParser && "Target parser is already initialized!");
|
|
|
|
TargetParser = &P;
|
|
|
|
TargetParser->Initialize(*this);
|
|
|
|
}
|
|
|
|
|
2010-01-19 22:44:56 +01:00
|
|
|
const AsmToken &MCAsmParser::getTok() {
|
|
|
|
return getLexer().getTok();
|
|
|
|
}
|
|
|
|
|
2011-10-16 06:47:35 +02:00
|
|
|
bool MCAsmParser::TokError(const Twine &Msg, ArrayRef<SMRange> Ranges) {
|
|
|
|
Error(getLexer().getLoc(), Msg, Ranges);
|
2010-07-12 19:18:45 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-15 20:28:38 +01:00
|
|
|
bool MCAsmParser::ParseExpression(const MCExpr *&Res) {
|
|
|
|
SMLoc L;
|
2010-01-15 20:51:05 +01:00
|
|
|
return ParseExpression(Res, L);
|
2010-01-15 20:28:38 +01:00
|
|
|
}
|
|
|
|
|
2011-07-13 17:34:57 +02:00
|
|
|
void MCParsedAsmOperand::dump() const {
|
|
|
|
dbgs() << " " << *this;
|
|
|
|
}
|