diff options
author | Hal Finkel <hfinkel@anl.gov> | 2014-02-02 06:12:27 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2014-02-02 06:12:27 +0000 |
commit | c9ac32837df68a5347ef518a351910c708460d67 (patch) | |
tree | da2b2a0960c5808dd5cc3dfc937f098f81b03988 /lib/Target/PowerPC/PPCInstrInfo.cpp | |
parent | a16c1b55e2aac49c7336f3f54b50bbe85335712e (diff) | |
download | llvm-c9ac32837df68a5347ef518a351910c708460d67.tar.gz llvm-c9ac32837df68a5347ef518a351910c708460d67.tar.bz2 llvm-c9ac32837df68a5347ef518a351910c708460d67.tar.xz |
Replace PPC instruction-size code with MCInstrDesc getSize
As part of the cleanup done to enable the disassembler, the PPC instructions
now have a valid Size description field. This can now be used to replace some
custom logic in a few places to compute instruction sizes.
Patch by David Wiberg!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200623 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/PPCInstrInfo.cpp')
-rw-r--r-- | lib/Target/PowerPC/PPCInstrInfo.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/lib/Target/PowerPC/PPCInstrInfo.cpp b/lib/Target/PowerPC/PPCInstrInfo.cpp index 9e491fa19c..b15ef1b9a6 100644 --- a/lib/Target/PowerPC/PPCInstrInfo.cpp +++ b/lib/Target/PowerPC/PPCInstrInfo.cpp @@ -1436,22 +1436,15 @@ bool PPCInstrInfo::optimizeCompareInstr(MachineInstr *CmpInstr, /// instruction may be. This returns the maximum number of bytes. /// unsigned PPCInstrInfo::GetInstSizeInBytes(const MachineInstr *MI) const { - switch (MI->getOpcode()) { - case PPC::INLINEASM: { // Inline Asm: Variable size. + unsigned Opcode = MI->getOpcode(); + + if (Opcode == PPC::INLINEASM) { const MachineFunction *MF = MI->getParent()->getParent(); const char *AsmStr = MI->getOperand(0).getSymbolName(); return getInlineAsmLength(AsmStr, *MF->getTarget().getMCAsmInfo()); - } - case PPC::PROLOG_LABEL: - case PPC::EH_LABEL: - case PPC::GC_LABEL: - case PPC::DBG_VALUE: - return 0; - case PPC::BL8_NOP: - case PPC::BLA8_NOP: - return 8; - default: - return 4; // PowerPC instructions are all 4 bytes + } else { + const MCInstrDesc &Desc = get(Opcode); + return Desc.getSize(); } } |