38#define DEBUG_TYPE "remove-loads-into-fake-uses"
40STATISTIC(NumLoadsDeleted,
"Number of dead load instructions deleted");
41STATISTIC(NumFakeUsesDeleted,
"Number of FAKE_USE instructions deleted");
58 MachineFunctionProperties::Property::NoVRegs);
62 return "Remove Loads Into Fake Uses";
72 "Remove Loads Into Fake Uses",
false,
false)
78 if (!MF.hasFakeUses() || skipFunction(MF.getFunction()))
81 bool AnyChanges =
false;
101 RegFakeUses[MO.getReg()].push_back(&
MI);
110 if (
MI.getRestoreSize(
TII)) {
112 assert(Reg.isPhysical() &&
"VReg seen in function with NoVRegs set?");
124 MI.eraseFromParent();
132 <<
"RemoveLoadsIntoFakeUses: DELETING: " << *FakeUse);
133 FakeUse->eraseFromParent();
135 NumFakeUsesDeleted += RegFakeUses[Reg].
size();
136 RegFakeUses[Reg].
clear();
144 if (!RegFakeUses.
empty()) {
146 if (MO.isReg() && MO.isDef()) {
148 assert(Reg.isPhysical() &&
149 "VReg seen in function with NoVRegs set?");
151 RegFakeUses.
erase(Unit);
unsigned const MachineRegisterInfo * MRI
const HexagonInstrInfo * TII
unsigned const TargetRegisterInfo * TRI
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
This file builds on the ADT/GraphTraits.h file to build a generic graph post order iterator.
Remove Loads Into Fake Uses
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
bool runOnMachineFunction(MachineFunction &MF) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
MachineFunctionProperties getRequiredProperties() const override
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
RemoveLoadsIntoFakeUses()
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Represent the analysis usage information of a pass.
void setPreservesCFG()
This function should be called by the pass, iff they do not:
bool erase(const KeyT &Val)
bool contains(const_arg_type_t< KeyT > Val) const
Return true if the specified key is in the map, false otherwise.
A set of physical registers with utility functions to track liveness when walking backward/forward th...
bool available(const MachineRegisterInfo &MRI, MCPhysReg Reg) const
Returns true if register Reg and no aliasing register is in the set.
void stepBackward(const MachineInstr &MI)
Simulates liveness when stepping backwards over an instruction(bundle).
void init(const TargetRegisterInfo &TRI)
(re-)initializes and clears the set.
void addLiveOuts(const MachineBasicBlock &MBB)
Adds all live-out registers of basic block MBB.
A set of register units used to track register liveness.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
Properties which a MachineFunction may have at a given point in time.
MachineFunctionProperties & set(Property P)
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Wrapper class representing virtual and physical registers.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
TargetInstrInfo - Interface to description of machine instruction set.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
TargetSubtargetInfo - Generic base class for all target subtargets.
This is an optimization pass for GlobalISel generic memory operations.
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
char & RemoveLoadsIntoFakeUsesID
RemoveLoadsIntoFakeUses pass.
iterator_range< po_iterator< T > > post_order(const T &G)
void initializeRemoveLoadsIntoFakeUsesPass(PassRegistry &)
auto reverse(ContainerTy &&C)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.