LLVM  6.0.0svn
Macros | Functions | Variables
MipsConstantIslandPass.cpp File Reference
#include "Mips.h"
#include "Mips16InstrInfo.h"
#include "MipsMachineFunction.h"
#include "MipsSubtarget.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/MachineConstantPool.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/MachineRegisterInfo.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Type.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <iterator>
#include <vector>
Include dependency graph for MipsConstantIslandPass.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "mips-constant-islands"
 

Functions

 STATISTIC (NumCPEs, "Number of constpool entries")
 
 STATISTIC (NumSplit, "Number of uncond branches inserted")
 
 STATISTIC (NumCBrFixed, "Number of cond branches fixed")
 
 STATISTIC (NumUBrFixed, "Number of uncond branches fixed")
 
static unsigned int branchTargetOperand (MachineInstr *MI)
 
static unsigned int longformBranchOpcode (unsigned int Opcode)
 
static unsigned int branchMaxOffsets (unsigned int Opcode)
 
static bool BBHasFallthrough (MachineBasicBlock *MBB)
 BBHasFallthrough - Return true if the specified basic block can fallthrough into the block immediately after it. More...
 
static bool CompareMBBNumbers (const MachineBasicBlock *LHS, const MachineBasicBlock *RHS)
 CompareMBBNumbers - Little predicate function to sort the WaterList by MBB ID. More...
 
static bool BBIsJumpedOver (MachineBasicBlock *MBB)
 BBIsJumpedOver - Return true of the specified basic block's only predecessor unconditionally branches to its only successor. More...
 
static unsigned getUnconditionalBrDisp (int Opc)
 getUnconditionalBrDisp - Returns the maximum displacement that can fit in the specific unconditional branch instruction. More...
 

Variables

static cl::opt< boolAlignConstantIslands ("mips-align-constant-islands", cl::Hidden, cl::init(true), cl::desc("Align constant islands in code"))
 
static cl::opt< int > ConstantIslandsSmallOffset ("mips-constant-islands-small-offset", cl::init(0), cl::desc("Make small offsets be this amount for testing purposes"), cl::Hidden)
 
static cl::opt< boolNoLoadRelaxation ("mips-constant-islands-no-load-relaxation", cl::init(false), cl::desc("Don't relax loads to long loads - for testing purposes"), cl::Hidden)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "mips-constant-islands"

Definition at line 60 of file MipsConstantIslandPass.cpp.

Function Documentation

◆ BBHasFallthrough()

bool ARMConstantIslands::BBHasFallthrough ( MachineBasicBlock MBB)
static

◆ BBIsJumpedOver()

static bool BBIsJumpedOver ( MachineBasicBlock MBB)
static

◆ branchMaxOffsets()

static unsigned int branchMaxOffsets ( unsigned int  Opcode)
static

◆ branchTargetOperand()

static unsigned int branchTargetOperand ( MachineInstr MI)
static

Definition at line 88 of file MipsConstantIslandPass.cpp.

References llvm::MachineInstr::getOpcode(), and llvm_unreachable.

Referenced by getUnconditionalBrDisp().

◆ CompareMBBNumbers()

static bool CompareMBBNumbers ( const MachineBasicBlock LHS,
const MachineBasicBlock RHS 
)
static

◆ getUnconditionalBrDisp()

static unsigned getUnconditionalBrDisp ( int  Opc)
inlinestatic

getUnconditionalBrDisp - Returns the maximum displacement that can fit in the specific unconditional branch instruction.

Definition at line 1156 of file MipsConstantIslandPass.cpp.

References llvm::MachineInstrBuilder::addConstantPoolIndex(), llvm::MachineInstrBuilder::addImm(), assert(), B, llvm::MachineBasicBlock::back(), BBHasFallthrough(), BBIsJumpedOver(), llvm::MachineBasicBlock::begin(), branchMaxOffsets(), branchTargetOperand(), llvm::BuildMI(), C, llvm::MachineOperand::CreateCPI(), llvm::MachineOperand::CreateImm(), llvm::dbgs(), DEBUG, E, llvm::MachineBasicBlock::empty(), llvm::MachineBasicBlock::end(), llvm::MachineInstr::eraseFromParent(), llvm::find(), llvm::format(), llvm::ConstantInt::get(), llvm::MachineOperand::getImm(), llvm::MachineOperand::getIndex(), llvm::Type::getInt32Ty(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::MachineOperand::getMBB(), llvm::MachineBasicBlock::getNumber(), llvm::MachineInstr::getNumExplicitOperands(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getReg(), I, llvm::MachineBasicBlock::insert(), Int32Ty, llvm::MachineOperand::isCPI(), llvm::MachineOperand::isImm(), llvm::MachineInstr::isUnconditionalBranch(), llvm::Literal, longformBranchOpcode(), MI, NoLoadRelaxation, llvm::BasicBlockInfo::postOffset(), llvm::MachineBasicBlock::setAlignment(), llvm::MachineInstr::setDesc(), llvm::MachineOperand::setIndex(), llvm::MachineOperand::setMBB(), llvm::AMDGPU::HSAMD::Kernel::Arg::Key::Size, and TII.

◆ longformBranchOpcode()

static unsigned int longformBranchOpcode ( unsigned int  Opcode)
static

Definition at line 107 of file MipsConstantIslandPass.cpp.

References llvm_unreachable.

Referenced by getUnconditionalBrDisp().

◆ STATISTIC() [1/4]

STATISTIC ( NumCPEs  ,
"Number of constpool entries"   
)

◆ STATISTIC() [2/4]

STATISTIC ( NumSplit  ,
"Number of uncond branches inserted"   
)

◆ STATISTIC() [3/4]

STATISTIC ( NumCBrFixed  ,
"Number of cond branches fixed"   
)

◆ STATISTIC() [4/4]

STATISTIC ( NumUBrFixed  ,
"Number of uncond branches fixed"   
)

Variable Documentation

◆ AlignConstantIslands

cl::opt<bool> AlignConstantIslands("mips-align-constant-islands", cl::Hidden, cl::init(true), cl::desc("Align constant islands in code"))
static

◆ ConstantIslandsSmallOffset

cl::opt<int> ConstantIslandsSmallOffset("mips-constant-islands-small-offset", cl::init(0), cl::desc("Make small offsets be this amount for testing purposes"), cl::Hidden)
static

Referenced by branchMaxOffsets().

◆ NoLoadRelaxation

cl::opt<bool> NoLoadRelaxation("mips-constant-islands-no-load-relaxation", cl::init(false), cl::desc("Don't relax loads to long loads - for testing purposes"), cl::Hidden)
static

Referenced by getUnconditionalBrDisp().