68 return "Hexagon RDF optimizations";
88 bool interpretAsCopy(
const MachineInstr *
MI, EqualityMap &EM)
override;
106 "Hexagon RDF optimizations",
false,
false)
114 EM.insert(std::make_pair(DstR, SrcR));
118 unsigned Opc = MI->getOpcode();
120 case Hexagon::A2_combinew: {
131 case Hexagon::A2_addi: {
137 case Hexagon::A2_tfr: {
149 bool HexagonDCE::run() {
150 bool Collected = collect();
167 R2I.insert(std::make_pair(
RA.Id, SA.
Id));
178 bool Changed =
false;
182 dbgs() <<
"Partly dead: " << *SA.Addr->getCode();
183 Changed |= rewrite(SA, Remove);
186 return erase(Remove) || Changed;
202 OpMap.
insert(std::make_pair(
RA.Id, getOpNum(
RA.Addr->getOp())));
207 unsigned N = OpMap[
RA.Id];
216 if (!getDFG().IsCode<NodeAttrs::Stmt>(IA))
224 unsigned OpNum, NewOpc;
226 case Hexagon::L2_loadri_pi:
227 NewOpc = Hexagon::L2_loadri_io;
230 case Hexagon::L2_loadrd_pi:
231 NewOpc = Hexagon::L2_loadrd_io;
234 case Hexagon::V6_vL32b_pi:
235 NewOpc = Hexagon::V6_vL32b_ai;
238 case Hexagon::S2_storeri_pi:
239 NewOpc = Hexagon::S2_storeri_io;
242 case Hexagon::S2_storerd_pi:
243 NewOpc = Hexagon::S2_storerd_io;
246 case Hexagon::V6_vS32b_pi:
247 NewOpc = Hexagon::V6_vS32b_ai;
254 return getDeadNodes().count(DA.Id);
259 if (&DA.Addr->getOp() != &
Op)
272 dbgs() <<
"Rewriting: " <<
MI;
275 removeOperand(IA, OpNum);
292 MDT = &getAnalysis<MachineDominatorTree>();
293 const auto &MDF = getAnalysis<MachineDominanceFrontier>();
300 MF.
print(
dbgs() <<
"Before " << getPassName() <<
"\n",
nullptr);
310 dbgs() <<
"Starting copy propagation on: " << MF.
getName() <<
'\n' 317 dbgs() <<
"Starting dead code elimination on: " << MF.
getName() <<
'\n' 319 HexagonDCE DCE(G, *
MRI);
321 Changed |= DCE.run();
325 dbgs() <<
"Starting liveness recomputation on: " << MF.
getName() <<
'\n';
334 MF.
print(
dbgs() <<
"After " << getPassName() <<
"\n",
nullptr);
340 return new HexagonRDFOpt();
void initializeHexagonRDFOptPass(PassRegistry &)
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
This class represents lattice values for constants.
unsigned getReg() const
getReg - Returns the register number.
unsigned getSubReg() const
INITIALIZE_PASS_BEGIN(HexagonRDFOpt, "hexagon-rdf-opt", "Hexagon RDF optimizations", false, false) INITIALIZE_PASS_END(HexagonRDFOpt
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly...
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
static cl::opt< unsigned > RDFLimit("rdf-limit", cl::init(std::numeric_limits< unsigned >::max()))
const TargetInstrInfo & getTII() const
SI optimize exec mask operations pre RA
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
NodeAddr< FuncNode * > getFunc() const
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
unsigned getNumOperands() const
Retuns the total number of operands.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
bool insert(const value_type &X)
Insert a new element into the SetVector.
RegisterRef makeRegRef(unsigned Reg, unsigned Sub) const
size_type count(const key_type &key) const
Count the number of elements of a given key in the SetVector.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
initializer< Ty > init(const Ty &Val)
unsigned const MachineRegisterInfo * MRI
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
NodeAddr< T > addr(NodeId N) const
Represent the analysis usage information of a pass.
NodeList getRelatedRefs(NodeAddr< InstrNode *> IA, NodeAddr< RefNode *> RA) const
void setImm(int64_t immVal)
FunctionPass class - This class is used to implement most global optimizations.
NodeList members_if(Predicate P, const DataFlowGraph &G) const
NodeList members(const DataFlowGraph &G) const
void print(raw_ostream &OS, const SlotIndexes *=nullptr) const
print - Print out the MachineFunction in a format suitable for debugging to the specified stream...
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
virtual bool interpretAsCopy(const MachineInstr *MI, EqualityMap &EM)
void setDesc(const MCInstrDesc &tid)
Replace the instruction descriptor (thus opcode) of the current instruction with a new one...
FunctionPass * createHexagonRDFOpt()
static cl::opt< bool > RDFDump("rdf-dump", cl::init(false))
MachineOperand class - Representation of each machine instruction operand.
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
hexagon rdf Hexagon RDF optimizations
const Function & getFunction() const
Return the LLVM function that this machine code represents.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void setPreservesAll()
Set by analyses that do not transform their input at all.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
MachineFunctionProperties & set(Property P)
Representation of each machine instruction.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
void build(unsigned Options=BuildOptions::None)
static bool IsCode(const NodeAddr< NodeBase *> BA)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A vector that has set insertion semantics.
static bool IsDef(const NodeAddr< NodeBase *> BA)
StringRef - Represent a constant reference to a string, i.e.
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
void RemoveOperand(unsigned OpNo)
Erase an operand from an instruction, leaving it with one fewer operand than it started with...
const MachineOperand & getOperand(unsigned i) const
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
Properties which a MachineFunction may have at a given point in time.