LLVM
8.0.1
|
#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/Config/llvm-config.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>
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< bool > | AlignConstantIslands ("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< 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) |
#define DEBUG_TYPE "mips-constant-islands" |
Definition at line 61 of file MipsConstantIslandPass.cpp.
|
static |
BBHasFallthrough - Return true if the specified basic block can fallthrough into the block immediately after it.
Definition at line 594 of file MipsConstantIslandPass.cpp.
References llvm::AMDGPU::HSAMD::Kernel::Arg::Key::Align, AlignConstantIslands, assert(), llvm::MachineBasicBlock::begin(), llvm::tgtok::Bits, llvm::computeBlockSize(), E, llvm::MachineBasicBlock::end(), llvm::MachineFunction::end(), llvm::MachineOperand::getIndex(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::MachineBasicBlock::getNumber(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineBasicBlock::getParent(), llvm::MachineInstr::getParent(), I, llvm::isPowerOf2_32(), llvm_unreachable, llvm::Log2_32(), MI, op, llvm::BasicBlockInfo::Size, llvm::size(), llvm::MachineBasicBlock::succ_begin(), llvm::MachineBasicBlock::succ_end(), and TII.
Referenced by getUnconditionalBrDisp().
|
static |
BBIsJumpedOver - Return true of the specified basic block's only predecessor unconditionally branches to its only successor.
Definition at line 1011 of file MipsConstantIslandPass.cpp.
References assert(), llvm::MachineBasicBlock::back(), llvm::dbgs(), llvm::MachineOperand::getIndex(), llvm::MachineOperand::getMBB(), llvm::MachineBasicBlock::getNumber(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::isCPI(), LLVM_DEBUG, llvm::MachineBasicBlock::pred_begin(), llvm::MachineBasicBlock::pred_size(), llvm::MachineInstr::setDesc(), llvm::MachineOperand::setIndex(), llvm::MachineBasicBlock::succ_begin(), llvm::MachineBasicBlock::succ_size(), and TII.
Referenced by getUnconditionalBrDisp().
Definition at line 135 of file MipsConstantIslandPass.cpp.
References llvm::MachineInstrBuilder::addConstantPoolIndex(), llvm::MachineInstrBuilder::addImm(), llvm::AMDGPU::HSAMD::Kernel::Arg::Key::Align, AlignConstantIslands, assert(), llvm::tgtok::Bits, llvm::BuildMI(), llvm::computeBlockSize(), ConstantIslandsSmallOffset, llvm::dbgs(), llvm::MachineBasicBlock::dump(), E, llvm::MachineBasicBlock::end(), F(), llvm::format(), llvm::MachineBasicBlock::getAlignment(), llvm::MachineFunction::getConstantPool(), llvm::MachineInstr::getParent(), llvm::MachineFunction::getSubtarget(), getType(), llvm::DataLayout::getTypeAllocSize(), llvm::isPowerOf2_32(), LLVM_DEBUG, LLVM_DUMP_METHOD, llvm_unreachable, llvm::Log2_32(), MI, llvm::neg(), llvm::MachineFunctionProperties::NoVRegs, llvm::BasicBlockInfo::Offset, llvm::MachineBasicBlock::push_back(), rc, llvm::report_fatal_error(), llvm::MachineFunctionProperties::set(), llvm::MachineBasicBlock::setAlignment(), Size, llvm::SmallVectorBase::size(), TII, and llvm::MipsSubtarget::useConstantIslands().
Referenced by getUnconditionalBrDisp().
|
static |
Definition at line 89 of file MipsConstantIslandPass.cpp.
References llvm::MachineInstr::getOpcode(), and llvm_unreachable.
Referenced by getUnconditionalBrDisp().
|
static |
CompareMBBNumbers - Little predicate function to sort the WaterList by MBB ID.
Definition at line 826 of file MipsConstantIslandPass.cpp.
References llvm::MachineBasicBlock::addSuccessor(), llvm::BuildMI(), llvm::computeBlockSize(), llvm::dbgs(), llvm::MachineBasicBlock::end(), llvm::format(), llvm::MachineBasicBlock::getBasicBlock(), llvm::MachineOperand::getImm(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::MachineBasicBlock::getNumber(), llvm::MachineInstr::getOperand(), llvm::MachineBasicBlock::getParent(), llvm::MachineInstr::getParent(), llvm::MachineBasicBlock::insert(), LLVM_DEBUG, llvm::lower_bound(), MI, llvm::BasicBlockInfo::Offset, llvm::OffsetToAlignment(), llvm::BasicBlockInfo::postOffset(), llvm::printMBBReference(), llvm::MachineFunction::RenumberBlocks(), Size, llvm::MachineBasicBlock::splice(), TII, and llvm::MachineBasicBlock::transferSuccessors().
|
inlinestatic |
getUnconditionalBrDisp - Returns the maximum displacement that can fit in the specific unconditional branch instruction.
Definition at line 1159 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(), 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, LLVM_DEBUG, longformBranchOpcode(), MI, NoLoadRelaxation, llvm::BasicBlockInfo::postOffset(), llvm::printMBBReference(), llvm::MachineBasicBlock::setAlignment(), llvm::MachineInstr::setDesc(), llvm::MachineOperand::setIndex(), llvm::MachineOperand::setMBB(), Size, and TII.
Definition at line 108 of file MipsConstantIslandPass.cpp.
References llvm_unreachable.
Referenced by getUnconditionalBrDisp().
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 |
Referenced by BBHasFallthrough(), and branchMaxOffsets().
|
static |
Referenced by branchMaxOffsets().