Lines Matching +full:block +full:- +full:offset
1 //===--- ARMBasicBlockInfo.cpp - Utilities for block sizes ---------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
20 #define DEBUG_TYPE "arm-bb-utils"
26 // mayOptimizeThumb2Instruction - Returns true if optimizeThumb2Instructions
30 switch(MI->getOpcode()) { in mayOptimizeThumb2Instruction()
47 LLVM_DEBUG(dbgs() << "computeBlockSize: " << MBB->getName() << "\n"); in computeBlockSize()
48 BasicBlockInfo &BBI = BBInfo[MBB->getNumber()]; in computeBlockSize()
54 BBI.Size += TII->getInstSizeInBytes(I); in computeBlockSize()
65 if (!MBB->empty() && MBB->back().getOpcode() == ARM::tBR_JTr) { in computeBlockSize()
67 MBB->getParent()->ensureAlignment(Align(4)); in computeBlockSize()
71 /// getOffsetOf - Return the current offset of the specified machine instruction
72 /// from the start of the function. This offset changes as stuff is moved
75 const MachineBasicBlock *MBB = MI->getParent(); in getOffsetOf()
77 // The offset is composed of two things: the sum of the sizes of all MBB's in getOffsetOf()
78 // before this instruction's block, and the offset from the start of the block in getOffsetOf()
80 unsigned Offset = BBInfo[MBB->getNumber()].Offset; in getOffsetOf() local
83 for (MachineBasicBlock::const_iterator I = MBB->begin(); &*I != MI; ++I) { in getOffsetOf()
84 assert(I != MBB->end() && "Didn't find MI in its own basic block?"); in getOffsetOf()
85 Offset += TII->getInstSizeInBytes(*I); in getOffsetOf()
87 return Offset; in getOffsetOf()
90 /// isBBInRange - Returns true if the distance between specific MI and
97 unsigned DestOffset = BBInfo[DestBB->getNumber()].Offset; in isBBInRange()
100 << " from " << printMBBReference(*MI->getParent()) in isBBInRange()
102 << " to " << DestOffset << " offset " in isBBInRange()
103 << int(DestOffset - BrOffset) << "\t" << *MI); in isBBInRange()
107 if (DestOffset-BrOffset <= MaxDisp) in isBBInRange()
110 if (BrOffset-DestOffset <= MaxDisp) in isBBInRange()
117 assert(BB->getParent() == &MF && in adjustBBOffsetsAfter()
118 "Basic block is not a child of the current function.\n"); in adjustBBOffsetsAfter()
120 unsigned BBNum = BB->getNumber(); in adjustBBOffsetsAfter()
121 LLVM_DEBUG(dbgs() << "Adjust block:\n" in adjustBBOffsetsAfter()
122 << " - name: " << BB->getName() << "\n" in adjustBBOffsetsAfter()
123 << " - number: " << BB->getNumber() << "\n" in adjustBBOffsetsAfter()
124 << " - function: " << MF.getName() << "\n" in adjustBBOffsetsAfter()
125 << " - blocks: " << MF.getNumBlockIDs() << "\n"); in adjustBBOffsetsAfter()
128 // Get the offset and known bits at the end of the layout predecessor. in adjustBBOffsetsAfter()
129 // Include the alignment of the current block. in adjustBBOffsetsAfter()
130 const Align Align = MF.getBlockNumbered(i)->getAlignment(); in adjustBBOffsetsAfter()
131 const unsigned Offset = BBInfo[i - 1].postOffset(Align); in adjustBBOffsetsAfter() local
132 const unsigned KnownBits = BBInfo[i - 1].postKnownBits(Align); in adjustBBOffsetsAfter()
134 // This is where block i begins. Stop if the offset is already correct, in adjustBBOffsetsAfter()
138 BBInfo[i].Offset == Offset && in adjustBBOffsetsAfter()
142 BBInfo[i].Offset = Offset; in adjustBBOffsetsAfter()