aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/CodeGen/MachineCSE.cpp
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-13 23:55:38 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-13 23:55:38 +0800
commitaa69e15c6909c3b162b15f5326f0a72ba9bb7163 (patch)
tree6428eb20e41bad1fc8ad2f5c259bc5537f54554d /backend/lib/CodeGen/MachineCSE.cpp
parentcd30fb546e389d1fb78ce8e579b3dba3a8fdb52a (diff)
downloadrcc-project-aa69e15c6909c3b162b15f5326f0a72ba9bb7163.tar.gz
rcc-project-aa69e15c6909c3b162b15f5326f0a72ba9bb7163.tar.xz
[CodeGen] Unify scalar low-level types
Diffstat (limited to 'backend/lib/CodeGen/MachineCSE.cpp')
-rw-r--r--backend/lib/CodeGen/MachineCSE.cpp23
1 files changed, 3 insertions, 20 deletions
diff --git a/backend/lib/CodeGen/MachineCSE.cpp b/backend/lib/CodeGen/MachineCSE.cpp
index 52a1484..30129bc 100644
--- a/backend/lib/CodeGen/MachineCSE.cpp
+++ b/backend/lib/CodeGen/MachineCSE.cpp
@@ -149,24 +149,7 @@ template <typename ValueT>
return true;
}
-[[nodiscard]] bool hasFloatingRegister(const MachineInstr &Instruction,
- const MachineRegisterInfo &Registers) {
- for (const MachineOperand &Operand : Instruction.operands()) {
- const Register *Reg = Operand.getIf<Register>();
- if (Reg == nullptr || !Reg->isVirtual())
- continue;
- auto Info = Registers.virtualRegisterInfo(*Reg);
- if (Info) {
- const auto &Type = Info->get().Type;
- if (Type && Type->isFloat())
- return true;
- }
- }
- return false;
-}
-
[[nodiscard]] Expected<bool> isCandidate(const MachineInstr &Instruction,
- const MachineFunction &Function,
const TargetDescription &Target) {
const InstructionDescriptor *Descriptor = Target.instructionDescriptor(Instruction.opcode());
if (Descriptor == nullptr) {
@@ -187,8 +170,8 @@ template <typename ValueT>
return false;
if (!Flags.has(InstructionFlag::MayLoad) && !Instruction.memOperands().empty())
return false;
- if (!Instruction.flags().has(MachineInstrFlag::NoFPExcept) &&
- hasFloatingRegister(Instruction, Function.registerInfo())) {
+ if (Flags.has(InstructionFlag::MayRaiseFPException) &&
+ !Instruction.flags().has(MachineInstrFlag::NoFPExcept)) {
return false;
}
@@ -351,7 +334,7 @@ MachineCSEPass::runImplementation(MachineFunction &Function, const TargetDescrip
Block = Block->next()) {
for (MachineInstr *Instruction = Block->firstInstruction(); Instruction != nullptr;) {
MachineInstr *Next = Instruction->next();
- auto Candidate = isCandidate(*Instruction, Function, Target);
+ auto Candidate = isCandidate(*Instruction, Target);
if (!Candidate)
return std::unexpected(Candidate.error());
if (!*Candidate) {