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) {
171 unsigned Reg = MO.
getReg();
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);
214 bool isUndef = UndefUseSet.
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())
298 bool AllDefsDead =
true;
299 PhysRegInfo PRI = {
false,
false,
false,
false,
false,
false,
false,
false};
302 "analyzePhysReg not given a physical register!");
314 unsigned MOReg = MO.
getReg();
329 }
else if (MO.
isDef()) {
void push_back(const T &Elt)
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
INITIALIZE_PASS(UnpackMachineBundles,"unpack-mi-bundles","Unpack machine instruction bundles", false, false) bool UnpackMachineBundles
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()
bool Tied
Tied - Uses and defs must use the same register.
bool isValid() const
isValid - returns true if this iterator is not yet at the end.
MachineOperand & deref() const
void initializeFinalizeMachineBundlesPass(PassRegistry &)
void initializeUnpackMachineBundlesPass(PassRegistry &)
Instructions::iterator instr_iterator
VirtRegInfo analyzeVirtReg(unsigned Reg, SmallVectorImpl< std::pair< MachineInstr *, unsigned > > *Ops=nullptr)
analyzeVirtReg - Analyze how the current instruction or bundle uses a virtual register.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
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...
bool isReg() const
isReg - Tests if this is a MO_Register operand.
void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
Reg
All possible values of the reg field in the ModR/M byte.
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.
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)
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
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.
bool regsOverlap(unsigned regA, unsigned regB) const
Returns true if the two registers are equal or alias each other.
* if(!EatIfPresent(lltok::kw_thread_local)) return false
ParseOptionalThreadLocal := /*empty.
bool Writes
Writes - One of the operands writes the virtual register.
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.
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.
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
bool isRegMask() const
isRegMask - Tests if this is a MO_RegisterMask operand.
size_type count(const T &V) const
count - Return 1 if the element is in the set, 0 otherwise.
Iterator for intrusive lists based on ilist_node.
bool isSuperRegisterEq(unsigned RegA, unsigned RegB) const
Returns true if RegB is a super-register of RegA or if RegB == RegA.
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.
Representation of each machine instruction.
static bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
unsigned getImplRegState(bool B)
Information about how a physical register Reg is used by a set of operands.
unsigned getReg() const
getReg - Returns the register number.
bool Defined
Reg or one of its aliases is defined.
bool isValid() const
isValid - Returns true until all the operands have been visited.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
virtual const TargetInstrInfo * getInstrInfo() const
bool isRegTiedToDefOperand(unsigned UseOpIdx, unsigned *DefOpIdx=nullptr) const
Return true if the use operand of the specified index is tied to a def operand.
print Print MemDeps of function
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
bool readsReg() const
readsReg - Returns true if this operand reads the previous value of its register. ...
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
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...
unsigned getOperandNo() const
getOperandNo - Returns the number of the current operand relative to its instruction.
bool isInternalRead() const
Helper class for constructing bundles of MachineInstrs.