LLVM: lib/CodeGen/LiveRegUnits.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

19

20using namespace llvm;

21

23 for (MCRegUnit U : TRI->regunits()) {

26 Units.reset(static_cast<unsigned>(U));

27 break;

28 }

29 }

30 }

31}

32

34 for (MCRegUnit U : TRI->regunits()) {

37 Units.set(static_cast<unsigned>(U));

38 break;

39 }

40 }

41 }

42}

43

45

47 if (MOP.isReg()) {

48 if (MOP.isDef() && MOP.getReg().isPhysical())

50 continue;

51 }

52

53 if (MOP.isRegMask()) {

55 continue;

56 }

57 }

58

59

61 if (!MOP.isReg() || !MOP.readsReg())

62 continue;

63

64 if (MOP.getReg().isPhysical())

66 }

67}

68

70

72 if (MOP.isReg()) {

73 if (!MOP.getReg().isPhysical())

74 continue;

75 if (MOP.isDef() || MOP.readsReg())

77 continue;

78 }

79

80 if (MOP.isRegMask()) {

82 continue;

83 }

84 }

85}

86

87

90 for (const auto &LI : MBB.liveins())

91 LiveUnits.addRegMasked(LI.PhysReg, LI.LaneMask);

92}

93

94

97 for (const auto &LO : MBB.liveouts())

98 LiveUnits.addRegMasked(LO.PhysReg, LO.LaneMask);

99}

100

101

106 for (const MCPhysReg *CSR = MRI.getCalleeSavedRegs(); CSR && *CSR; ++CSR) {

107 const unsigned N = *CSR;

108

112

113 if (Info == CSI.end() || Info->isRestored())

115 }

116}

117

118void LiveRegUnits::addPristines(const MachineFunction &MF) {

119 const MachineFrameInfo &MFI = MF.getFrameInfo();

121 return;

122

123

125

126

128

131 return;

132 }

133

134

135

136

139

141 Pristine.removeReg(Info.getReg());

142 addUnits(Pristine.getBitVector());

143}

144

147 addPristines(MF);

149

150

151 if (MBB.isReturnBlock()) {

155 }

156}

157

160 addPristines(MF);

162}

unsigned const MachineRegisterInfo * MRI

Analysis containing CSE Info

static void addCalleeSavedRegs(LivePhysRegs &LiveRegs, const MachineFunction &MF)

Adds all callee saved registers to LiveRegs.

static void addBlockLiveOuts(LiveRegUnits &LiveUnits, const MachineBasicBlock &MBB)

Add live-out registers of basic block MBB to LiveUnits.

Definition LiveRegUnits.cpp:95

static void addBlockLiveIns(LiveRegUnits &LiveUnits, const MachineBasicBlock &MBB)

Add live-in registers of basic block MBB to LiveUnits.

Definition LiveRegUnits.cpp:88

A set of register units used to track register liveness.

LLVM_ABI void addRegsInMask(const uint32_t *RegMask)

Adds register units not preserved by the regmask RegMask.

Definition LiveRegUnits.cpp:33

void addReg(MCRegister Reg)

Adds register units covered by physical register Reg.

LiveRegUnits()=default

Constructs a new empty LiveRegUnits set.

LLVM_ABI void stepBackward(const MachineInstr &MI)

Updates liveness when stepping backwards over the instruction MI.

Definition LiveRegUnits.cpp:44

LLVM_ABI void addLiveOuts(const MachineBasicBlock &MBB)

Adds registers living out of block MBB.

Definition LiveRegUnits.cpp:145

void addUnits(const BitVector &RegUnits)

Adds all register units marked in the bitvector RegUnits.

void removeReg(MCRegister Reg)

Removes all register units covered by physical register Reg.

void addRegMasked(MCRegister Reg, LaneBitmask Mask)

Adds register units covered by physical register Reg that are part of the lanemask Mask.

bool empty() const

Returns true if the set is empty.

LLVM_ABI void addLiveIns(const MachineBasicBlock &MBB)

Adds registers living into block MBB.

Definition LiveRegUnits.cpp:158

LLVM_ABI void removeRegsNotPreserved(const uint32_t *RegMask)

Removes register units not preserved by the regmask RegMask.

Definition LiveRegUnits.cpp:22

LLVM_ABI void accumulate(const MachineInstr &MI)

Adds all register units used, defined or clobbered in MI.

Definition LiveRegUnits.cpp:69

MCRegUnitRootIterator enumerates the root registers of a register unit.

bool isValid() const

Check if the iterator is at the end of the list.

The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.

bool isCalleeSavedInfoValid() const

Has the callee saved info been calculated yet?

const std::vector< CalleeSavedInfo > & getCalleeSavedInfo() const

Returns a reference to call saved info vector for the current function.

MachineFrameInfo & getFrameInfo()

getFrameInfo - Return the frame info object for the current function.

MachineRegisterInfo & getRegInfo()

getRegInfo - Return information about the registers currently in use.

Representation of each machine instruction.

MachineOperand class - Representation of each machine instruction operand.

static bool clobbersPhysReg(const uint32_t *RegMask, MCRegister PhysReg)

clobbersPhysReg - Returns true if this RegMask clobbers PhysReg.

MachineRegisterInfo - Keep track of information for virtual and physical registers,...

This is an optimization pass for GlobalISel generic memory operations.

uint16_t MCPhysReg

An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...

auto find_if(R &&Range, UnaryPredicate P)

Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.