1 //===--- HexagonRDF.cpp ---------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "HexagonRDF.h"
11 #include "HexagonInstrInfo.h"
12 #include "HexagonRegisterInfo.h"
14 #include "llvm/CodeGen/MachineInstr.h"
19 bool HexagonRegisterAliasInfo::covers(RegisterRef RA, RegisterRef RB) const {
23 if (TargetRegisterInfo::isVirtualRegister(RA.Reg) &&
24 TargetRegisterInfo::isVirtualRegister(RB.Reg)) {
25 // Hexagon-specific cases.
26 if (RA.Reg == RB.Reg) {
34 return RegisterAliasInfo::covers(RA, RB);
37 bool HexagonRegisterAliasInfo::covers(const RegisterSet &RRs, RegisterRef RR)
42 if (!TargetRegisterInfo::isPhysicalRegister(RR.Reg)) {
43 assert(TargetRegisterInfo::isVirtualRegister(RR.Reg));
44 // Check if both covering subregisters are present.
45 bool HasLo = RRs.count({RR.Reg, Hexagon::subreg_loreg});
46 bool HasHi = RRs.count({RR.Reg, Hexagon::subreg_hireg});
52 // Check if both covering subregisters are present.
53 unsigned Lo = TRI.getSubReg(RR.Reg, Hexagon::subreg_loreg);
54 unsigned Hi = TRI.getSubReg(RR.Reg, Hexagon::subreg_hireg);
55 if (RRs.count({Lo, 0}) && RRs.count({Hi, 0}))
59 return RegisterAliasInfo::covers(RRs, RR);