50 std::unique_ptr<LanaiOperand> parseRegister();
54 std::unique_ptr<LanaiOperand> parseIdentifier();
56 unsigned parseAluOperator(
bool PreOp,
bool PostOp);
64 bool ParseDirective(
AsmToken DirectiveID)
override;
69 bool ParseRegister(
unsigned &RegNum,
SMLoc &StartLoc,
SMLoc &EndLoc)
override;
71 bool MatchAndEmitInstruction(
SMLoc IdLoc,
unsigned &Opcode,
74 bool MatchingInlineAsm)
override;
77 #define GET_ASSEMBLER_HEADER 78 #include "LanaiGenAsmMatcher.inc" 89 Lexer(Parser.getLexer()), SubtargetInfo(STI) {
91 ComputeAvailableFeatures(SubtargetInfo.getFeatureBits()));
113 SMLoc StartLoc, EndLoc;
149 SMLoc getStartLoc()
const override {
return StartLoc; }
152 SMLoc getEndLoc()
const override {
return EndLoc; }
154 unsigned getReg()
const override {
159 const MCExpr *getImm()
const {
160 assert(isImm() &&
"Invalid type access!");
165 assert(isToken() &&
"Invalid type access!");
169 unsigned getMemBaseReg()
const {
174 unsigned getMemOffsetReg()
const {
176 return Mem.OffsetReg;
179 const MCExpr *getMemOffset()
const {
184 unsigned getMemOp()
const {
190 bool isReg()
const override {
return Kind == REGISTER; }
192 bool isImm()
const override {
return Kind == IMMEDIATE; }
194 bool isMem()
const override {
195 return isMemImm() || isMemRegImm() || isMemRegReg();
198 bool isMemImm()
const {
return Kind == MEMORY_IMM; }
200 bool isMemRegImm()
const {
return Kind == MEMORY_REG_IMM; }
202 bool isMemRegReg()
const {
return Kind == MEMORY_REG_REG; }
204 bool isMemSpls()
const {
return isMemRegImm() || isMemRegReg(); }
206 bool isToken()
const override {
return Kind ==
TOKEN; }
218 return isShiftedUInt<23, 2>(
static_cast<int32_t
>(Value));
221 bool isBrTarget() {
return isBrImm() || isToken(); }
223 bool isCallTarget() {
return isImm() || isToken(); }
230 if (
const MCConstantExpr *ConstExpr = dyn_cast<MCConstantExpr>(Imm.Value)) {
231 int64_t
Value = ConstExpr->getValue();
232 return Value != 0 && isShiftedUInt<16, 16>(Value);
236 if (
const LanaiMCExpr *SymbolRefExpr = dyn_cast<LanaiMCExpr>(Imm.Value))
240 if (
const MCBinaryExpr *BinaryExpr = dyn_cast<MCBinaryExpr>(Imm.Value))
242 dyn_cast<LanaiMCExpr>(BinaryExpr->getLHS()))
248 bool isHiImm16And() {
254 int64_t Value = ConstExpr->
getValue();
256 return (Value != 0) && ((Value & ~0xffff0000) == 0xffff);
266 if (
const MCConstantExpr *ConstExpr = dyn_cast<MCConstantExpr>(Imm.Value)) {
267 int64_t Value = ConstExpr->
getValue();
269 return isUInt<16>(
static_cast<int32_t
>(Value));
273 if (
const LanaiMCExpr *SymbolRefExpr = dyn_cast<LanaiMCExpr>(Imm.Value))
277 if (
const MCBinaryExpr *BinaryExpr = dyn_cast<MCBinaryExpr>(Imm.Value))
279 dyn_cast<LanaiMCExpr>(BinaryExpr->getLHS()))
285 bool isLoImm16Signed() {
290 if (
const MCConstantExpr *ConstExpr = dyn_cast<MCConstantExpr>(Imm.Value)) {
291 int64_t Value = ConstExpr->
getValue();
293 return isInt<16>(
static_cast<int32_t
>(Value));
297 if (
const LanaiMCExpr *SymbolRefExpr = dyn_cast<LanaiMCExpr>(Imm.Value))
301 if (
const MCBinaryExpr *BinaryExpr = dyn_cast<MCBinaryExpr>(Imm.Value))
303 dyn_cast<LanaiMCExpr>(BinaryExpr->getLHS()))
309 bool isLoImm16And() {
315 int64_t Value = ConstExpr->
getValue();
317 return ((Value & ~0xffff) == 0xffff0000);
329 int64_t Value = ConstExpr->
getValue();
330 return (Value >= -31) && (Value <= 31);
338 if (
const MCConstantExpr *ConstExpr = dyn_cast<MCConstantExpr>(Imm.Value)) {
339 int64_t Value = ConstExpr->
getValue();
340 return isUInt<21>(Value);
344 if (
const LanaiMCExpr *SymbolRefExpr = dyn_cast<LanaiMCExpr>(Imm.Value))
347 dyn_cast<MCSymbolRefExpr>(Imm.Value)) {
352 if (
const MCBinaryExpr *BinaryExpr = dyn_cast<MCBinaryExpr>(Imm.Value)) {
354 dyn_cast<LanaiMCExpr>(BinaryExpr->getLHS()))
357 dyn_cast<MCSymbolRefExpr>(BinaryExpr->getLHS()))
371 int64_t Value = ConstExpr->
getValue();
372 return isInt<10>(Value);
382 uint64_t Value = ConstExpr->
getValue();
393 else if (
const MCConstantExpr *ConstExpr = dyn_cast<MCConstantExpr>(Expr))
400 void addRegOperands(
MCInst &Inst,
unsigned N)
const {
401 assert(N == 1 &&
"Invalid number of operands!");
405 void addImmOperands(
MCInst &Inst,
unsigned N)
const {
406 assert(N == 1 &&
"Invalid number of operands!");
407 addExpr(Inst, getImm());
410 void addBrTargetOperands(
MCInst &Inst,
unsigned N)
const {
411 assert(N == 1 &&
"Invalid number of operands!");
412 addExpr(Inst, getImm());
415 void addCallTargetOperands(
MCInst &Inst,
unsigned N)
const {
416 assert(N == 1 &&
"Invalid number of operands!");
417 addExpr(Inst, getImm());
420 void addCondCodeOperands(
MCInst &Inst,
unsigned N)
const {
421 assert(N == 1 &&
"Invalid number of operands!");
422 addExpr(Inst, getImm());
425 void addMemImmOperands(
MCInst &Inst,
unsigned N)
const {
426 assert(N == 1 &&
"Invalid number of operands!");
427 const MCExpr *Expr = getMemOffset();
431 void addMemRegImmOperands(
MCInst &Inst,
unsigned N)
const {
432 assert(N == 3 &&
"Invalid number of operands!");
434 const MCExpr *Expr = getMemOffset();
439 void addMemRegRegOperands(
MCInst &Inst,
unsigned N)
const {
440 assert(N == 3 &&
"Invalid number of operands!");
442 assert(getMemOffsetReg() != 0 &&
"Invalid offset");
447 void addMemSplsOperands(
MCInst &Inst,
unsigned N)
const {
449 addMemRegImmOperands(Inst, N);
451 addMemRegRegOperands(Inst, N);
454 void addImmShiftOperands(
MCInst &Inst,
unsigned N)
const {
455 assert(N == 1 &&
"Invalid number of operands!");
456 addExpr(Inst, getImm());
459 void addImm10Operands(
MCInst &Inst,
unsigned N)
const {
460 assert(N == 1 &&
"Invalid number of operands!");
461 addExpr(Inst, getImm());
464 void addLoImm16Operands(
MCInst &Inst,
unsigned N)
const {
465 assert(N == 1 &&
"Invalid number of operands!");
466 if (
const MCConstantExpr *ConstExpr = dyn_cast<MCConstantExpr>(getImm()))
469 else if (isa<LanaiMCExpr>(getImm())) {
475 }
else if (isa<MCBinaryExpr>(getImm())) {
479 cast<LanaiMCExpr>(BinaryExpr->
getLHS())->getKind() ==
484 assert(
false &&
"Operand type not supported.");
487 void addLoImm16AndOperands(
MCInst &Inst,
unsigned N)
const {
488 assert(N == 1 &&
"Invalid number of operands!");
489 if (
const MCConstantExpr *ConstExpr = dyn_cast<MCConstantExpr>(getImm()))
492 assert(
false &&
"Operand type not supported.");
495 void addHiImm16Operands(
MCInst &Inst,
unsigned N)
const {
496 assert(N == 1 &&
"Invalid number of operands!");
497 if (
const MCConstantExpr *ConstExpr = dyn_cast<MCConstantExpr>(getImm()))
499 else if (isa<LanaiMCExpr>(getImm())) {
505 }
else if (isa<MCBinaryExpr>(getImm())) {
509 cast<LanaiMCExpr>(BinaryExpr->
getLHS())->getKind() ==
514 assert(
false &&
"Operand type not supported.");
517 void addHiImm16AndOperands(
MCInst &Inst,
unsigned N)
const {
518 assert(N == 1 &&
"Invalid number of operands!");
519 if (
const MCConstantExpr *ConstExpr = dyn_cast<MCConstantExpr>(getImm()))
522 assert(
false &&
"Operand type not supported.");
525 void addLoImm21Operands(
MCInst &Inst,
unsigned N)
const {
526 assert(N == 1 &&
"Invalid number of operands!");
527 if (
const MCConstantExpr *ConstExpr = dyn_cast<MCConstantExpr>(getImm()))
529 else if (isa<LanaiMCExpr>(getImm())) {
536 }
else if (isa<MCSymbolRefExpr>(getImm())) {
544 }
else if (isa<MCBinaryExpr>(getImm())) {
554 assert(
false &&
"Operand type not supported.");
560 OS <<
"Imm: " << getImm() <<
"\n";
563 OS <<
"Token: " <<
getToken() <<
"\n";
566 OS <<
"Reg: %r" <<
getReg() <<
"\n";
569 OS <<
"MemImm: " << *getMemOffset() <<
"\n";
572 OS <<
"MemRegImm: " << getMemBaseReg() <<
"+" << *getMemOffset() <<
"\n";
575 assert(getMemOffset() ==
nullptr);
576 OS <<
"MemRegReg: " << getMemBaseReg() <<
"+" 577 <<
"%r" << getMemOffsetReg() <<
"\n";
582 static std::unique_ptr<LanaiOperand> CreateToken(
StringRef Str,
SMLoc Start) {
583 auto Op = make_unique<LanaiOperand>(
TOKEN);
584 Op->Tok.Data = Str.
data();
585 Op->Tok.Length = Str.
size();
586 Op->StartLoc = Start;
591 static std::unique_ptr<LanaiOperand> createReg(
unsigned RegNum,
SMLoc Start,
593 auto Op = make_unique<LanaiOperand>(REGISTER);
594 Op->Reg.RegNum = RegNum;
595 Op->StartLoc = Start;
600 static std::unique_ptr<LanaiOperand> createImm(
const MCExpr *Value,
602 auto Op = make_unique<LanaiOperand>(IMMEDIATE);
603 Op->Imm.Value = Value;
604 Op->StartLoc = Start;
609 static std::unique_ptr<LanaiOperand>
610 MorphToMemImm(std::unique_ptr<LanaiOperand>
Op) {
611 const MCExpr *Imm = Op->getImm();
612 Op->Kind = MEMORY_IMM;
615 Op->Mem.OffsetReg = 0;
616 Op->Mem.Offset = Imm;
620 static std::unique_ptr<LanaiOperand>
621 MorphToMemRegReg(
unsigned BaseReg, std::unique_ptr<LanaiOperand> Op,
623 unsigned OffsetReg = Op->getReg();
624 Op->Kind = MEMORY_REG_REG;
625 Op->Mem.BaseReg = BaseReg;
626 Op->Mem.AluOp = AluOp;
627 Op->Mem.OffsetReg = OffsetReg;
628 Op->Mem.Offset =
nullptr;
632 static std::unique_ptr<LanaiOperand>
633 MorphToMemRegImm(
unsigned BaseReg, std::unique_ptr<LanaiOperand> Op,
635 const MCExpr *Imm = Op->getImm();
636 Op->Kind = MEMORY_REG_IMM;
637 Op->Mem.BaseReg = BaseReg;
638 Op->Mem.AluOp = AluOp;
639 Op->Mem.OffsetReg = 0;
640 Op->Mem.Offset = Imm;
647 bool LanaiAsmParser::ParseDirective(
AsmToken ) {
return true; }
649 bool LanaiAsmParser::MatchAndEmitInstruction(
SMLoc IdLoc,
unsigned &Opcode,
653 bool MatchingInlineAsm) {
657 switch (MatchInstructionImpl(Operands, Inst, ErrorInfo, MatchingInlineAsm)) {
662 case Match_MissingFeature:
663 return Error(IdLoc,
"Instruction use requires option to be enabled");
664 case Match_MnemonicFail:
665 return Error(IdLoc,
"Unrecognized instruction mnemonic");
666 case Match_InvalidOperand: {
668 if (ErrorInfo != ~0U) {
669 if (ErrorInfo >= Operands.
size())
670 return Error(IdLoc,
"Too few operands for instruction");
672 ErrorLoc = ((LanaiOperand &)*Operands[ErrorInfo]).getStartLoc();
673 if (ErrorLoc ==
SMLoc())
676 return Error(ErrorLoc,
"Invalid operand for instruction");
689 std::unique_ptr<LanaiOperand> LanaiAsmParser::parseRegister() {
690 SMLoc Start = Parser.getTok().getLoc();
702 return LanaiOperand::createReg(RegNum, Start, End);
707 bool LanaiAsmParser::ParseRegister(
unsigned &RegNum,
SMLoc &StartLoc,
709 const AsmToken &Tok = getParser().getTok();
712 std::unique_ptr<LanaiOperand> Op = parseRegister();
714 RegNum = Op->getReg();
715 return (Op ==
nullptr);
718 std::unique_ptr<LanaiOperand> LanaiAsmParser::parseIdentifier() {
719 SMLoc Start = Parser.getTok().getLoc();
721 const MCExpr *Res, *RHS =
nullptr;
728 if (Parser.parseIdentifier(Identifier))
741 Error(Lexer.getLoc(),
"Expected '('");
747 if (Parser.parseIdentifier(Identifier))
752 if (Lexer.getKind() ==
AsmToken::Plus && Parser.parseExpression(RHS))
758 Error(Lexer.getLoc(),
"Expected ')'");
765 MCSymbol *Sym = getContext().getOrCreateSymbol(Identifier);
773 return LanaiOperand::createImm(Res, Start, End);
777 SMLoc Start = Parser.getTok().getLoc();
781 switch (Lexer.getKind()) {
783 return parseIdentifier();
788 if (!Parser.parseExpression(ExprVal))
789 return LanaiOperand::createImm(ExprVal, Start, End);
804 unsigned LanaiAsmParser::parseAluOperator(
bool PreOp,
bool PostOp) {
806 Parser.parseIdentifier(IdString);
809 Error(Parser.getTok().getLoc(),
"Can't parse ALU operator");
819 bool LanaiAsmParser::parsePrePost(
StringRef Type,
int *OffsetValue) {
820 bool PreOrPost =
false;
821 if (Lexer.getKind() == Lexer.peekTok(
true).getKind()) {
844 if (
const MCConstantExpr *ConstExpr = dyn_cast<MCConstantExpr>(Op.getImm())) {
845 int64_t Value = ConstExpr->
getValue();
846 return (Value % 4 == 0) && (Value >= 0) && (Value <= 0x1fffff);
850 if (
const LanaiMCExpr *SymbolRefExpr = dyn_cast<LanaiMCExpr>(Op.getImm()))
855 if (
const MCBinaryExpr *BinaryExpr = dyn_cast<MCBinaryExpr>(Op.getImm())) {
858 return (LHSSymbolRefExpr &&
866 LanaiAsmParser::parseMemoryOperand(
OperandVector &Operands) {
879 if (Operands[0]->isToken())
880 Type =
static_cast<LanaiOperand *
>(Operands[0].get())->
getToken();
884 unsigned BaseReg = 0;
886 bool PostOp =
false, PreOp =
false;
889 std::unique_ptr<LanaiOperand> Op = parseRegister();
906 std::unique_ptr<LanaiOperand>
Offset =
nullptr;
911 PreOp = parsePrePost(Type, &OffsetValue);
913 Op = parseRegister();
922 Operands.
push_back(LanaiOperand::MorphToMemImm(std::move(Op)));
924 if (!Op->isLoImm16Signed()) {
925 Error(Parser.getTok().getLoc(),
926 "Memory address is not word " 927 "aligned and larger than class RM can handle");
930 Operands.
push_back(LanaiOperand::MorphToMemRegImm(
937 Error(Parser.getTok().getLoc(),
938 "Unknown operand, expected register or immediate");
941 BaseReg = Op->getReg();
945 PostOp = parsePrePost(Type, &OffsetValue);
951 SMLoc Start = Parser.getTok().getLoc();
956 Offset = LanaiOperand::createImm(OffsetConstExpr, Start, End);
959 if (Offset || OffsetValue != 0) {
960 Error(Parser.getTok().getLoc(),
"Expected ']'");
965 AluOp = parseAluOperator(PreOp, PostOp);
968 Offset = parseRegister();
970 Error(Parser.getTok().getLoc(),
"Expected ']'");
981 if (Offset->isImm() && !Offset->isLoImm16Signed()) {
982 Error(Parser.getTok().getLoc(),
983 "Memory address is not word " 984 "aligned and larger than class RM can handle");
990 ? LanaiOperand::MorphToMemRegImm(BaseReg, std::move(Offset), AluOp)
991 : LanaiOperand::MorphToMemRegReg(BaseReg, std::move(Offset), AluOp));
1008 Parser.eatToEndOfStatement();
1013 std::unique_ptr<LanaiOperand> Op = parseRegister();
1021 Error(Parser.getTok().getLoc(),
"Unknown operand");
1022 Parser.eatToEndOfStatement();
1036 size_t Next = Name.
find(
'.');
1047 if (Mnemonic[0] ==
'b' ||
1048 (Mnemonic[0] ==
's' && !Mnemonic.
startswith(
"sel") &&
1055 Mnemonic = Mnemonic.
slice(0, 1);
1056 Operands->
push_back(LanaiOperand::CreateToken(Mnemonic, NameLoc));
1057 Operands->
push_back(LanaiOperand::createImm(
1060 Operands->
push_back(LanaiOperand::CreateToken(
".r", NameLoc));
1074 size_t Next = Mnemonic.
rfind(
'.', Name.
size());
1081 Mnemonic = Mnemonic.
substr(0, Next + 1);
1083 Mnemonic = Mnemonic.
substr(0, Next);
1085 Operands->
push_back(LanaiOperand::CreateToken(Mnemonic, NameLoc));
1086 Operands->
push_back(LanaiOperand::createImm(
1092 Operands->
push_back(LanaiOperand::CreateToken(Mnemonic, NameLoc));
1094 Operands->
push_back(LanaiOperand::CreateToken(
".r", NameLoc));
1106 bool Modifies =
false;
1110 if (Operands.
size() < 5)
1112 else if (Operands[0]->isToken() && Operands[1]->isReg() &&
1113 Operands[2]->isImm() && Operands[3]->isImm() && Operands[4]->isReg())
1115 else if (Operands[0]->isToken() && Operands[1]->isToken() &&
1116 Operands[2]->isReg() && Operands[3]->isImm() &&
1117 Operands[4]->isImm() && Operands[5]->isReg())
1122 int PossibleAluOpIdx = Offset + 3;
1123 int PossibleBaseIdx = Offset + 1;
1124 int PossibleDestIdx = Offset + 4;
1125 if (LanaiOperand *PossibleAluOp =
1126 static_cast<LanaiOperand *>(Operands[PossibleAluOpIdx].
get()))
1127 if (PossibleAluOp->isImm())
1129 dyn_cast<MCConstantExpr>(PossibleAluOp->getImm()))
1131 return Modifies && Operands[PossibleBaseIdx]->isReg() &&
1132 Operands[PossibleDestIdx]->isReg() &&
1133 Operands[PossibleBaseIdx]->getReg() ==
1134 Operands[PossibleDestIdx]->getReg();
1138 return static_cast<const LanaiOperand &
>(
op).
isReg();
1146 static_cast<const LanaiOperand &
>(*Operands[0]).
getToken())
1147 .StartsWith(
"addc",
true)
1162 StringRef Mnemonic = splitMnemonic(Name, NameLoc, &Operands);
1175 Operands.
size() == 2) {
1177 Operands.
insert(Operands.
begin(), LanaiOperand::CreateToken(
"s", NameLoc));
1179 LanaiOperand::createImm(
1188 Operands.
size() == 3) {
1190 Operands.
insert(Operands.
begin(), LanaiOperand::CreateToken(
"bt", NameLoc));
1204 Error(Parser.getTok().getLoc(),
1205 "the destination register can't equal the base register in an " 1206 "instruction that modifies the base register.");
1214 LanaiOperand::createImm(
1222 #define GET_REGISTER_MATCHER 1223 #define GET_MATCHER_IMPLEMENTATION 1224 #include "LanaiGenAsmMatcher.inc" static bool isReg(const MCInst &MI, unsigned OpNo)
static CondCode suffixToLanaiCondCode(StringRef S)
Type
MessagePack types as defined in the standard, with the exception of Integer being divided into a sign...
static unsigned AluWithPrePost(unsigned AluCode, bool PreOp, bool PostOp)
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
This class represents lattice values for constants.
Target & getTheLanaiTarget()
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
VariantKind getKind() const
LLVM_NODISCARD bool equals_lower(StringRef RHS) const
equals_lower - Check for string equality, ignoring case.
Generic assembler parser interface, for use by target specific assembly parsers.
static bool modifiesOp(unsigned AluOp)
static MCOperand createExpr(const MCExpr *Val)
MCTargetAsmParser - Generic interface to target specific assembly parsers.
LLVM_NODISCARD size_t rfind(char C, size_t From=npos) const
Search for the last character C in the string.
void push_back(const T &Elt)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
static int SizeForSuffix(StringRef T)
const MCExpr * getLHS() const
Get the left-hand side expression of the binary operator.
constexpr bool isInt< 16 >(int64_t x)
TOKEN(Invalid) TOKEN(Int) TOKEN(String) TOKEN(Identifier) SHORT_TOKEN(BlockBegin
static bool IsMemoryAssignmentError(const OperandVector &Operands)
void LLVMInitializeLanaiAsmParser()
static const LanaiMCExpr * create(VariantKind Kind, const MCExpr *Expr, MCContext &Ctx)
static unsigned makePostOp(unsigned AluOp)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
virtual void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI, bool PrintSchedInfo=false)
Emit the given Instruction into the current section.
static bool MaybePredicatedInst(const OperandVector &Operands)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool endswith(StringRef Suffix) const
Check if this string ends with the given Suffix.
amdgpu Simplify well known AMD library false Value Value const Twine & Name
static MCOperand createReg(unsigned Reg)
Generic assembler lexer interface, for use by target specific assembly lexers.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Base class for the full range of assembler expressions which are needed for parsing.
static bool IsRegister(const MCParsedAsmOperand &op)
Target independent representation for an assembler token.
Represent a reference to a symbol from inside an expression.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE R Default(T Value)
static bool isMem(const MachineInstr &MI, unsigned Op)
MCParsedAsmOperand - This abstract class represents a source-level assembly instruction operand...
std::pair< StringRef, StringRef > getToken(StringRef Source, StringRef Delimiters=" \\\)
getToken - This function extracts one token from source, ignoring any leading characters that appear ...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
RegisterMCAsmParser - Helper template for registering a target specific assembly parser, for use in the target machine initialization function.
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Instances of this class represent a single low-level machine instruction.
Analysis containing CSE Info
A switch()-like statement whose cases are string literals.
Streaming machine code generation interface.
The instances of the Type class are immutable: once they are created, they are never changed...
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
Interface to description of machine instruction set.
bool shouldBeSls(const LanaiOperand &Op)
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
iterator erase(const_iterator CI)
LLVM_ATTRIBUTE_ALWAYS_INLINE StringSwitch & EndsWith(StringLiteral S, T Value)
Binary assembler expressions.
LLVM_ATTRIBUTE_ALWAYS_INLINE StringSwitch & StartsWith(StringLiteral S, T Value)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef slice(size_t Start, size_t End) const
Return a reference to the substring from [Start, End).
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
static unsigned makePreOp(unsigned AluOp)
Base class for user error types.
iterator insert(iterator I, T &&Elt)
static SMLoc getFromPointer(const char *Ptr)
static AluCode stringToLanaiAluCode(StringRef S)
Generic base class for all target subtargets.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
VariantKind getKind() const
constexpr bool isUInt< 16 >(uint64_t x)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream...
void addOperand(const MCOperand &Op)
StringRef - Represent a constant reference to a string, i.e.
Represents a location in source code.
unsigned getOpcode() const
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t find(char C, size_t From=0) const
Search for the first character C in the string.
static MCOperand createImm(int64_t Val)
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)
bool parseImmediate(MCInst &MI, uint64_t &Size, ArrayRef< uint8_t > Bytes)
static unsigned MatchRegisterName(StringRef Name)