LLVM  8.0.1
Macros | Functions | Variables
Thumb2SizeReduction.cpp File Reference
#include "ARM.h"
#include "ARMBaseInstrInfo.h"
#include "ARMSubtarget.h"
#include "MCTargetDesc/ARMBaseInfo.h"
#include "Thumb2InstrInfo.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/Function.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <functional>
#include <iterator>
#include <utility>
Include dependency graph for Thumb2SizeReduction.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "t2-reduce-size"
 
#define THUMB2_SIZE_REDUCE_NAME   "Thumb2 instruction size reduce pass"
 

Functions

 STATISTIC (NumNarrows, "Number of 32-bit instrs reduced to 16-bit ones")
 
 STATISTIC (Num2Addrs, "Number of 32-bit instrs reduced to 2addr 16-bit ones")
 
 STATISTIC (NumLdSts, "Number of 32-bit load / store reduced to 16-bit ones")
 
 INITIALIZE_PASS (Thumb2SizeReduce, DEBUG_TYPE, THUMB2_SIZE_REDUCE_NAME, false, false) Thumb2SizeReduce
 
static bool HasImplicitCPSRDef (const MCInstrDesc &MCID)
 
static bool isHighLatencyCPSR (MachineInstr *Def)
 
static bool VerifyLowRegs (MachineInstr *MI)
 
static bool UpdateCPSRDef (MachineInstr &MI, bool LiveCPSR, bool &DefCPSR)
 
static bool UpdateCPSRUse (MachineInstr &MI, bool LiveCPSR)
 

Variables

static cl::opt< int > ReduceLimit ("t2-reduce-limit", cl::init(-1), cl::Hidden)
 
static cl::opt< int > ReduceLimit2Addr ("t2-reduce-limit2", cl::init(-1), cl::Hidden)
 
static cl::opt< int > ReduceLimitLdSt ("t2-reduce-limit3", cl::init(-1), cl::Hidden)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "t2-reduce-size"

Definition at line 47 of file Thumb2SizeReduction.cpp.

◆ THUMB2_SIZE_REDUCE_NAME

#define THUMB2_SIZE_REDUCE_NAME   "Thumb2 instruction size reduce pass"

Definition at line 48 of file Thumb2SizeReduction.cpp.

Function Documentation

◆ HasImplicitCPSRDef()

static bool HasImplicitCPSRDef ( const MCInstrDesc MCID)
static

Definition at line 255 of file Thumb2SizeReduction.cpp.

References llvm::MCInstrDesc::getImplicitDefs().

Referenced by isHighLatencyCPSR().

◆ INITIALIZE_PASS()

INITIALIZE_PASS ( Thumb2SizeReduce  ,
DEBUG_TYPE  ,
THUMB2_SIZE_REDUCE_NAME  ,
false  ,
false   
)

Definition at line 242 of file Thumb2SizeReduction.cpp.

References llvm::array_lengthof(), and llvm_unreachable.

◆ isHighLatencyCPSR()

static bool isHighLatencyCPSR ( MachineInstr Def)
static

◆ STATISTIC() [1/3]

STATISTIC ( NumNarrows  ,
"Number of 32-bit instrs reduced to 16-bit ones"   
)

◆ STATISTIC() [2/3]

STATISTIC ( Num2Addrs  ,
"Number of 32-bit instrs reduced to 2addr 16-bit ones"   
)

◆ STATISTIC() [3/3]

STATISTIC ( NumLdSts  ,
"Number of 32-bit load / store reduced to 16-bit ones"   
)

◆ UpdateCPSRDef()

static bool UpdateCPSRDef ( MachineInstr MI,
bool  LiveCPSR,
bool DefCPSR 
)
static

Definition at line 973 of file Thumb2SizeReduction.cpp.

References llvm::MachineInstr::operands().

Referenced by UpdateCPSRUse().

◆ UpdateCPSRUse()

static bool UpdateCPSRUse ( MachineInstr MI,
bool  LiveCPSR 
)
static

◆ VerifyLowRegs()

static bool VerifyLowRegs ( MachineInstr MI)
static

Definition at line 375 of file Thumb2SizeReduction.cpp.

References llvm::ARM_AM::add, llvm::MachineInstrBuilder::add(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::ARMCC::AL, assert(), llvm::ARMSubtarget::avoidMOVsShifterOperand(), llvm::BuildMI(), llvm::TargetInstrInfo::CommuteAnyOperandIndex, llvm::condCodeOp(), llvm::RegState::Dead, llvm::RegState::Define, llvm::MachineBasicBlock::erase_instr(), llvm::MachineInstr::eraseFromBundle(), llvm::errs(), getAlignment(), llvm::MachineInstr::getDebugLoc(), llvm::MachineInstr::getDesc(), llvm::MachineInstr::getFlags(), llvm::MachineFunction::getFunction(), llvm::MachineOperand::getImm(), llvm::getInstrPredicate(), llvm::getInternalReadRegState(), llvm::getKillRegState(), llvm::MCInstrDesc::getNumOperands(), llvm::MachineInstr::getNumOperands(), llvm::MCInstrDesc::getOpcode(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineBasicBlock::getParent(), llvm::MachineOperand::getReg(), getReg(), llvm::MachineInstr::hasOneMemOperand(), llvm::MCInstrDesc::hasOptionalDef(), llvm::isARMLowRegister(), llvm::MachineOperand::isDead(), llvm::MachineOperand::isImm(), llvm::MachineOperand::isImplicit(), llvm::MachineOperand::isInternalRead(), llvm::MachineOperand::isKill(), llvm::MCOperandInfo::isOptionalDef(), llvm::MCInstrDesc::isPredicable(), llvm::MCOperandInfo::isPredicate(), llvm::MachineOperand::isReg(), LLVM_DEBUG, LLVM_FALLTHROUGH, llvm_unreachable, llvm::MachineInstr::mayLoadOrStore(), llvm::MachineInstr::memoperands(), llvm::MachineInstr::memoperands_begin(), llvm::MCInstrDesc::OpInfo, llvm::Function::optForMinSize(), llvm::predOps(), ReduceLimit, ReduceLimit2Addr, ReduceLimitLdSt, Reg, llvm::MachineOperand::setIsDead(), llvm::MachineOperand::setIsDef(), llvm::MachineOperand::setIsKill(), llvm::MachineInstrBuilder::setMemRefs(), llvm::MachineInstrBuilder::setMIFlags(), and llvm::t1CondCodeOp().

Variable Documentation

◆ ReduceLimit

cl::opt<int> ReduceLimit("t2-reduce-limit", cl::init(-1), cl::Hidden)
static

Referenced by VerifyLowRegs().

◆ ReduceLimit2Addr

cl::opt<int> ReduceLimit2Addr("t2-reduce-limit2", cl::init(-1), cl::Hidden)
static

Referenced by VerifyLowRegs().

◆ ReduceLimitLdSt

cl::opt<int> ReduceLimitLdSt("t2-reduce-limit3", cl::init(-1), cl::Hidden)
static

Referenced by VerifyLowRegs().