mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-13 08:26:02 +00:00
Add a postOffset() alignment argument.
This computes the offset of the layout sucessor block, considering its alignment as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146401 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -142,21 +142,26 @@ namespace {
|
|||||||
return Unalign ? Unalign : KnownBits;
|
return Unalign ? Unalign : KnownBits;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the offset immediately following this block.
|
/// Compute the offset immediately following this block. If LogAlign is
|
||||||
unsigned postOffset() const {
|
/// specified, return the offset the successor block will get if it has
|
||||||
|
/// this alignment.
|
||||||
|
unsigned postOffset(unsigned LogAlign = 0) const {
|
||||||
unsigned PO = Offset + Size;
|
unsigned PO = Offset + Size;
|
||||||
if (!PostAlign)
|
unsigned LA = std::max(unsigned(PostAlign), LogAlign);
|
||||||
|
if (!LA)
|
||||||
return PO;
|
return PO;
|
||||||
// Add alignment padding from the terminator.
|
// Add alignment padding from the terminator.
|
||||||
return WorstCaseAlign(PO, PostAlign, internalKnownBits());
|
return WorstCaseAlign(PO, LA, internalKnownBits());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the number of known low bits of postOffset. If this block
|
/// Compute the number of known low bits of postOffset. If this block
|
||||||
/// contains inline asm, the number of known bits drops to the
|
/// contains inline asm, the number of known bits drops to the
|
||||||
/// instruction alignment. An aligned terminator may increase the number
|
/// instruction alignment. An aligned terminator may increase the number
|
||||||
/// of know bits.
|
/// of know bits.
|
||||||
unsigned postKnownBits() const {
|
/// If LogAlign is given, also consider the alignment of the next block.
|
||||||
return std::max(unsigned(PostAlign), internalKnownBits());
|
unsigned postKnownBits(unsigned LogAlign = 0) const {
|
||||||
|
return std::max(std::max(unsigned(PostAlign), LogAlign),
|
||||||
|
internalKnownBits());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1020,14 +1025,10 @@ static bool BBIsJumpedOver(MachineBasicBlock *MBB) {
|
|||||||
void ARMConstantIslands::AdjustBBOffsetsAfter(MachineBasicBlock *BB) {
|
void ARMConstantIslands::AdjustBBOffsetsAfter(MachineBasicBlock *BB) {
|
||||||
for(unsigned i = BB->getNumber() + 1, e = MF->getNumBlockIDs(); i < e; ++i) {
|
for(unsigned i = BB->getNumber() + 1, e = MF->getNumBlockIDs(); i < e; ++i) {
|
||||||
// Get the offset and known bits at the end of the layout predecessor.
|
// Get the offset and known bits at the end of the layout predecessor.
|
||||||
unsigned Offset = BBInfo[i - 1].postOffset();
|
// Include the alignment of the current block.
|
||||||
unsigned KnownBits = BBInfo[i - 1].postKnownBits();
|
unsigned LogAlign = MF->getBlockNumbered(i)->getAlignment();
|
||||||
|
unsigned Offset = BBInfo[i - 1].postOffset(LogAlign);
|
||||||
// Add padding before an aligned block. This may teach us more bits.
|
unsigned KnownBits = BBInfo[i - 1].postKnownBits(LogAlign);
|
||||||
if (unsigned Align = MF->getBlockNumbered(i)->getAlignment()) {
|
|
||||||
Offset = WorstCaseAlign(Offset, Align, KnownBits);
|
|
||||||
KnownBits = std::max(KnownBits, Align);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is where block i begins.
|
// This is where block i begins.
|
||||||
BBInfo[i].Offset = Offset;
|
BBInfo[i].Offset = Offset;
|
||||||
|
Reference in New Issue
Block a user