From a059efa885f03e69895e3f6d15d48d57645e0340 Mon Sep 17 00:00:00 2001 From: Sam Parker Date: Mon, 17 Jun 2019 09:13:10 +0000 Subject: [PATCH] [ARM] Remove ARMComputeBlockSize Forgot to remove file! llvm-svn: 363532 --- llvm/lib/Target/ARM/ARMComputeBlockSize.cpp | 80 --------------------- 1 file changed, 80 deletions(-) delete mode 100644 llvm/lib/Target/ARM/ARMComputeBlockSize.cpp diff --git a/llvm/lib/Target/ARM/ARMComputeBlockSize.cpp b/llvm/lib/Target/ARM/ARMComputeBlockSize.cpp deleted file mode 100644 index 828fc6568380..000000000000 --- a/llvm/lib/Target/ARM/ARMComputeBlockSize.cpp +++ /dev/null @@ -1,80 +0,0 @@ -//===--- ARMComputeBlockSize.cpp - Compute machine block sizes ------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "ARM.h" -#include "ARMBaseInstrInfo.h" -#include "ARMBasicBlockInfo.h" -#include "ARMMachineFunctionInfo.h" -#include "llvm/CodeGen/MachineBasicBlock.h" -#include "llvm/CodeGen/MachineFunction.h" -#include "llvm/CodeGen/MachineInstr.h" -#include "llvm/CodeGen/TargetSubtargetInfo.h" -#include - -using namespace llvm; - -namespace llvm { - -// mayOptimizeThumb2Instruction - Returns true if optimizeThumb2Instructions -// below may shrink MI. -static bool -mayOptimizeThumb2Instruction(const MachineInstr *MI) { - switch(MI->getOpcode()) { - // optimizeThumb2Instructions. - case ARM::t2LEApcrel: - case ARM::t2LDRpci: - // optimizeThumb2Branches. - case ARM::t2B: - case ARM::t2Bcc: - case ARM::tBcc: - // optimizeThumb2JumpTables. - case ARM::t2BR_JT: - case ARM::tBR_JTr: - return true; - } - return false; -} - -void computeBlockSize(MachineFunction *MF, MachineBasicBlock *MBB, - BasicBlockInfo &BBI) { - const ARMBaseInstrInfo *TII = - static_cast(MF->getSubtarget().getInstrInfo()); - bool isThumb = MF->getInfo()->isThumbFunction(); - BBI.Size = 0; - BBI.Unalign = 0; - BBI.PostAlign = 0; - - for (MachineInstr &I : *MBB) { - BBI.Size += TII->getInstSizeInBytes(I); - // For inline asm, getInstSizeInBytes returns a conservative estimate. - // The actual size may be smaller, but still a multiple of the instr size. - if (I.isInlineAsm()) - BBI.Unalign = isThumb ? 1 : 2; - // Also consider instructions that may be shrunk later. - else if (isThumb && mayOptimizeThumb2Instruction(&I)) - BBI.Unalign = 1; - } - - // tBR_JTr contains a .align 2 directive. - if (!MBB->empty() && MBB->back().getOpcode() == ARM::tBR_JTr) { - BBI.PostAlign = 2; - MBB->getParent()->ensureAlignment(2); - } -} - -std::vector computeAllBlockSizes(MachineFunction *MF) { - std::vector BBInfo; - BBInfo.resize(MF->getNumBlockIDs()); - - for (MachineBasicBlock &MBB : *MF) - computeBlockSize(MF, &MBB, BBInfo[MBB.getNumber()]); - - return BBInfo; -} - -} // end namespace llvm