diff options
| author | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-03 19:24:30 +0800 |
|---|---|---|
| committer | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-03 19:24:30 +0800 |
| commit | 432efe39315ed5ad0162f9c08dbf10941bc21dc1 (patch) | |
| tree | 46622290cabfaeb8f4db1729aca6f0725739e08c /backend/include/rcc/CodeGen/TargetRegisterInfo.h | |
| parent | 6580ac1c05bd1cbccd2dcd71fd9c2a384ae3db56 (diff) | |
| download | rcc-project-432efe39315ed5ad0162f9c08dbf10941bc21dc1.tar.gz rcc-project-432efe39315ed5ad0162f9c08dbf10941bc21dc1.tar.xz | |
[CodeGen] Add target MIR text schema
Diffstat (limited to 'backend/include/rcc/CodeGen/TargetRegisterInfo.h')
| -rw-r--r-- | backend/include/rcc/CodeGen/TargetRegisterInfo.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/backend/include/rcc/CodeGen/TargetRegisterInfo.h b/backend/include/rcc/CodeGen/TargetRegisterInfo.h index 5d7de2c..9357eb2 100644 --- a/backend/include/rcc/CodeGen/TargetRegisterInfo.h +++ b/backend/include/rcc/CodeGen/TargetRegisterInfo.h @@ -129,8 +129,18 @@ public: [[nodiscard]] const PhysicalRegisterDesc *physicalRegister(PhysicalRegister Reg) const noexcept; [[nodiscard]] const PhysicalRegisterDesc *physicalRegister(std::string_view Name) const noexcept; [[nodiscard]] const SubRegIndexDesc *subRegIndex(SubRegIndex Index) const noexcept; + [[nodiscard]] const SubRegIndexDesc *subRegIndex(std::string_view Name) const noexcept; [[nodiscard]] const RegisterClassDesc *registerClass(RegisterClassID ID) const noexcept; + [[nodiscard]] const RegisterClassDesc *registerClass(std::string_view Name) const noexcept; [[nodiscard]] const RegisterBankDesc *registerBank(RegisterBankID ID) const noexcept; + [[nodiscard]] const RegisterBankDesc *registerBank(std::string_view Name) const noexcept; + + [[nodiscard]] std::optional<std::string_view> + physicalRegisterMIRName(PhysicalRegister Reg) const noexcept; + [[nodiscard]] std::optional<std::string_view> + registerClassMIRName(RegisterClassID ID) const noexcept; + [[nodiscard]] std::optional<std::string_view> + registerBankMIRName(RegisterBankID ID) const noexcept; [[nodiscard]] bool isKnownPhysicalRegister(PhysicalRegister Reg) const noexcept { return physicalRegister(Reg) != nullptr; @@ -177,14 +187,20 @@ private: std::unordered_map<PhysicalRegister, std::size_t> RegisterToIndex; std::unordered_map<std::string, std::size_t> RegisterNameToIndex; std::unordered_map<SubRegIndex, std::size_t> SubRegIndexToIndex; + std::unordered_map<std::string, std::size_t> SubRegNameToIndex; std::unordered_map<RegisterClassID, std::size_t> ClassToIndex; + std::unordered_map<std::string, std::size_t> ClassNameToIndex; std::unordered_map<RegisterBankID, std::size_t> BankToIndex; + std::unordered_map<std::string, std::size_t> BankNameToIndex; std::unordered_map<std::uint64_t, PhysicalRegister> SubRegisterMap; std::unordered_map<std::uint64_t, SubRegIndex> CompositionMap; std::unordered_map<std::uint64_t, RegisterClassID> SubRegClassMap; std::unordered_set<std::uint64_t> SubclassRelations; std::vector<std::vector<PhysicalRegister>> Aliases; std::vector<std::vector<PhysicalRegister>> SuperRegisters; + std::vector<std::string> RegisterMIRNames; + std::vector<std::string> ClassMIRNames; + std::vector<std::string> BankMIRNames; }; } // namespace rcc |
