20#define DEBUG_TYPE "arm-bb-utils"
30 switch(
MI->getOpcode()) {
84 assert(
I !=
MBB->
end() &&
"Didn't find MI in its own basic block?");
94 unsigned MaxDisp)
const {
95 unsigned PCAdj = isThumb ? 4 : 8;
97 unsigned DestOffset = BBInfo[DestBB->
getNumber()].Offset;
102 <<
" to " << DestOffset <<
" offset "
103 <<
int(DestOffset - BrOffset) <<
"\t" << *
MI);
105 if (BrOffset <= DestOffset) {
107 if (DestOffset-BrOffset <= MaxDisp)
110 if (BrOffset-DestOffset <= MaxDisp)
118 "Basic block is not a child of the current function.\n");
122 <<
" - name: " << BB->
getName() <<
"\n"
123 <<
" - number: " << BB->
getNumber() <<
"\n"
124 <<
" - function: " << MF.
getName() <<
"\n"
127 for(
unsigned i = BBNum + 1, e = MF.
getNumBlockIDs(); i < e; ++i) {
131 const unsigned Offset = BBInfo[i - 1].postOffset(
Align);
142 BBInfo[i].Offset =
Offset;
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
unsigned getInstSizeInBytes(const MachineInstr &MI) const override
GetInstSize - Returns the size of the specified MachineInstr.
bool isBBInRange(MachineInstr *MI, MachineBasicBlock *DestBB, unsigned MaxDisp) const
isBBInRange - Returns true if the distance between specific MI and specific BB can fit in MI's displa...
void adjustBBOffsetsAfter(MachineBasicBlock *MBB)
void computeBlockSize(MachineBasicBlock *MBB)
unsigned getOffsetOf(MachineInstr *MI) const
getOffsetOf - Return the current offset of the specified machine instruction from the start of the fu...
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
Align getAlignment() const
Return alignment of the basic block.
StringRef getName() const
Return the name of the corresponding LLVM basic block, or an empty string.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
void ensureAlignment(Align A)
ensureAlignment - Make sure the function is at least A bytes aligned.
MachineBasicBlock * getBlockNumbered(unsigned N) const
getBlockNumbered - MachineBasicBlocks are automatically numbered when they are inserted into the mach...
unsigned getNumBlockIDs() const
getNumBlockIDs - Return the number of MBB ID's allocated.
Representation of each machine instruction.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
This is an optimization pass for GlobalISel generic memory operations.
static bool mayOptimizeThumb2Instruction(const MachineInstr *MI)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.
This struct is a compact representation of a valid (non-zero power of two) alignment.
BasicBlockInfo - Information about the offset and size of a single basic block.
unsigned Size
Size - Size of the basic block in bytes.
Align PostAlign
PostAlign - When > 1, the block terminator contains a .align directive, so the end of the block is al...
uint8_t Unalign
Unalign - When non-zero, the block contains instructions (inline asm) of unknown size.