LLVM 24.0.0git
RISCVBaseInfo.h
Go to the documentation of this file.
1//===-- RISCVBaseInfo.h - Top level definitions for RISC-V MC ---*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file contains small standalone enum definitions for the RISC-V target
10// useful for the compiler back-end and the MC libraries.
11//
12//===----------------------------------------------------------------------===//
13#ifndef LLVM_LIB_TARGET_RISCV_MCTARGETDESC_RISCVBASEINFO_H
14#define LLVM_LIB_TARGET_RISCV_MCTARGETDESC_RISCVBASEINFO_H
15
17#include "llvm/ADT/APFloat.h"
18#include "llvm/ADT/APInt.h"
19#include "llvm/ADT/StringRef.h"
22#include "llvm/MC/MCInstrDesc.h"
24#include "llvm/Support/Error.h"
28
29namespace llvm {
30
31class MCSubtargetInfo;
32
33namespace RISCVOp {
34enum OperandType : unsigned {
107 // Operand is a 3-bit rounding mode, '111' indicates FRM register.
108 // Represents 'frm' argument passing to floating-point operations.
110 // Operand is a 3-bit rounding mode where only RTZ is valid.
112 // Condition code used by select and short forward branch pseudos.
114 // Ordering for atomic pseudos.
116 // Vector policy operand.
118 // Vector SEW operand. Stores in log2(SEW).
120 // Special SEW for mask only instructions. Always 0.
122 // Vector rounding mode for VXRM or FRM.
124 // Vtype operand for XSfmm extension.
126 // XSfmm twiden operand.
129
132
133 // Simm12 or constant pool, global, basicblock, etc.
135
137
138 // Operand is either a register or uimm5, this is used by V extension pseudo
139 // instructions to represent a value that be passed as AVL to either vsetvli
140 // or vsetivli.
142
143 // Operand is either a register or imm, this is used by short forward branch
144 // (SFB) pseudos to enable SFB with branches on reg-reg and reg-imm compares.
146
147 // Operand is a branch opcode, this too is used by SFB pseudos.
149
153};
154} // namespace RISCVOp
155
156// RISCVII - This namespace holds all of the target specific flags that
157// instruction info tracks. All definitions must match RISCVInstrFormats.td.
158namespace RISCVII {
159enum : uint64_t {
189
192
198
201
202 // Is this a _TIED vector pseudo instruction. For these instructions we
203 // shouldn't skip the tied operand when converting to MC instructions.
206
207 // Does this instruction have a SEW operand. It will be the last explicit
208 // operand unless there is a vector policy operand. Used by RVV Pseudos.
211
212 // Does this instruction have a VL operand. It will be the second to last
213 // explicit operand unless there is a vector policy operand. Used by RVV
214 // Pseudos.
217
218 // Does this instruction have a vector policy operand. It will be the last
219 // explicit operand. Used by RVV Pseudos.
222
223 // Is this instruction a vector widening reduction instruction. Used by RVV
224 // Pseudos.
227
228 // Does this instruction care about mask policy. If it is not, the mask policy
229 // could be either agnostic or undisturbed. For example, unmasked, store, and
230 // reduction operations result would not be affected by mask policy, so
231 // compiler has free to select either one.
234
235 // Indicates that the result can be considered sign extended from bit 31. Some
236 // instructions with this flag aren't W instructions, but are either sign
237 // extended from a smaller size, always outputs a small integer, or put zeros
238 // in bits 63:31. Used by the SExtWRemoval pass.
241
244
247
248 // Indicates whether these instructions can partially overlap between source
249 // registers and destination registers according to the vector spec.
250 // 0 -> not a vector pseudo
251 // 1 -> default value for vector pseudos. not widening or narrowing.
252 // 2 -> narrowing case
253 // 3 -> widening case
256
259
262
263 // Indicates the EEW of a vector instruction's destination operand.
264 // 0 -> 1
265 // 1 -> SEW
266 // 2 -> SEW * 2
267 // 3 -> SEW * 4
270
273
274 // 0 -> Don't care about altfmt bit in VTYPE.
275 // 1 -> Is not altfmt.
276 // 2 -> Is altfmt(BF16).
279
280 // XSfmmbase
283
286
289
292};
293
294// Helper functions to read TSFlags.
295/// \returns the format of the instruction.
296static inline unsigned getFormat(uint64_t TSFlags) {
297 return (TSFlags & InstFormatMask) >> InstFormatShift;
298}
299/// \returns the LMUL for the instruction.
300static inline RISCVVType::VLMUL getLMul(uint64_t TSFlags) {
301 return static_cast<RISCVVType::VLMUL>((TSFlags & VLMulMask) >> VLMulShift);
302}
303/// \returns true if this a _TIED pseudo.
304static inline bool isTiedPseudo(uint64_t TSFlags) {
305 return TSFlags & IsTiedPseudoMask;
306}
307/// \returns true if there is a SEW operand for the instruction.
308static inline bool hasSEWOp(uint64_t TSFlags) {
309 return TSFlags & HasSEWOpMask;
310}
311/// \returns true if there is a VL operand for the instruction.
312static inline bool hasVLOp(uint64_t TSFlags) {
313 return TSFlags & HasVLOpMask;
314}
315/// \returns true if there is a vector policy operand for this instruction.
316static inline bool hasVecPolicyOp(uint64_t TSFlags) {
317 return TSFlags & HasVecPolicyOpMask;
318}
319/// \returns true if it is a vector widening reduction instruction.
320static inline bool isRVVWideningReduction(uint64_t TSFlags) {
321 return TSFlags & IsRVVWideningReductionMask;
322}
323/// \returns true if mask policy is valid for the instruction.
324static inline bool usesMaskPolicy(uint64_t TSFlags) {
325 return TSFlags & UsesMaskPolicyMask;
326}
327
328/// \returns true if there is a rounding mode operand for this instruction
329static inline bool hasRoundModeOp(uint64_t TSFlags) {
330 return TSFlags & HasRoundModeOpMask;
331}
332
334static inline AltFmtType getAltFmtType(uint64_t TSFlags) {
335 return static_cast<AltFmtType>((TSFlags & AltFmtTypeMask) >> AltFmtTypeShift);
336}
337
338/// \returns true if this instruction uses vxrm
339static inline bool usesVXRM(uint64_t TSFlags) { return TSFlags & UsesVXRMMask; }
340
341/// \returns true if the elements in the body are affected by VL,
342/// e.g. vslide1down.vx/vredsum.vs/viota.m
343static inline bool elementsDependOnVL(uint64_t TSFlags) {
344 return TSFlags & ElementsDependOnVLMask;
345}
346
347/// \returns true if the elements in the body are affected by the mask,
348/// e.g. vredsum.vs/viota.m
349static inline bool elementsDependOnMask(uint64_t TSFlags) {
350 return TSFlags & ElementsDependOnMaskMask;
351}
352
353/// \returns true if the instruction may read elements past VL, e.g.
354/// vslidedown/vrgather
355static inline bool readsPastVL(uint64_t TSFlags) {
356 return TSFlags & ReadsPastVLMask;
357}
358
359// XSfmmbase
360static inline bool hasTWidenOp(uint64_t TSFlags) {
361 return TSFlags & HasTWidenOpMask;
362}
363
364static inline bool hasTMOp(uint64_t TSFlags) { return TSFlags & HasTMOpMask; }
365
366static inline bool hasTKOp(uint64_t TSFlags) { return TSFlags & HasTKOpMask; }
367
368static inline unsigned getTWidenOpNum(const MCInstrDesc &Desc) {
369 assert(hasTWidenOp(Desc.TSFlags));
370 return Desc.getNumOperands() - 1;
371}
372
373static inline unsigned getTNOpNum(const MCInstrDesc &Desc) {
374 const uint64_t TSFlags = Desc.TSFlags;
375 assert(hasTWidenOp(TSFlags) && hasVLOp(TSFlags));
376 unsigned Offset = 3;
377 if (hasTKOp(TSFlags))
378 Offset = 4;
379 return Desc.getNumOperands() - Offset;
380}
381
382static inline unsigned getTMOpNum(const MCInstrDesc &Desc) {
383 const uint64_t TSFlags = Desc.TSFlags;
384 assert(hasTWidenOp(TSFlags) && hasTMOp(TSFlags));
385 if (hasTKOp(TSFlags))
386 return Desc.getNumOperands() - 5;
387 // vtzero.t
388 return Desc.getNumOperands() - 4;
389}
390
391static inline unsigned getTKOpNum(const MCInstrDesc &Desc) {
392 [[maybe_unused]] const uint64_t TSFlags = Desc.TSFlags;
393 assert(hasTWidenOp(TSFlags) && hasTKOp(TSFlags));
394 return Desc.getNumOperands() - 3;
395}
396
397static inline unsigned getVLOpNum(const MCInstrDesc &Desc) {
398 const uint64_t TSFlags = Desc.TSFlags;
399 // This method is only called if we expect to have a VL operand, and all
400 // instructions with VL also have SEW.
401 assert(hasSEWOp(TSFlags) && hasVLOp(TSFlags));
402 // In Xsfmmbase, TN is an alias for VL, so here we use the same TSFlags bit.
403 if (hasTWidenOp(TSFlags))
404 return getTNOpNum(Desc);
405 unsigned Offset = 2;
406 if (hasVecPolicyOp(TSFlags))
407 Offset = 3;
408 return Desc.getNumOperands() - Offset;
409}
410
411static inline MCRegister
413 // For Zicfilp, PseudoTAIL should be expanded to a software guarded branch.
414 // It means to use t2(x7) as rs1 of JALR to expand PseudoTAIL.
415 return FeatureBits[RISCV::FeatureStdExtZicfilp] ? RISCV::X7 : RISCV::X6;
416}
417
418static inline unsigned getSEWOpNum(const MCInstrDesc &Desc) {
419 const uint64_t TSFlags = Desc.TSFlags;
420 assert(hasSEWOp(TSFlags));
421 unsigned Offset = 1;
422 if (hasVecPolicyOp(TSFlags) || hasTWidenOp(TSFlags))
423 Offset = 2;
424 return Desc.getNumOperands() - Offset;
425}
426
427static inline unsigned getVecPolicyOpNum(const MCInstrDesc &Desc) {
428 assert(hasVecPolicyOp(Desc.TSFlags));
429 return Desc.getNumOperands() - 1;
430}
431
432/// \returns the index to the rounding mode immediate value if any, otherwise
433/// returns -1.
434static inline int getFRMOpNum(const MCInstrDesc &Desc) {
435 const uint64_t TSFlags = Desc.TSFlags;
436 if (!hasRoundModeOp(TSFlags) || usesVXRM(TSFlags))
437 return -1;
438
439 int Idx = RISCV::getNamedOperandIdx(Desc.getOpcode(), RISCV::OpName::rm);
440 assert(Idx >= 0 && "No rm operand?");
441 assert(Desc.operands()[Idx].OperandType == RISCVOp::OPERAND_VEC_RM &&
442 "Operand has wrong type");
443
444 return Idx;
445}
446
447/// \returns the index to the rounding mode immediate value if any, otherwise
448/// returns -1.
449static inline int getVXRMOpNum(const MCInstrDesc &Desc) {
450 const uint64_t TSFlags = Desc.TSFlags;
451 if (!hasRoundModeOp(TSFlags) || !usesVXRM(TSFlags))
452 return -1;
453
454 int Idx = RISCV::getNamedOperandIdx(Desc.getOpcode(), RISCV::OpName::rm);
455 assert(Idx >= 0 && "No rm operand?");
456 assert(Desc.operands()[Idx].OperandType == RISCVOp::OPERAND_VEC_RM &&
457 "Operand has wrong type");
458
459 return Idx;
460}
461
462// Is the first def operand tied to the first use operand. This is true for
463// vector pseudo instructions that have a merge operand for tail/mask
464// undisturbed. It's also true for vector FMA instructions where one of the
465// operands is also the destination register.
466static inline bool isFirstDefTiedToFirstUse(const MCInstrDesc &Desc) {
467 return Desc.getNumDefs() < Desc.getNumOperands() &&
468 Desc.getOperandConstraint(Desc.getNumDefs(), MCOI::TIED_TO) == 0;
469}
470
471// RISC-V Specific Machine Operand Flags
472enum {
475 MO_LO = 3,
476 MO_HI = 4,
490
491 // Used to differentiate between target-specific "direct" flags and "bitmask"
492 // flags. A machine operand can only have one "direct" flag, but can have
493 // multiple "bitmask" flags.
495};
496} // namespace RISCVII
497
498// Describes the predecessor/successor bits used in the FENCE instruction.
501 I = 8,
502 O = 4,
503 R = 2,
504 W = 1
505};
506}
507
508// Describes the supported floating point rounding mode encodings.
509namespace RISCVFPRndMode {
511 RNE = 0,
512 RTZ = 1,
513 RDN = 2,
514 RUP = 3,
515 RMM = 4,
516 DYN = 7,
518};
519
521 switch (RndMode) {
522 default:
523 llvm_unreachable("Unknown floating point rounding mode");
525 return "rne";
527 return "rtz";
529 return "rdn";
531 return "rup";
533 return "rmm";
535 return "dyn";
536 }
537}
538
549
550inline static bool isValidRoundingMode(unsigned Mode) {
551 switch (Mode) {
552 default:
553 return false;
560 return true;
561 }
562}
563} // namespace RISCVFPRndMode
564
565namespace XSMTVTypeMode {
567 // Define the different SMT VType modes here
571};
572
574 switch (TypeMode) {
575 default:
576 llvm_unreachable("Unknown VType mode of SpacemiT Integer Matrix");
578 return "i4";
580 return "i8";
581 }
582}
583
590
591inline static bool isValidSMTVTypeMode(unsigned Mode) {
592 switch (Mode) {
593 default:
594 return false;
597 return true;
598 }
599}
600
601} // namespace XSMTVTypeMode
602
603namespace RISCVVXRndMode {
605 RNU = 0,
606 RNE = 1,
607 RDN = 2,
608 ROD = 3,
610};
611
613 switch (RndMode) {
614 default:
615 llvm_unreachable("Unknown vector fixed-point rounding mode");
617 return "rnu";
619 return "rne";
621 return "rdn";
623 return "rod";
624 }
625}
626
635
636inline static bool isValidRoundingMode(unsigned Mode) {
637 switch (Mode) {
638 default:
639 return false;
644 return true;
645 }
646}
647} // namespace RISCVVXRndMode
648
651 NX = 0x01, // Inexact
652 UF = 0x02, // Underflow
653 OF = 0x04, // Overflow
654 DZ = 0x08, // Divide by zero
655 NV = 0x10, // Invalid operation
656 ALL = 0x1F // Mask for all accrued exception flags
657};
658}
659
660//===----------------------------------------------------------------------===//
661// Floating-point Immediates
662//
663
664namespace RISCVLoadFPImm {
665float getFPImm(unsigned Imm);
666
667/// getLoadFPImm - Return a 5-bit binary encoding of the floating-point
668/// immediate value. If the value cannot be represented as a 5-bit binary
669/// encoding, then return -1.
670int getLoadFPImm(APFloat FPImm);
671} // namespace RISCVLoadFPImm
672
673namespace RISCVSysReg {
674struct SysReg {
676 unsigned Encoding;
677 // FIXME: add these additional fields when needed.
678 // Privilege Access: Read, Write, Read-Only.
679 // unsigned ReadWrite;
680 // Privilege Mode: User, System or Machine.
681 // unsigned Mode;
682 // Check field name.
683 // unsigned Extra;
684 // Register number without the privilege bits.
685 // unsigned Number;
690
691 bool haveRequiredFeatures(const FeatureBitset &ActiveFeatures) const {
692 // Not in 32-bit mode.
693 if (IsRV32Only && ActiveFeatures[RISCV::Feature64Bit])
694 return false;
695 // No required feature associated with the system register.
696 if (FeaturesRequired.none())
697 return true;
698 return (FeaturesRequired & ActiveFeatures) == FeaturesRequired;
699 }
700};
701
702#define GET_SysRegEncodings_DECL
703#define GET_SysRegsList_DECL
704#include "RISCVGenSearchableTables.inc"
705} // end namespace RISCVSysReg
706
707namespace RISCVInsnOpcode {
712
713#define GET_RISCVOpcodesList_DECL
714#include "RISCVGenSearchableTables.inc"
715} // end namespace RISCVInsnOpcode
716
717namespace RISCVABI {
718
738
739// Returns true for the ABIs that pass all floating point values in integer
740// registers.
741inline bool isSoftFP(ABI TargetABI) {
742 switch (TargetABI) {
743 case ABI::ILP32:
744 case ABI::ILP32E:
745 case ABI::IL32PC64:
746 case ABI::IL32PC64E:
747 case ABI::LP64:
748 case ABI::LP64E:
749 case ABI::L64PC128:
750 case ABI::CHERIOT:
751 return true;
752 default:
753 return false;
754 }
755}
756
757// Returns true for the ABIs that pass half, bfloat, or single precision
758// floating point values in FP registers. Double and quad precision FP values
759// are passed in integer registers.
760inline bool isSingleFP(ABI TargetABI) {
761 switch (TargetABI) {
762 case ABI::ILP32F:
763 case ABI::IL32PC64F:
764 case ABI::LP64F:
765 case ABI::L64PC128F:
766 return true;
767 default:
768 return false;
769 }
770}
771
772// Returns true for the ABIs that pass half, bfloat, single, or double precision
773// floating point values in FP registers. Quad precision FP values are passed
774// in integer registers.
775inline bool isDoubleFP(ABI TargetABI) {
776 switch (TargetABI) {
777 case ABI::ILP32D:
778 case ABI::IL32PC64D:
779 case ABI::LP64D:
780 case ABI::L64PC128D:
781 return true;
782 default:
783 return false;
784 }
785}
786
787// Returns true for the ABIs that only use the reduced 16 register integer file.
788inline bool isRVE(ABI TargetABI) {
789 switch (TargetABI) {
790 case ABI::ILP32E:
791 case ABI::IL32PC64E:
792 case ABI::LP64E:
793 case ABI::CHERIOT:
794 return true;
795 default:
796 return false;
797 }
798}
799
800// Returns true for the ABIs in which pointers are capabilities.
801inline bool isPurecap(ABI TargetABI) {
802 switch (TargetABI) {
803 case ABI::IL32PC64:
804 case ABI::IL32PC64F:
805 case ABI::IL32PC64D:
806 case ABI::IL32PC64E:
807 case ABI::L64PC128:
808 case ABI::L64PC128F:
809 case ABI::L64PC128D:
810 case ABI::CHERIOT:
811 return true;
812 default:
813 return false;
814 }
815}
816
817// Returns the stack alignment required by the ABI.
818inline Align getStackAlignment(ABI TargetABI) {
819 switch (TargetABI) {
820 case ABI::ILP32E:
821 return Align(4);
822 case ABI::LP64E:
823 return Align(8);
824 case ABI::ILP32:
825 case ABI::ILP32F:
826 case ABI::ILP32D:
827 case ABI::IL32PC64:
828 case ABI::IL32PC64F:
829 case ABI::IL32PC64D:
830 case ABI::IL32PC64E:
831 case ABI::LP64:
832 case ABI::LP64F:
833 case ABI::LP64D:
834 case ABI::L64PC128:
835 case ABI::L64PC128F:
836 case ABI::L64PC128D:
837 case ABI::CHERIOT:
838 return Align(16);
839 case ABI::Unknown:
840 llvm_unreachable("Unknown ABI has no stack alignment");
841 }
842 llvm_unreachable("Unhandled ABI");
843}
844
845// Returns the target ABI, or else a StringError if the requested ABIName is
846// not supported for the subtarget's triple and FeatureBits combination.
848
849ABI getTargetABI(StringRef ABIName);
850
851// Returns the register used to hold the stack pointer after realignment.
853
854// Returns the register holding shadow call stack pointer.
856
857} // namespace RISCVABI
858
859namespace RISCVFeatures {
860
861// Validates if the given combination of features are valid for the target
862// triple. Exits with report_fatal_error if not.
863void validate(const Triple &TT, const FeatureBitset &FeatureBits);
864
866parseFeatureBits(const MCSubtargetInfo &STI);
867
868} // namespace RISCVFeatures
869
870namespace RISCVRVC {
871bool compress(MCInst &OutInst, const MCInst &MI, const MCSubtargetInfo &STI);
872bool uncompress(MCInst &OutInst, const MCInst &MI, const MCSubtargetInfo &STI);
873} // namespace RISCVRVC
874
875namespace RISCVZC {
892
893inline unsigned encodeRegList(MCRegister EndReg, bool IsRVE = false) {
894 assert((!IsRVE || EndReg <= RISCV::X9) && "Invalid Rlist for RV32E");
895 switch (EndReg.id()) {
896 case RISCV::X1:
897 return RLISTENCODE::RA;
898 case RISCV::X8:
899 return RLISTENCODE::RA_S0;
900 case RISCV::X9:
902 case RISCV::X18:
904 case RISCV::X19:
906 case RISCV::X20:
908 case RISCV::X21:
910 case RISCV::X22:
912 case RISCV::X23:
914 case RISCV::X24:
916 case RISCV::X25:
918 case RISCV::X27:
920 default:
921 llvm_unreachable("Undefined input.");
922 }
923}
924
925inline static unsigned encodeRegListNumRegs(unsigned NumRegs) {
926 assert(NumRegs > 0 && NumRegs < 14 && NumRegs != 12 &&
927 "Unexpected number of registers");
928 if (NumRegs == 13)
930
931 return RLISTENCODE::RA + (NumRegs - 1);
932}
933
934inline static unsigned getStackAdjBase(unsigned RlistVal, bool IsRV64) {
935 assert(RlistVal >= RLISTENCODE::RA && RlistVal <= RLISTENCODE::RA_S0_S11 &&
936 "Invalid Rlist");
937 unsigned NumRegs = (RlistVal - RLISTENCODE::RA) + 1;
938 // s10 and s11 are saved together.
939 if (RlistVal == RLISTENCODE::RA_S0_S11)
940 ++NumRegs;
941
942 unsigned RegSize = IsRV64 ? 8 : 4;
943 return alignTo(NumRegs * RegSize, 16);
944}
945
946void printRegList(unsigned RlistEncode, raw_ostream &OS);
947} // namespace RISCVZC
948
949namespace RISCVVInversePseudosTable {
957
958#define GET_RISCVVInversePseudosTable_DECL
959#include "RISCVGenSearchableTables.inc"
960
961inline const PseudoInfo *getBaseInfo(unsigned BaseInstr, uint8_t VLMul,
962 uint8_t SEW, bool IsAltFmt = false) {
963 return getBaseInfoImpl(BaseInstr, VLMul, SEW, IsAltFmt);
964}
965} // namespace RISCVVInversePseudosTable
966
967namespace RISCV {
977
987
996
1006
1015
1023
1032
1040
1041#define GET_RISCVVSSEGTable_DECL
1042#define GET_RISCVVLSEGTable_DECL
1043#define GET_RISCVVLXSEGTable_DECL
1044#define GET_RISCVVSXSEGTable_DECL
1045#define GET_RISCVVLETable_DECL
1046#define GET_RISCVVSETable_DECL
1047#define GET_RISCVVLXTable_DECL
1048#define GET_RISCVVSXTable_DECL
1049#define GET_RISCVNDSVLNTable_DECL
1050#include "RISCVGenSearchableTables.inc"
1051
1052inline bool isValidYBNDSWImm(int64_t Imm) {
1053 return (Imm >= 1 && Imm <= 255) ||
1054 (Imm >= 256 && Imm <= 504 && (Imm % 8) == 0) ||
1055 (Imm >= 512 && Imm <= 4096 && (Imm % 16) == 0);
1056}
1057} // namespace RISCV
1058
1059} // namespace llvm
1060
1061#endif
unsigned RegSize
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
uint64_t uint64_t
uint64_t Imm
This file declares a class to represent arbitrary precision floating point values and provide a varie...
This file implements a class to represent arbitrary precision integral constant values and operations...
IRTranslator LLVM IR MI
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
Tagged union holding either a T or a Error.
Definition Error.h:485
Container class for subtarget features.
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:187
Describe properties that are true of each instruction in the target description file.
Wrapper class representing physical registers and target specific virtual registers.
Definition MCRegister.h:42
constexpr unsigned id() const
Definition MCRegister.h:85
Generic base class for all target subtargets.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ OPERAND_FIRST_TARGET
Definition MCInstrDesc.h:81
bool isRVE(ABI TargetABI)
ABI getTargetABI(StringRef ABIName)
MCRegister getBPReg()
bool isSingleFP(ABI TargetABI)
bool isDoubleFP(ABI TargetABI)
MCRegister getSCSPReg()
bool isPurecap(ABI TargetABI)
Expected< ABI > computeTargetABI(const MCSubtargetInfo &STI, StringRef ABIName)
Align getStackAlignment(ABI TargetABI)
bool isSoftFP(ABI TargetABI)
static bool isValidRoundingMode(unsigned Mode)
static RoundingMode stringToRoundingMode(StringRef Str)
static StringRef roundingModeToString(RoundingMode RndMode)
void validate(const Triple &TT, const FeatureBitset &FeatureBits)
llvm::Expected< std::unique_ptr< RISCVISAInfo > > parseFeatureBits(const MCSubtargetInfo &STI)
static unsigned getVecPolicyOpNum(const MCInstrDesc &Desc)
static unsigned getTMOpNum(const MCInstrDesc &Desc)
static bool usesMaskPolicy(uint64_t TSFlags)
static bool hasRoundModeOp(uint64_t TSFlags)
static bool readsPastVL(uint64_t TSFlags)
static bool hasTWidenOp(uint64_t TSFlags)
static bool isTiedPseudo(uint64_t TSFlags)
static RISCVVType::VLMUL getLMul(uint64_t TSFlags)
static unsigned getTKOpNum(const MCInstrDesc &Desc)
static unsigned getVLOpNum(const MCInstrDesc &Desc)
static AltFmtType getAltFmtType(uint64_t TSFlags)
static unsigned getFormat(uint64_t TSFlags)
static unsigned getTWidenOpNum(const MCInstrDesc &Desc)
static bool hasTKOp(uint64_t TSFlags)
static bool hasVLOp(uint64_t TSFlags)
@ TargetOverlapConstraintTypeMask
@ TargetOverlapConstraintTypeShift
static MCRegister getTailExpandUseRegNo(const FeatureBitset &FeatureBits)
static bool elementsDependOnMask(uint64_t TSFlags)
static int getFRMOpNum(const MCInstrDesc &Desc)
static bool hasTMOp(uint64_t TSFlags)
static int getVXRMOpNum(const MCInstrDesc &Desc)
static unsigned getTNOpNum(const MCInstrDesc &Desc)
static bool hasVecPolicyOp(uint64_t TSFlags)
static bool usesVXRM(uint64_t TSFlags)
static bool isRVVWideningReduction(uint64_t TSFlags)
static unsigned getSEWOpNum(const MCInstrDesc &Desc)
static bool elementsDependOnVL(uint64_t TSFlags)
static bool hasSEWOp(uint64_t TSFlags)
static bool isFirstDefTiedToFirstUse(const MCInstrDesc &Desc)
int getLoadFPImm(APFloat FPImm)
getLoadFPImm - Return a 5-bit binary encoding of the floating-point immediate value.
float getFPImm(unsigned Imm)
@ OPERAND_UIMMLOG2XLEN_NONZERO
@ OPERAND_UIMM10_LSB00_NONZERO
@ OPERAND_SIMM10_LSB0000_NONZERO
bool uncompress(MCInst &OutInst, const MCInst &MI, const MCSubtargetInfo &STI)
bool compress(MCInst &OutInst, const MCInst &MI, const MCSubtargetInfo &STI)
const PseudoInfo * getBaseInfo(unsigned BaseInstr, uint8_t VLMul, uint8_t SEW, bool IsAltFmt=false)
static bool isValidRoundingMode(unsigned Mode)
static RoundingMode stringToRoundingMode(StringRef Str)
static StringRef roundingModeToString(RoundingMode RndMode)
unsigned encodeRegList(MCRegister EndReg, bool IsRVE=false)
static unsigned getStackAdjBase(unsigned RlistVal, bool IsRV64)
void printRegList(unsigned RlistEncode, raw_ostream &OS)
static unsigned encodeRegListNumRegs(unsigned NumRegs)
bool isValidYBNDSWImm(int64_t Imm)
static StringRef SMTVTypeModeToString(SMTVTypeMode TypeMode)
static SMTVTypeMode stringToSMTVTypeMode(StringRef Str)
static bool isValidSMTVTypeMode(unsigned Mode)
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:577
Op::Description Desc
constexpr uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Definition Alignment.h:149
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39
bool haveRequiredFeatures(const FeatureBitset &ActiveFeatures) const
StringTable::Offset Name