diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2021-11-19 20:06:13 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2021-11-19 20:06:13 +0000 |
commit | c0981da47d5696fe36474fcf86b4ce03ae3ff818 (patch) | |
tree | f42add1021b9f2ac6a69ac7cf6c4499962739a45 /llvm/lib/Target/SystemZ/SystemZLongBranch.cpp | |
parent | 344a3780b2e33f6ca763666c380202b18aab72a3 (diff) | |
download | src-c0981da47d5696fe36474fcf86b4ce03ae3ff818.tar.gz src-c0981da47d5696fe36474fcf86b4ce03ae3ff818.zip |
Diffstat (limited to 'llvm/lib/Target/SystemZ/SystemZLongBranch.cpp')
-rw-r--r-- | llvm/lib/Target/SystemZ/SystemZLongBranch.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/llvm/lib/Target/SystemZ/SystemZLongBranch.cpp b/llvm/lib/Target/SystemZ/SystemZLongBranch.cpp index b1964321c78a..9c985c16f082 100644 --- a/llvm/lib/Target/SystemZ/SystemZLongBranch.cpp +++ b/llvm/lib/Target/SystemZ/SystemZLongBranch.cpp @@ -209,10 +209,24 @@ void SystemZLongBranch::skipTerminator(BlockPosition &Position, Position.Address += Terminator.ExtraRelaxSize; } +static unsigned getInstSizeInBytes(const MachineInstr &MI, + const SystemZInstrInfo *TII) { + unsigned Size = TII->getInstSizeInBytes(MI); + assert((Size || + // These do not have a size: + MI.isDebugOrPseudoInstr() || MI.isPosition() || MI.isKill() || + MI.isImplicitDef() || MI.getOpcode() == SystemZ::MemBarrier || + // These have a size that may be zero: + MI.isInlineAsm() || MI.getOpcode() == SystemZ::STACKMAP || + MI.getOpcode() == SystemZ::PATCHPOINT) && + "Missing size value for instruction."); + return Size; +} + // Return a description of terminator instruction MI. TerminatorInfo SystemZLongBranch::describeTerminator(MachineInstr &MI) { TerminatorInfo Terminator; - Terminator.Size = TII->getInstSizeInBytes(MI); + Terminator.Size = getInstSizeInBytes(MI, TII); if (MI.isConditionalBranch() || MI.isUnconditionalBranch()) { switch (MI.getOpcode()) { case SystemZ::J: @@ -287,7 +301,7 @@ uint64_t SystemZLongBranch::initMBBInfo() { MachineBasicBlock::iterator MI = MBB->begin(); MachineBasicBlock::iterator End = MBB->end(); while (MI != End && !MI->isTerminator()) { - Block.Size += TII->getInstSizeInBytes(*MI); + Block.Size += getInstSizeInBytes(*MI, TII); ++MI; } skipNonTerminators(Position, Block); |