#include "LanaiAluCode.h"
#include "LanaiCondCode.h"
#include "LanaiInstrInfo.h"
#include "MCTargetDesc/LanaiMCExpr.h"
#include "TargetInfo/LanaiTargetInfo.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/MC/MCContext.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/MCParsedAsmOperand.h"
#include "llvm/MC/MCParser/MCTargetAsmParser.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/SMLoc.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <optional>
usingnamespacellvm;
static MCRegister MatchRegisterName(StringRef Name);
namespace {
struct LanaiOperand;
class LanaiAsmParser : public MCTargetAsmParser { … };
struct LanaiOperand : public MCParsedAsmOperand { … };
}
bool LanaiAsmParser::MatchAndEmitInstruction(SMLoc IdLoc, unsigned &Opcode,
OperandVector &Operands,
MCStreamer &Out,
uint64_t &ErrorInfo,
bool MatchingInlineAsm) { … }
std::unique_ptr<LanaiOperand>
LanaiAsmParser::parseRegister(bool RestoreOnFailure) { … }
bool LanaiAsmParser::parseRegister(MCRegister &RegNum, SMLoc &StartLoc,
SMLoc &EndLoc) { … }
ParseStatus LanaiAsmParser::tryParseRegister(MCRegister &Reg, SMLoc &StartLoc,
SMLoc &EndLoc) { … }
std::unique_ptr<LanaiOperand> LanaiAsmParser::parseIdentifier() { … }
std::unique_ptr<LanaiOperand> LanaiAsmParser::parseImmediate() { … }
static unsigned AluWithPrePost(unsigned AluCode, bool PreOp, bool PostOp) { … }
unsigned LanaiAsmParser::parseAluOperator(bool PreOp, bool PostOp) { … }
static int SizeForSuffix(StringRef T) { … }
bool LanaiAsmParser::parsePrePost(StringRef Type, int *OffsetValue) { … }
bool shouldBeSls(const LanaiOperand &Op) { … }
ParseStatus LanaiAsmParser::parseMemoryOperand(OperandVector &Operands) { … }
ParseStatus LanaiAsmParser::parseOperand(OperandVector *Operands,
StringRef Mnemonic) { … }
StringRef LanaiAsmParser::splitMnemonic(StringRef Name, SMLoc NameLoc,
OperandVector *Operands) { … }
static bool IsMemoryAssignmentError(const OperandVector &Operands) { … }
static bool IsRegister(const MCParsedAsmOperand &op) { … }
static bool MaybePredicatedInst(const OperandVector &Operands) { … }
bool LanaiAsmParser::ParseInstruction(ParseInstructionInfo & ,
StringRef Name, SMLoc NameLoc,
OperandVector &Operands) { … }
#define GET_REGISTER_MATCHER
#define GET_MATCHER_IMPLEMENTATION
#include "LanaiGenAsmMatcher.inc"
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeLanaiAsmParser() { … }