diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-07-26 19:36:28 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-07-26 19:36:28 +0000 |
commit | cfca06d7963fa0909f90483b42a6d7d194d01e08 (patch) | |
tree | 209fb2a2d68f8f277793fc8df46c753d31bc853b /llvm/lib/Target/Mips/MipsRegisterBankInfo.h | |
parent | 706b4fc47bbc608932d3b491ae19a3b9cde9497b (diff) |
Notes
Diffstat (limited to 'llvm/lib/Target/Mips/MipsRegisterBankInfo.h')
-rw-r--r-- | llvm/lib/Target/Mips/MipsRegisterBankInfo.h | 60 |
1 files changed, 57 insertions, 3 deletions
diff --git a/llvm/lib/Target/Mips/MipsRegisterBankInfo.h b/llvm/lib/Target/Mips/MipsRegisterBankInfo.h index 66267f8d794de..55eeaf096b143 100644 --- a/llvm/lib/Target/Mips/MipsRegisterBankInfo.h +++ b/llvm/lib/Target/Mips/MipsRegisterBankInfo.h @@ -66,9 +66,55 @@ private: /// Represents moving 'bags of bits' around. Select same bank for entire /// chain to avoid cross bank copies. Currently we select fprb for s64 and /// gprb for s32 Ambiguous operands. - Ambiguous + Ambiguous, + /// Only used for s64. Unlike Ambiguous s64, AmbiguousWithMergeOrUnmerge s64 + /// is mapped to gprb (legalized using narrow scalar to s32). + AmbiguousWithMergeOrUnmerge }; + bool isAmbiguous_64(InstType InstTy, unsigned OpSize) const { + if (InstTy == InstType::Ambiguous && OpSize == 64) + return true; + return false; + } + + bool isAmbiguous_32(InstType InstTy, unsigned OpSize) const { + if (InstTy == InstType::Ambiguous && OpSize == 32) + return true; + return false; + } + + bool isAmbiguous_32or64(InstType InstTy, unsigned OpSize) const { + if (InstTy == InstType::Ambiguous && (OpSize == 32 || OpSize == 64)) + return true; + return false; + } + + bool isAmbiguousWithMergeOrUnmerge_64(InstType InstTy, + unsigned OpSize) const { + if (InstTy == InstType::AmbiguousWithMergeOrUnmerge && OpSize == 64) + return true; + return false; + } + + bool isFloatingPoint_32or64(InstType InstTy, unsigned OpSize) const { + if (InstTy == InstType::FloatingPoint && (OpSize == 32 || OpSize == 64)) + return true; + return false; + } + + bool isFloatingPoint_64(InstType InstTy, unsigned OpSize) const { + if (InstTy == InstType::FloatingPoint && OpSize == 64) + return true; + return false; + } + + bool isInteger_32(InstType InstTy, unsigned OpSize) const { + if (InstTy == InstType::Integer && OpSize == 32) + return true; + return false; + } + /// Some generic instructions have operands that can be mapped to either fprb /// or gprb e.g. for G_LOAD we consider only operand 0 as ambiguous, operand 1 /// is always gprb since it is a pointer. @@ -113,12 +159,13 @@ private: DenseMap<const MachineInstr *, InstType> Types; /// Recursively visit MI's adjacent instructions and find MI's InstType. - bool visit(const MachineInstr *MI, const MachineInstr *WaitingForTypeOfMI); + bool visit(const MachineInstr *MI, const MachineInstr *WaitingForTypeOfMI, + InstType &AmbiguousTy); /// Visit MI's adjacent UseDefs or DefUses. bool visitAdjacentInstrs(const MachineInstr *MI, SmallVectorImpl<MachineInstr *> &AdjacentInstrs, - bool isDefUse); + bool isDefUse, InstType &AmbiguousTy); /// Set type for MI, and recursively for all instructions that are /// waiting for MI's type. @@ -170,6 +217,13 @@ private: InstType determineInstType(const MachineInstr *MI); void cleanupIfNewFunction(llvm::StringRef FunctionName); + + /// MI is about to get destroyed (using narrow scalar). Internal data is + /// saved based on MI's address, clear it since it is no longer valid. + void clearTypeInfoData(const MachineInstr *MI) { + Types.erase(MI); + WaitingQueues.erase(MI); + }; }; }; } // end namespace llvm |