36 std::function<bool(const MachineFunction &)> PredicateFtor;
43 "Unpack machine instruction bundles",
false,
false)
46 if (PredicateFtor && !PredicateFtor(MF))
60 while (++MII != MIE && MII->isBundledWithPred()) {
61 MII->unbundleFromPred();
62 for (
unsigned i = 0, e = MII->getNumOperands(); i != e; ++i) {
84 return new UnpackMachineBundles(std::move(Ftor));
102 "Finalize machine instruction bundles",
false,
false)
118 assert(FirstMI != LastMI &&
"Empty bundle?");
126 BuildMI(MF, FirstMI->getDebugLoc(), TII->
get(TargetOpcode::BUNDLE));
138 for (; FirstMI != LastMI; ++FirstMI) {
139 for (
unsigned i = 0, e = FirstMI->getNumOperands(); i != e; ++i) {
152 if (LocalDefSet.
count(Reg)) {
158 if (ExternUseSet.
insert(Reg).second) {
169 for (
unsigned i = 0, e = Defs.
size(); i != e; ++i) {
175 if (LocalDefSet.
insert(Reg).second) {
182 KilledDefSet.
erase(Reg);
185 DeadDefSet.
erase(Reg);
190 unsigned SubReg = *SubRegs;
191 if (LocalDefSet.
insert(SubReg).second)
201 for (
unsigned i = 0, e = LocalDefs.
size(); i != e; ++i) {
202 unsigned Reg = LocalDefs[i];
203 if (Added.
insert(Reg).second) {
205 bool isDead = DeadDefSet.
count(Reg) || KilledDefSet.
count(Reg);
211 for (
unsigned i = 0, e = ExternUses.
size(); i != e; ++i) {
212 unsigned Reg = ExternUses[i];
213 bool isKill = KilledUseSet.
count(Reg);
230 while (LastMI != E && LastMI->isInsideBundle())
239 bool Changed =
false;
246 assert(!MII->isInsideBundle() &&
247 "First instr cannot be inside bundle before finalization!");
249 for (++MII; MII != MIE; ) {
250 if (!MII->isInsideBundle())
270 for(; isValid(); ++*
this) {
277 Ops->push_back(std::make_pair(MO.
getParent(), getOperandNo()));
298 bool AllDefsDead =
true;
299 PhysRegInfo PRI = {
false,
false,
false,
false,
false,
false,
false,
false};
302 "analyzePhysReg not given a physical register!");
303 for (; isValid(); ++*
this) {
314 unsigned MOReg = MO.
getReg();
329 }
else if (MO.
isDef()) {
bool isRegMask() const
isRegMask - Tests if this is a MO_RegisterMask operand.
bool isSuperRegisterEq(unsigned RegA, unsigned RegB) const
Returns true if RegB is a super-register of RegA or if RegB == RegA.
void push_back(const T &Elt)
MachineInstr * getParent()
getParent - Return the instruction that this operand belongs to.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
instr_iterator instr_begin()
instr_iterator instr_end()
Compute iterated dominance frontiers using a linear time algorithm.
bool Tied
Tied - Uses and defs must use the same register.
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
unsigned getReg() const
getReg - Returns the register number.
void initializeFinalizeMachineBundlesPass(PassRegistry &)
unsigned const TargetRegisterInfo * TRI
void initializeUnpackMachineBundlesPass(PassRegistry &)
bool isInternalRead() const
VirtRegInfo analyzeVirtReg(unsigned Reg, SmallVectorImpl< std::pair< MachineInstr *, unsigned > > *Ops=nullptr)
analyzeVirtReg - Analyze how the current instruction or bundle uses a virtual register.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const HexagonInstrInfo * TII
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
char & FinalizeMachineBundlesID
FinalizeMachineBundles - This pass finalize machine instruction bundles (created earlier, e.g.
PhysRegInfo analyzePhysReg(unsigned Reg, const TargetRegisterInfo *TRI)
analyzePhysReg - Analyze how the current instruction or bundle uses a physical register.
INITIALIZE_PASS(UnpackMachineBundles, "unpack-mi-bundles", "Unpack machine instruction bundles", false, false) bool UnpackMachineBundles
bool readsReg() const
readsReg - Returns true if this operand reads the previous value of its register. ...
MIBundleBuilder & prepend(MachineInstr *MI)
Insert MI into MBB by prepending it to the instructions in the bundle.
virtual const TargetInstrInfo * getInstrInfo() const
unsigned getUndefRegState(bool B)
bool PartialDeadDef
Reg is Defined and all defs of reg or an overlapping register are dead.
VirtRegInfo - Information about a virtual register used by a set of operands.
unsigned getKillRegState(bool B)
TargetInstrInfo - Interface to description of machine instruction set.
unsigned getDeadRegState(bool B)
unsigned getDefRegState(bool B)
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
* if(!EatIfPresent(lltok::kw_thread_local)) return false
ParseOptionalThreadLocal := /*empty.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
bool Writes
Writes - One of the operands writes the virtual register.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
bool Read
Reg or one of its aliases is read.
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
bool Clobbered
There is a regmask operand indicating Reg is clobbered.
bool Killed
There is a use operand of reg or a super-register with kill flag set.
void setIsInternalRead(bool Val=true)
FunctionPass class - This class is used to implement most global optimizations.
bool isRegTiedToDefOperand(unsigned UseOpIdx, unsigned *DefOpIdx=nullptr) const
Return true if the use operand of the specified index is tied to a def operand.
std::pair< NoneType, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
bool Reads
Reads - One of the operands read the virtual register.
char & UnpackMachineBundlesID
UnpackMachineBundles - This pass unpack machine instruction bundles.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
MCSubRegIterator enumerates all sub-registers of Reg.
static bool isUndef(ArrayRef< int > Mask)
Iterator for intrusive lists based on ilist_node.
bool regsOverlap(unsigned regA, unsigned regB) const
Returns true if the two registers are equal or alias each other.
MachineOperand class - Representation of each machine instruction operand.
bool finalizeBundles(MachineFunction &MF)
finalizeBundles - Finalize instruction bundles in the specified MachineFunction.
bool FullyDefined
Reg or a super-register is defined.
FunctionPass * createUnpackMachineBundles(std::function< bool(const MachineFunction &)> Ftor)
bool FullyRead
Reg or a super-register is read. The full register is read.
static bool clobbersPhysReg(const uint32_t *RegMask, unsigned PhysReg)
clobbersPhysReg - Returns true if this RegMask clobbers PhysReg.
bool isValid() const
isValid - returns true if this iterator is not yet at the end.
Representation of each machine instruction.
static bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
unsigned getImplRegState(bool B)
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
Information about how a physical register Reg is used by a set of operands.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
Instructions::iterator instr_iterator
bool Defined
Reg or one of its aliases is defined.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
print Print MemDeps of function
Binary functor that adapts to any other binary functor after dereferencing operands.
void finalizeBundle(MachineBasicBlock &MBB, MachineBasicBlock::instr_iterator FirstMI, MachineBasicBlock::instr_iterator LastMI)
finalizeBundle - Finalize a machine instruction bundle which includes a sequence of instructions star...
Helper class for constructing bundles of MachineInstrs.
size_type count(const T &V) const
count - Return 1 if the element is in the set, 0 otherwise.