35 #define GEN_COMPRESS_INSTR 36 #include "RISCVGenCompressInstEmitter.inc" 42 SMLoc getLoc()
const {
return getParser().getTok().getLoc(); }
43 bool isRV64()
const {
return getSTI().hasFeature(RISCV::Feature64Bit); }
51 unsigned Kind)
override;
56 bool MatchAndEmitInstruction(
SMLoc IDLoc,
unsigned &Opcode,
59 bool MatchingInlineAsm)
override;
61 bool ParseRegister(
unsigned &RegNo,
SMLoc &StartLoc,
SMLoc &EndLoc)
override;
66 bool ParseDirective(
AsmToken DirectiveID)
override;
83 #define GET_ASSEMBLER_HEADER 84 #include "RISCVGenAsmMatcher.inc" 88 bool AllowParens =
false);
92 bool parseOperand(
OperandVector &Operands,
bool ForceImmediate);
94 bool parseDirectiveOption();
96 void setFeatureBits(uint64_t Feature,
StringRef FeatureString) {
97 if (!(getSTI().getFeatureBits()[Feature])) {
104 void clearFeatureBits(uint64_t Feature,
StringRef FeatureString) {
105 if (getSTI().getFeatureBits()[Feature]) {
107 setAvailableFeatures(
112 enum RISCVMatchResultTy {
113 Match_Dummy = FIRST_TARGET_MATCH_RESULT_TY,
114 #define GET_OPERAND_DIAGNOSTIC_TYPES 115 #include "RISCVGenAsmMatcher.inc" 116 #undef GET_OPERAND_DIAGNOSTIC_TYPES 119 static bool classifySymbolRef(
const MCExpr *Expr,
130 setAvailableFeatures(ComputeAvailableFeatures(STI.
getFeatureBits()));
154 SMLoc StartLoc, EndLoc;
167 StartLoc = o.StartLoc;
182 bool isToken()
const override {
return Kind == Token; }
184 bool isImm()
const override {
return Kind == Immediate; }
185 bool isMem()
const override {
return false; }
188 const MCExpr *Val = getImm();
190 if (
auto *RE = dyn_cast<RISCVMCExpr>(Val)) {
191 Ret = RE->evaluateAsConstant(Imm);
193 }
else if (
auto CE = dyn_cast<MCConstantExpr>(Val)) {
196 Imm = CE->getValue();
203 template <
int N>
bool isBareSimmNLsb0()
const {
208 bool IsConstantImm = evaluateConstantImm(Imm, VK);
211 IsValid = RISCVAsmParser::classifySymbolRef(getImm(), VK, Imm);
219 bool isBareSymbol()
const {
223 if (!isImm() || evaluateConstantImm(Imm, VK))
225 return RISCVAsmParser::classifySymbolRef(getImm(), VK, Imm) &&
231 bool isFenceArg()
const {
234 const MCExpr *Val = getImm();
239 StringRef Str = SVal->getSymbol().getName();
245 if (c !=
'i' && c !=
'o' && c !=
'r' && c !=
'w')
255 bool isFRMArg()
const {
258 const MCExpr *Val = getImm();
263 StringRef Str = SVal->getSymbol().getName();
268 bool isImmXLen()
const {
273 bool IsConstantImm = evaluateConstantImm(Imm, VK);
280 bool isUImmLog2XLen()
const {
287 return (isRV64() && isUInt<6>(Imm)) || isUInt<5>(Imm);
290 bool isUImmLog2XLenNonZero()
const {
299 return (isRV64() && isUInt<6>(Imm)) || isUInt<5>(Imm);
302 bool isUImm5()
const {
307 bool IsConstantImm = evaluateConstantImm(Imm, VK);
311 bool isUImm5NonZero()
const {
316 bool IsConstantImm = evaluateConstantImm(Imm, VK);
317 return IsConstantImm && isUInt<5>(Imm) && (Imm != 0) &&
321 bool isSImm6()
const {
325 bool IsConstantImm = evaluateConstantImm(Imm, VK);
327 IsValid = RISCVAsmParser::classifySymbolRef(getImm(), VK, Imm);
329 IsValid = isInt<6>(Imm);
334 bool isSImm6NonZero()
const {
338 bool IsConstantImm = evaluateConstantImm(Imm, VK);
340 IsValid = RISCVAsmParser::classifySymbolRef(getImm(), VK, Imm);
342 IsValid = ((Imm != 0) && isInt<6>(Imm));
347 bool isCLUIImm()
const {
350 bool IsConstantImm = evaluateConstantImm(Imm, VK);
351 return IsConstantImm && (Imm != 0) &&
352 (isUInt<5>(Imm) || (Imm >= 0xfffe0 && Imm <= 0xfffff)) &&
356 bool isUImm7Lsb00()
const {
359 bool IsConstantImm = evaluateConstantImm(Imm, VK);
360 return IsConstantImm && isShiftedUInt<5, 2>(Imm) &&
364 bool isUImm8Lsb00()
const {
367 bool IsConstantImm = evaluateConstantImm(Imm, VK);
368 return IsConstantImm && isShiftedUInt<6, 2>(Imm) &&
372 bool isUImm8Lsb000()
const {
375 bool IsConstantImm = evaluateConstantImm(Imm, VK);
376 return IsConstantImm && isShiftedUInt<5, 3>(Imm) &&
380 bool isSImm9Lsb0()
const {
return isBareSimmNLsb0<9>(); }
382 bool isUImm9Lsb000()
const {
385 bool IsConstantImm = evaluateConstantImm(Imm, VK);
386 return IsConstantImm && isShiftedUInt<6, 3>(Imm) &&
390 bool isUImm10Lsb00NonZero()
const {
393 bool IsConstantImm = evaluateConstantImm(Imm, VK);
394 return IsConstantImm && isShiftedUInt<8, 2>(Imm) && (Imm != 0) &&
398 bool isSImm12()
const {
404 bool IsConstantImm = evaluateConstantImm(Imm, VK);
406 IsValid = RISCVAsmParser::classifySymbolRef(getImm(), VK, Imm);
408 IsValid = isInt<12>(Imm);
414 bool isSImm12Lsb0()
const {
return isBareSimmNLsb0<12>(); }
416 bool isUImm12()
const {
421 bool IsConstantImm = evaluateConstantImm(Imm, VK);
425 bool isSImm13Lsb0()
const {
return isBareSimmNLsb0<13>(); }
427 bool isSImm10Lsb0000NonZero()
const {
430 bool IsConstantImm = evaluateConstantImm(Imm, VK);
431 return IsConstantImm && (Imm != 0) && isShiftedInt<6, 4>(Imm) &&
435 bool isUImm20()
const {
441 bool IsConstantImm = evaluateConstantImm(Imm, VK);
443 IsValid = RISCVAsmParser::classifySymbolRef(getImm(), VK, Imm);
445 IsValid = isUInt<20>(Imm);
451 bool isSImm21Lsb0()
const {
return isBareSimmNLsb0<21>(); }
454 SMLoc getStartLoc()
const override {
return StartLoc; }
456 SMLoc getEndLoc()
const override {
return EndLoc; }
458 bool isRV64()
const {
return IsRV64; }
460 unsigned getReg()
const override {
465 const MCExpr *getImm()
const {
466 assert(Kind == Immediate &&
"Invalid type access!");
471 assert(Kind == Token &&
"Invalid type access!");
490 static std::unique_ptr<RISCVOperand> createToken(
StringRef Str,
SMLoc S,
492 auto Op = make_unique<RISCVOperand>(Token);
500 static std::unique_ptr<RISCVOperand> createReg(
unsigned RegNo,
SMLoc S,
502 auto Op = make_unique<RISCVOperand>(
Register);
503 Op->Reg.RegNum = RegNo;
510 static std::unique_ptr<RISCVOperand> createImm(
const MCExpr *Val,
SMLoc S,
512 auto Op = make_unique<RISCVOperand>(Immediate);
521 assert(Expr &&
"Expr shouldn't be null!");
523 bool IsConstant =
false;
524 if (
auto *RE = dyn_cast<RISCVMCExpr>(Expr)) {
525 IsConstant = RE->evaluateAsConstant(Imm);
526 }
else if (
auto *CE = dyn_cast<MCConstantExpr>(Expr)) {
528 Imm = CE->getValue();
538 void addRegOperands(
MCInst &Inst,
unsigned N)
const {
539 assert(N == 1 &&
"Invalid number of operands!");
543 void addImmOperands(
MCInst &Inst,
unsigned N)
const {
544 assert(N == 1 &&
"Invalid number of operands!");
545 addExpr(Inst, getImm());
548 void addFenceArgOperands(
MCInst &Inst,
unsigned N)
const {
549 assert(N == 1 &&
"Invalid number of operands!");
551 auto SE = cast<MCSymbolRefExpr>(getImm());
554 for (
char c : SE->getSymbol().getName()) {
570 auto SE = cast<MCSymbolRefExpr>(getImm());
577 void addFRMArgOperands(
MCInst &Inst,
unsigned N)
const {
578 assert(N == 1 &&
"Invalid number of operands!");
584 #define GET_REGISTER_MATCHER 585 #define GET_MATCHER_IMPLEMENTATION 586 #include "RISCVGenAsmMatcher.inc" 595 case RISCV::F0_32:
return RISCV::F0_64;
596 case RISCV::F1_32:
return RISCV::F1_64;
597 case RISCV::F2_32:
return RISCV::F2_64;
598 case RISCV::F3_32:
return RISCV::F3_64;
599 case RISCV::F4_32:
return RISCV::F4_64;
600 case RISCV::F5_32:
return RISCV::F5_64;
601 case RISCV::F6_32:
return RISCV::F6_64;
602 case RISCV::F7_32:
return RISCV::F7_64;
603 case RISCV::F8_32:
return RISCV::F8_64;
604 case RISCV::F9_32:
return RISCV::F9_64;
605 case RISCV::F10_32:
return RISCV::F10_64;
606 case RISCV::F11_32:
return RISCV::F11_64;
607 case RISCV::F12_32:
return RISCV::F12_64;
608 case RISCV::F13_32:
return RISCV::F13_64;
609 case RISCV::F14_32:
return RISCV::F14_64;
610 case RISCV::F15_32:
return RISCV::F15_64;
611 case RISCV::F16_32:
return RISCV::F16_64;
612 case RISCV::F17_32:
return RISCV::F17_64;
613 case RISCV::F18_32:
return RISCV::F18_64;
614 case RISCV::F19_32:
return RISCV::F19_64;
615 case RISCV::F20_32:
return RISCV::F20_64;
616 case RISCV::F21_32:
return RISCV::F21_64;
617 case RISCV::F22_32:
return RISCV::F22_64;
618 case RISCV::F23_32:
return RISCV::F23_64;
619 case RISCV::F24_32:
return RISCV::F24_64;
620 case RISCV::F25_32:
return RISCV::F25_64;
621 case RISCV::F26_32:
return RISCV::F26_64;
622 case RISCV::F27_32:
return RISCV::F27_64;
623 case RISCV::F28_32:
return RISCV::F28_64;
624 case RISCV::F29_32:
return RISCV::F29_64;
625 case RISCV::F30_32:
return RISCV::F30_64;
626 case RISCV::F31_32:
return RISCV::F31_64;
632 RISCVOperand &Op =
static_cast<RISCVOperand &
>(AsmOp);
634 return Match_InvalidOperand;
636 unsigned Reg = Op.getReg();
638 RISCVMCRegisterClasses[RISCV::FPR32RegClassID].contains(Reg);
640 RISCVMCRegisterClasses[RISCV::FPR32CRegClassID].contains(Reg);
644 if ((IsRegFPR32 && Kind == MCK_FPR64) ||
645 (IsRegFPR32C && Kind == MCK_FPR64C)) {
647 return Match_Success;
649 return Match_InvalidOperand;
652 bool RISCVAsmParser::generateImmOutOfRangeError(
653 OperandVector &Operands, uint64_t ErrorInfo, int64_t Lower, int64_t Upper,
654 Twine Msg =
"immediate must be an integer in the range") {
655 SMLoc ErrorLoc = ((RISCVOperand &)*Operands[ErrorInfo]).getStartLoc();
656 return Error(ErrorLoc, Msg +
" [" +
Twine(Lower) +
", " +
Twine(Upper) +
"]");
659 bool RISCVAsmParser::MatchAndEmitInstruction(
SMLoc IDLoc,
unsigned &Opcode,
663 bool MatchingInlineAsm) {
666 switch (MatchInstructionImpl(Operands, Inst, ErrorInfo, MatchingInlineAsm)) {
670 return processInstruction(Inst, IDLoc, Out);
671 case Match_MissingFeature:
672 return Error(IDLoc,
"instruction use requires an option to be enabled");
673 case Match_MnemonicFail:
674 return Error(IDLoc,
"unrecognized instruction mnemonic");
675 case Match_InvalidOperand: {
676 SMLoc ErrorLoc = IDLoc;
677 if (ErrorInfo != ~0U) {
678 if (ErrorInfo >= Operands.
size())
679 return Error(ErrorLoc,
"too few operands for instruction");
681 ErrorLoc = ((RISCVOperand &)*Operands[ErrorInfo]).getStartLoc();
682 if (ErrorLoc ==
SMLoc())
685 return Error(ErrorLoc,
"invalid operand for instruction");
687 case Match_InvalidImmXLen:
689 SMLoc ErrorLoc = ((RISCVOperand &)*Operands[ErrorInfo]).getStartLoc();
690 return Error(ErrorLoc,
"operand must be a constant 64-bit integer");
692 return generateImmOutOfRangeError(Operands, ErrorInfo,
693 std::numeric_limits<int32_t>::min(),
695 case Match_InvalidUImmLog2XLen:
697 return generateImmOutOfRangeError(Operands, ErrorInfo, 0, (1 << 6) - 1);
698 return generateImmOutOfRangeError(Operands, ErrorInfo, 0, (1 << 5) - 1);
699 case Match_InvalidUImmLog2XLenNonZero:
701 return generateImmOutOfRangeError(Operands, ErrorInfo, 1, (1 << 6) - 1);
702 return generateImmOutOfRangeError(Operands, ErrorInfo, 1, (1 << 5) - 1);
703 case Match_InvalidUImm5:
704 return generateImmOutOfRangeError(Operands, ErrorInfo, 0, (1 << 5) - 1);
705 case Match_InvalidSImm6:
706 return generateImmOutOfRangeError(Operands, ErrorInfo, -(1 << 5),
708 case Match_InvalidSImm6NonZero:
709 return generateImmOutOfRangeError(Operands, ErrorInfo, -(1 << 5),
711 "immediate must be non-zero in the range");
712 case Match_InvalidCLUIImm:
713 return generateImmOutOfRangeError(
714 Operands, ErrorInfo, 1, (1 << 5) - 1,
715 "immediate must be in [0xfffe0, 0xfffff] or");
716 case Match_InvalidUImm7Lsb00:
717 return generateImmOutOfRangeError(
718 Operands, ErrorInfo, 0, (1 << 7) - 4,
719 "immediate must be a multiple of 4 bytes in the range");
720 case Match_InvalidUImm8Lsb00:
721 return generateImmOutOfRangeError(
722 Operands, ErrorInfo, 0, (1 << 8) - 4,
723 "immediate must be a multiple of 4 bytes in the range");
724 case Match_InvalidUImm8Lsb000:
725 return generateImmOutOfRangeError(
726 Operands, ErrorInfo, 0, (1 << 8) - 8,
727 "immediate must be a multiple of 8 bytes in the range");
728 case Match_InvalidSImm9Lsb0:
729 return generateImmOutOfRangeError(
730 Operands, ErrorInfo, -(1 << 8), (1 << 8) - 2,
731 "immediate must be a multiple of 2 bytes in the range");
732 case Match_InvalidUImm9Lsb000:
733 return generateImmOutOfRangeError(
734 Operands, ErrorInfo, 0, (1 << 9) - 8,
735 "immediate must be a multiple of 8 bytes in the range");
736 case Match_InvalidUImm10Lsb00NonZero:
737 return generateImmOutOfRangeError(
738 Operands, ErrorInfo, 4, (1 << 10) - 4,
739 "immediate must be a multiple of 4 bytes in the range");
740 case Match_InvalidSImm10Lsb0000NonZero:
741 return generateImmOutOfRangeError(
742 Operands, ErrorInfo, -(1 << 9), (1 << 9) - 16,
743 "immediate must be a multiple of 16 bytes and non-zero in the range");
744 case Match_InvalidSImm12:
745 return generateImmOutOfRangeError(Operands, ErrorInfo, -(1 << 11),
747 case Match_InvalidSImm12Lsb0:
748 return generateImmOutOfRangeError(
749 Operands, ErrorInfo, -(1 << 11), (1 << 11) - 2,
750 "immediate must be a multiple of 2 bytes in the range");
751 case Match_InvalidUImm12:
752 return generateImmOutOfRangeError(Operands, ErrorInfo, 0, (1 << 12) - 1);
753 case Match_InvalidSImm13Lsb0:
754 return generateImmOutOfRangeError(
755 Operands, ErrorInfo, -(1 << 12), (1 << 12) - 2,
756 "immediate must be a multiple of 2 bytes in the range");
757 case Match_InvalidUImm20:
758 return generateImmOutOfRangeError(Operands, ErrorInfo, 0, (1 << 20) - 1);
759 case Match_InvalidSImm21Lsb0:
760 return generateImmOutOfRangeError(
761 Operands, ErrorInfo, -(1 << 20), (1 << 20) - 2,
762 "immediate must be a multiple of 2 bytes in the range");
763 case Match_InvalidFenceArg: {
764 SMLoc ErrorLoc = ((RISCVOperand &)*Operands[ErrorInfo]).getStartLoc();
767 "operand must be formed of letters selected in-order from 'iorw'");
769 case Match_InvalidFRMArg: {
770 SMLoc ErrorLoc = ((RISCVOperand &)*Operands[ErrorInfo]).getStartLoc();
773 "operand must be a valid floating point rounding mode mnemonic");
775 case Match_InvalidBareSymbol: {
776 SMLoc ErrorLoc = ((RISCVOperand &)*Operands[ErrorInfo]).getStartLoc();
777 return Error(ErrorLoc,
"operand must be a bare symbol name");
784 bool RISCVAsmParser::ParseRegister(
unsigned &RegNo,
SMLoc &StartLoc,
786 const AsmToken &Tok = getParser().getTok();
790 StringRef Name = getLexer().getTok().getIdentifier();
797 return Error(StartLoc,
"invalid register name");
802 SMLoc FirstS = getLoc();
803 bool HadParens =
false;
808 size_t ReadCount = getLexer().peekTokens(Buf);
815 switch (getLexer().getKind()) {
819 StringRef Name = getLexer().getTok().getIdentifier();
825 getLexer().UnLex(Buf[0]);
830 Operands.
push_back(RISCVOperand::createToken(
"(", FirstS, isRV64()));
834 Operands.
push_back(RISCVOperand::createReg(RegNo, S, E, isRV64()));
839 Operands.
push_back(RISCVOperand::createToken(
")", getLoc(), isRV64()));
850 switch (getLexer().getKind()) {
858 if (getParser().parseExpression(Res))
863 if (getParser().parseIdentifier(Identifier))
865 MCSymbol *Sym = getContext().getOrCreateSymbol(Identifier);
870 return parseOperandWithModifier(Operands);
873 Operands.
push_back(RISCVOperand::createImm(Res, S, E, isRV64()));
878 RISCVAsmParser::parseOperandWithModifier(
OperandVector &Operands) {
883 Error(getLoc(),
"expected '%' for operand modifier");
890 Error(getLoc(),
"expected valid identifier for operand modifier");
896 Error(getLoc(),
"unrecognized operand modifier");
902 Error(getLoc(),
"expected '('");
908 if (getParser().parseParenExpression(SubExpr, E)) {
913 Operands.
push_back(RISCVOperand::createImm(ModExpr, S, E, isRV64()));
920 Error(getLoc(),
"expected '('");
925 Operands.
push_back(RISCVOperand::createToken(
"(", getLoc(), isRV64()));
928 Error(getLoc(),
"expected register");
933 Error(getLoc(),
"expected ')'");
938 Operands.
push_back(RISCVOperand::createToken(
")", getLoc(), isRV64()));
949 bool ForceImmediate) {
963 Error(getLoc(),
"unknown operand");
971 Operands.
push_back(RISCVOperand::createToken(Name, NameLoc, isRV64()));
978 bool ForceImmediate = (Name ==
"call" || Name ==
"tail");
979 if (parseOperand(Operands, ForceImmediate))
988 if (parseOperand(Operands,
false))
993 SMLoc Loc = getLexer().getLoc();
994 getParser().eatToEndOfStatement();
995 return Error(Loc,
"unexpected token");
1002 bool RISCVAsmParser::classifySymbolRef(
const MCExpr *Expr,
1008 if (
const RISCVMCExpr *RE = dyn_cast<RISCVMCExpr>(Expr)) {
1009 Kind = RE->getKind();
1010 Expr = RE->getSubExpr();
1014 if (isa<MCConstantExpr>(Expr) || isa<MCSymbolRefExpr>(Expr))
1021 if (!isa<MCSymbolRefExpr>(BE->
getLHS()))
1030 isa<MCSymbolRefExpr>(BE->
getRHS()))
1047 bool RISCVAsmParser::ParseDirective(
AsmToken DirectiveID) {
1054 if (IDVal ==
".option")
1055 return parseDirectiveOption();
1060 bool RISCVAsmParser::parseDirectiveOption() {
1067 "unexpected token, expected identifier");
1071 if (Option ==
"rvc") {
1072 getTargetStreamer().emitDirectiveOptionRVC();
1077 "unexpected token, expected end of statement");
1079 setFeatureBits(RISCV::FeatureStdExtC,
"c");
1083 if (Option ==
"norvc") {
1084 getTargetStreamer().emitDirectiveOptionNoRVC();
1089 "unexpected token, expected end of statement");
1091 clearFeatureBits(RISCV::FeatureStdExtC,
"c");
1097 "unknown option, expected 'rvc' or 'norvc'");
1104 bool Res = compressInst(CInst, Inst, getSTI(), S.
getContext());
1109 void RISCVAsmParser::emitLoadImm(
unsigned DestReg, int64_t Value,
1122 int64_t Hi20 = ((Value + 0x800) >> 12) & 0xFFFFF;
1123 int64_t Lo12 = SignExtend64<12>(Value);
1124 unsigned SrcReg = RISCV::X0;
1132 if (Lo12 || Hi20 == 0) {
1133 unsigned AddiOpcode =
1134 STI->
hasFeature(RISCV::Feature64Bit) ? RISCV::ADDIW : RISCV::ADDI;
1143 "Target must be 64-bit to support a >32-bit constant");
1168 int64_t Lo12 = SignExtend64<12>(Value);
1169 int64_t Hi52 = (Value + 0x800) >> 12;
1171 Hi52 =
SignExtend64(Hi52 >> (ShiftAmount - 12), 64 - ShiftAmount);
1173 emitLoadImm(DestReg, Hi52, Out);
1178 .addImm(ShiftAmount));
1187 bool RISCVAsmParser::processInstruction(
MCInst &Inst,
SMLoc IDLoc,
1191 if (Inst.
getOpcode() == RISCV::PseudoLI) {
1198 Imm = SignExtend64<32>(Imm);
1199 emitLoadImm(
Reg, Imm, Out);
1203 emitToStreamer(Out, Inst);
static bool isReg(const MCInst &MI, unsigned OpNo)
constexpr bool isUInt< 32 >(uint64_t x)
void push_back(const T &Elt)
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
StringRef getString() const
Get the string for the current token, this includes all characters (for example, the quotes on string...
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
Compute iterated dominance frontiers using a linear time algorithm.
unsigned convertFPR32ToFPR64(unsigned Reg)
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Generic assembler parser interface, for use by target specific assembly parsers.
static MCOperand createExpr(const MCExpr *Val)
MCTargetAsmParser - Generic interface to target specific assembly parsers.
static RoundingMode stringToRoundingMode(StringRef Str)
Target specific streamer interface.
bool isNot(TokenKind K) const
const MCExpr * getLHS() const
Get the left-hand side expression of the binary operator.
virtual const AsmToken & Lex()=0
Get the next AsmToken in the stream, possibly handling file inclusion first.
block Block Frequency true
const AsmToken & getTok() const
Get the current AsmToken from the stream.
virtual void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI, bool PrintSchedInfo=false)
Emit the given Instruction into the current section.
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
MCContext & getContext() const
StringRef getIdentifier() const
Get the identifier string for the current token, which should be an identifier or a string...
static MCOperand createReg(unsigned Reg)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
const FeatureBitset & getFeatureBits() const
static unsigned MatchRegisterAltName(StringRef Name)
Maps from the set of all alternative registernames to a register number.
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.
Target independent representation for an assembler token.
Represent a reference to a symbol from inside an expression.
Target & getTheRISCV32Target()
static bool isMem(const MachineInstr &MI, unsigned Op)
MCParsedAsmOperand - This abstract class represents a source-level assembly instruction operand...
unsigned getReg() const
Returns the register number.
std::pair< StringRef, StringRef > getToken(StringRef Source, StringRef Delimiters=" \\\)
getToken - This function extracts one token from source, ignoring any leading characters that appear ...
RegisterMCAsmParser - Helper template for registering a target specific assembly parser, for use in the target machine initialization function.
const MCExpr * getRHS() const
Get the right-hand side expression of the binary operator.
Instances of this class represent a single low-level machine instruction.
virtual void eatToEndOfStatement()=0
Skip to the end of the current statement, for error recovery.
virtual void addAliasForDirective(StringRef Directive, StringRef Alias)=0
FeatureBitset ToggleFeature(uint64_t FB)
Toggle a feature and return the re-computed feature bits.
const char * getPointer() const
Streaming machine code generation interface.
MCTargetStreamer * getTargetStreamer()
constexpr bool isShiftedInt(int64_t x)
Checks if a signed integer is an N bit number shifted left by S.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Target & getTheRISCV64Target()
Interface to description of machine instruction set.
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
Binary assembler expressions.
T findFirstSet(T Val, ZeroBehavior ZB=ZB_Max)
Get the index of the first set bit starting from the least significant bit.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
MCStreamer & getStreamer()
constexpr bool isInt< 32 >(int64_t x)
void LLVMInitializeRISCVAsmParser()
const MCOperand & getOperand(unsigned i) const
Promote Memory to Register
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
Base class for user error types.
static SMLoc getFromPointer(const char *Ptr)
static VariantKind getVariantKindForName(StringRef name)
bool hasFeature(unsigned Feature) const
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)
constexpr int64_t SignExtend64(uint64_t x)
Sign-extend the number in the bottom B bits of X to a 64-bit integer.
Opcode getOpcode() const
Get the kind of this binary expression.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
static unsigned MatchRegisterName(StringRef Name)
Maps from the set of all register names to a register number.
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
static MCOperand createImm(int64_t Val)
static const RISCVMCExpr * create(const MCExpr *Expr, VariantKind Kind, MCContext &Ctx)