#include "HexagonTargetStreamer.h"
#include "MCTargetDesc/HexagonMCChecker.h"
#include "MCTargetDesc/HexagonMCELFStreamer.h"
#include "MCTargetDesc/HexagonMCExpr.h"
#include "MCTargetDesc/HexagonMCInstrInfo.h"
#include "MCTargetDesc/HexagonMCTargetDesc.h"
#include "MCTargetDesc/HexagonShuffler.h"
#include "TargetInfo/HexagonTargetInfo.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDirectives.h"
#include "llvm/MC/MCELFStreamer.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCParser/MCAsmLexer.h"
#include "llvm/MC/MCParser/MCAsmParser.h"
#include "llvm/MC/MCParser/MCAsmParserExtension.h"
#include "llvm/MC/MCParser/MCParsedAsmOperand.h"
#include "llvm/MC/MCParser/MCTargetAsmParser.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCValue.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/HexagonAttributes.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/SMLoc.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <string>
#include <utility>
#define DEBUG_TYPE …
usingnamespacellvm;
static cl::opt<bool> WarnMissingParenthesis(
"mwarn-missing-parenthesis",
cl::desc("Warn for missing parenthesis around predicate registers"),
cl::init(true));
static cl::opt<bool> ErrorMissingParenthesis(
"merror-missing-parenthesis",
cl::desc("Error for missing parenthesis around predicate registers"),
cl::init(false));
static cl::opt<bool> WarnSignedMismatch(
"mwarn-sign-mismatch",
cl::desc("Warn for mismatching a signed and unsigned value"),
cl::init(false));
static cl::opt<bool> WarnNoncontigiousRegister(
"mwarn-noncontigious-register",
cl::desc("Warn for register names that arent contigious"), cl::init(true));
static cl::opt<bool> ErrorNoncontigiousRegister(
"merror-noncontigious-register",
cl::desc("Error for register names that aren't contigious"),
cl::init(false));
static cl::opt<bool> AddBuildAttributes("hexagon-add-build-attributes");
namespace {
struct HexagonOperand;
class HexagonAsmParser : public MCTargetAsmParser { … };
struct HexagonOperand : public MCParsedAsmOperand { … };
}
void HexagonOperand::print(raw_ostream &OS) const { … }
bool HexagonAsmParser::finishBundle(SMLoc IDLoc, MCStreamer &Out) { … }
bool HexagonAsmParser::matchBundleOptions() { … }
void HexagonAsmParser::canonicalizeImmediates(MCInst &MCI) { … }
bool HexagonAsmParser::matchOneInstruction(MCInst &MCI, SMLoc IDLoc,
OperandVector &InstOperands,
uint64_t &ErrorInfo,
bool MatchingInlineAsm) { … }
void HexagonAsmParser::eatToEndOfPacket() { … }
bool HexagonAsmParser::matchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
OperandVector &Operands,
MCStreamer &Out,
uint64_t &ErrorInfo,
bool MatchingInlineAsm) { … }
bool HexagonAsmParser::parseDirectiveAttribute(SMLoc L) { … }
bool HexagonAsmParser::ParseDirective(AsmToken DirectiveID) { … }
bool HexagonAsmParser::ParseDirectiveSubsection(SMLoc L) { … }
bool HexagonAsmParser::ParseDirectiveFalign(unsigned Size, SMLoc L) { … }
bool HexagonAsmParser::ParseDirectiveComm(bool IsLocal, SMLoc Loc) { … }
bool HexagonAsmParser::RegisterMatchesArch(MCRegister MatchNum) const { … }
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeHexagonAsmParser() { … }
#define GET_MATCHER_IMPLEMENTATION
#define GET_REGISTER_MATCHER
#include "HexagonGenAsmMatcher.inc"
static bool previousEqual(OperandVector &Operands, size_t Index,
StringRef String) { … }
static bool previousIsLoop(OperandVector &Operands, size_t Index) { … }
bool HexagonAsmParser::splitIdentifier(OperandVector &Operands) { … }
bool HexagonAsmParser::parseOperand(OperandVector &Operands) { … }
bool HexagonAsmParser::isLabel(AsmToken &Token) { … }
bool HexagonAsmParser::handleNoncontigiousRegister(bool Contigious,
SMLoc &Loc) { … }
bool HexagonAsmParser::parseRegister(MCRegister &Reg, SMLoc &StartLoc,
SMLoc &EndLoc) { … }
ParseStatus HexagonAsmParser::tryParseRegister(MCRegister &Reg, SMLoc &StartLoc,
SMLoc &EndLoc) { … }
bool HexagonAsmParser::implicitExpressionLocation(OperandVector &Operands) { … }
bool HexagonAsmParser::parseExpression(MCExpr const *&Expr) { … }
bool HexagonAsmParser::parseExpressionOrOperand(OperandVector &Operands) { … }
bool HexagonAsmParser::parseInstruction(OperandVector &Operands) { … }
bool HexagonAsmParser::parseInstruction(ParseInstructionInfo &Info,
StringRef Name, AsmToken ID,
OperandVector &Operands) { … }
static MCInst makeCombineInst(int opCode, MCOperand &Rdd, MCOperand &MO1,
MCOperand &MO2) { … }
unsigned HexagonAsmParser::validateTargetOperandClass(MCParsedAsmOperand &AsmOp,
unsigned Kind) { … }
bool HexagonAsmParser::OutOfRange(SMLoc IDLoc, long long Val, long long Max) { … }
int HexagonAsmParser::processInstruction(MCInst &Inst,
OperandVector const &Operands,
SMLoc IDLoc) { … }
MCRegister HexagonAsmParser::matchRegister(StringRef Name) { … }