LLVM  8.0.1
Macros | Functions
Thumb2ITBlockPass.cpp File Reference
#include "ARM.h"
#include "ARMMachineFunctionInfo.h"
#include "ARMSubtarget.h"
#include "MCTargetDesc/ARMBaseInfo.h"
#include "Thumb2InstrInfo.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/MachineInstrBundle.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/MC/MCRegisterInfo.h"
#include <cassert>
#include <new>
Include dependency graph for Thumb2ITBlockPass.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "thumb2-it"
 

Functions

 STATISTIC (NumITs, "Number of IT blocks inserted")
 
 STATISTIC (NumMovedInsts, "Number of predicated instructions moved")
 
static void TrackDefUses (MachineInstr *MI, SmallSet< unsigned, 4 > &Defs, SmallSet< unsigned, 4 > &Uses, const TargetRegisterInfo *TRI)
 TrackDefUses - Tracking what registers are being defined and used by instructions in the IT block. More...
 
static void ClearKillFlags (MachineInstr *MI, SmallSet< unsigned, 4 > &Uses)
 Clear kill flags for any uses in the given set. More...
 
static bool isCopy (MachineInstr *MI)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "thumb2-it"

Definition at line 34 of file Thumb2ITBlockPass.cpp.

Function Documentation

◆ ClearKillFlags()

static void ClearKillFlags ( MachineInstr MI,
SmallSet< unsigned, 4 > &  Uses 
)
static

Clear kill flags for any uses in the given set.

This will likely conservatively remove more kill flags than are necessary, but removing them is safer than incorrect kill flags remaining on instructions.

Definition at line 118 of file Thumb2ITBlockPass.cpp.

References llvm::SmallSet< T, N, C >::count(), and llvm::MachineInstr::operands().

Referenced by isCopy().

◆ isCopy()

static bool isCopy ( MachineInstr MI)
static

Definition at line 128 of file Thumb2ITBlockPass.cpp.

References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstr::addOperand(), llvm::ARMCC::AL, assert(), llvm::MachineBasicBlock::begin(), llvm::MachineFunction::begin(), llvm::BuildMI(), llvm::SmallSet< T, N, C >::clear(), ClearKillFlags(), llvm::SmallSet< T, N, C >::count(), llvm::MachineOperand::CreateReg(), E, llvm::MachineBasicBlock::end(), llvm::MachineFunction::end(), llvm::finalizeBundle(), llvm::MachineInstr::findRegisterUseOperand(), llvm::MachineInstr::getDebugLoc(), llvm::MachineInstr::getDesc(), llvm::MachineFunction::getInfo(), llvm::MachineInstrBuilder::getInstr(), llvm::ARMSubtarget::getInstrInfo(), llvm::MachineInstrBundleIterator< Ty, IsReverse >::getInstrIterator(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::getITInstrPredicate(), llvm::MCInstrDesc::getNumOperands(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::ARMCC::getOppositeCondition(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getReg(), getReg(), llvm::ARMSubtarget::getRegisterInfo(), llvm::MachineOperand::getSubReg(), llvm::MachineFunction::getSubtarget(), llvm::MachineInstr::hasOptionalDef(), I, llvm::MachineBasicBlock::insert(), llvm::MachineInstr::isBranch(), llvm::MachineInstr::isReturn(), llvm::ARMSubtarget::isThumb2(), llvm::BitmaskEnumDetail::Mask(), MI, Modified, llvm::MachineBasicBlock::remove(), llvm::ARMSubtarget::restrictIT(), llvm::MachineOperand::setIsKill(), TII, TrackDefUses(), and TRI.

◆ STATISTIC() [1/2]

STATISTIC ( NumITs  ,
"Number of IT blocks inserted"   
)

◆ STATISTIC() [2/2]

STATISTIC ( NumMovedInsts  ,
"Number of predicated instructions moved"   
)

◆ TrackDefUses()

static void TrackDefUses ( MachineInstr MI,
SmallSet< unsigned, 4 > &  Defs,
SmallSet< unsigned, 4 > &  Uses,
const TargetRegisterInfo TRI 
)
static

TrackDefUses - Tracking what registers are being defined and used by instructions in the IT block.

This also tracks "dependencies", i.e. uses in the IT block that are defined before the IT instruction.

Definition at line 78 of file Thumb2ITBlockPass.cpp.

References llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::SmallSet< T, N, C >::insert(), llvm::MachineOperand::isReg(), llvm::MachineOperand::isUse(), llvm::MCRegisterInfo::DiffListIterator::isValid(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), Reg, and llvm::SmallVectorBase::size().

Referenced by isCopy().