LLVM  4.0.0
Macros | Functions | Variables
HexagonInstrInfo.cpp File Reference
#include "Hexagon.h"
#include "HexagonHazardRecognizer.h"
#include "HexagonInstrInfo.h"
#include "HexagonRegisterInfo.h"
#include "HexagonSubtarget.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/CodeGen/DFAPacketizer.h"
#include "llvm/CodeGen/LivePhysRegs.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineBranchProbabilityInfo.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineInstrBundle.h"
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/ScheduleDAG.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/MC/MCInstrItineraries.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/Support/BranchProbability.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetSubtargetInfo.h"
#include <cassert>
#include <cctype>
#include <cstdint>
#include <cstring>
#include <iterator>
#include "HexagonGenInstrInfo.inc"
#include "HexagonGenDFAPacketizer.inc"
Include dependency graph for HexagonInstrInfo.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "hexagon-instrinfo"
 
#define GET_INSTRINFO_CTOR_DTOR
 
#define GET_INSTRMAP_INFO
 

Functions

static bool isIntRegForSubInst (unsigned Reg)
 
static bool isDblRegForSubInst (unsigned Reg, const HexagonRegisterInfo &HRI)
 
static unsigned nonDbgMICount (MachineBasicBlock::const_instr_iterator MIB, MachineBasicBlock::const_instr_iterator MIE)
 Calculate number of instructions excluding the debug instructions. More...
 
static MachineInstrfindLoopInstr (MachineBasicBlock *BB, int EndLoopOp, SmallPtrSet< MachineBasicBlock *, 8 > &Visited)
 Find the hardware loop instruction used to set-up the specified loop. More...
 
static void parseOperands (const MachineInstr &MI, SmallVector< unsigned, 4 > &Defs, SmallVector< unsigned, 8 > &Uses)
 Gather register def/uses from MI. More...
 
static bool isDuplexPairMatch (unsigned Ga, unsigned Gb)
 
static void getLiveRegsAt (LivePhysRegs &Regs, const MachineInstr &MI)
 

Variables

cl::opt< boolScheduleInlineAsm ("hexagon-sched-inline-asm", cl::Hidden, cl::init(false), cl::desc("Do not consider inline-asm a scheduling/""packetization boundary."))
 
static cl::opt< boolEnableBranchPrediction ("hexagon-enable-branch-prediction", cl::Hidden, cl::init(true), cl::desc("Enable branch prediction"))
 
static cl::opt< boolDisableNVSchedule ("disable-hexagon-nv-schedule", cl::Hidden, cl::ZeroOrMore, cl::init(false), cl::desc("Disable schedule adjustment for new value stores."))
 
static cl::opt< boolEnableTimingClassLatency ("enable-timing-class-latency", cl::Hidden, cl::init(false), cl::desc("Enable timing class latency"))
 
static cl::opt< boolEnableALUForwarding ("enable-alu-forwarding", cl::Hidden, cl::init(true), cl::desc("Enable vec alu forwarding"))
 
static cl::opt< boolEnableACCForwarding ("enable-acc-forwarding", cl::Hidden, cl::init(true), cl::desc("Enable vec acc forwarding"))
 
static cl::opt< boolBranchRelaxAsmLarge ("branch-relax-asm-large", cl::init(true), cl::Hidden, cl::ZeroOrMore, cl::desc("branch relax asm"))
 
static cl::opt< boolUseDFAHazardRec ("dfa-hazard-rec", cl::init(true), cl::Hidden, cl::ZeroOrMore, cl::desc("Use the DFA based hazard recognizer."))
 
const int Hexagon_MEMV_OFFSET_MAX_128B = 896
 Constants for Hexagon instructions. More...
 
const int Hexagon_MEMV_OFFSET_MIN_128B = -1024
 
const int Hexagon_MEMV_OFFSET_MAX = 448
 
const int Hexagon_MEMV_OFFSET_MIN = -512
 
const int Hexagon_MEMW_OFFSET_MAX = 4095
 
const int Hexagon_MEMW_OFFSET_MIN = -4096
 
const int Hexagon_MEMD_OFFSET_MAX = 8191
 
const int Hexagon_MEMD_OFFSET_MIN = -8192
 
const int Hexagon_MEMH_OFFSET_MAX = 2047
 
const int Hexagon_MEMH_OFFSET_MIN = -2048
 
const int Hexagon_MEMB_OFFSET_MAX = 1023
 
const int Hexagon_MEMB_OFFSET_MIN = -1024
 
const int Hexagon_ADDI_OFFSET_MAX = 32767
 
const int Hexagon_ADDI_OFFSET_MIN = -32768
 
const int Hexagon_MEMD_AUTOINC_MAX = 56
 
const int Hexagon_MEMD_AUTOINC_MIN = -64
 
const int Hexagon_MEMW_AUTOINC_MAX = 28
 
const int Hexagon_MEMW_AUTOINC_MIN = -32
 
const int Hexagon_MEMH_AUTOINC_MAX = 14
 
const int Hexagon_MEMH_AUTOINC_MIN = -16
 
const int Hexagon_MEMB_AUTOINC_MAX = 7
 
const int Hexagon_MEMB_AUTOINC_MIN = -8
 
const int Hexagon_MEMV_AUTOINC_MAX = 192
 
const int Hexagon_MEMV_AUTOINC_MIN = -256
 
const int Hexagon_MEMV_AUTOINC_MAX_128B = 384
 
const int Hexagon_MEMV_AUTOINC_MIN_128B = -512
 

Macro Definition Documentation

#define DEBUG_TYPE   "hexagon-instrinfo"

Definition at line 56 of file HexagonInstrInfo.cpp.

#define GET_INSTRINFO_CTOR_DTOR

Definition at line 58 of file HexagonInstrInfo.cpp.

#define GET_INSTRMAP_INFO

Definition at line 59 of file HexagonInstrInfo.cpp.

Function Documentation

static MachineInstr* findLoopInstr ( MachineBasicBlock BB,
int  EndLoopOp,
SmallPtrSet< MachineBasicBlock *, 8 > &  Visited 
)
static

Find the hardware loop instruction used to set-up the specified loop.

On Hexagon, we have two instructions used to set-up the hardware loop (LOOP0, LOOP1) with corresponding endloop (ENDLOOP0, ENDLOOP1) instructions to indicate the end of a loop.

Definition at line 155 of file HexagonInstrInfo.cpp.

References E, I, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::MachineBasicBlock::pred_begin(), and llvm::MachineBasicBlock::pred_end().

Referenced by llvm::HexagonInstrInfo::insertBranch(), and llvm::HexagonInstrInfo::reduceLoopCount().

static void getLiveRegsAt ( LivePhysRegs Regs,
const MachineInstr MI 
)
static
static bool isDblRegForSubInst ( unsigned  Reg,
const HexagonRegisterInfo HRI 
)
static
static bool isDuplexPairMatch ( unsigned  Ga,
unsigned  Gb 
)
static
static bool isIntRegForSubInst ( unsigned  Reg)
static

Calculate number of instructions excluding the debug instructions.

Definition at line 141 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::nonDbgBBSize(), and llvm::HexagonInstrInfo::nonDbgBundleSize().

static void parseOperands ( const MachineInstr MI,
SmallVector< unsigned, 4 > &  Defs,
SmallVector< unsigned, 8 > &  Uses 
)
inlinestatic

Variable Documentation

cl::opt<bool> BranchRelaxAsmLarge("branch-relax-asm-large", cl::init(true), cl::Hidden, cl::ZeroOrMore, cl::desc("branch relax asm"))
static
cl::opt<bool> DisableNVSchedule("disable-hexagon-nv-schedule", cl::Hidden, cl::ZeroOrMore, cl::init(false), cl::desc("Disable schedule adjustment for new value stores."))
static
cl::opt<bool> EnableACCForwarding("enable-acc-forwarding", cl::Hidden, cl::init(true), cl::desc("Enable vec acc forwarding"))
static
cl::opt<bool> EnableALUForwarding("enable-alu-forwarding", cl::Hidden, cl::init(true), cl::desc("Enable vec alu forwarding"))
static
cl::opt<bool> EnableBranchPrediction("hexagon-enable-branch-prediction", cl::Hidden, cl::init(true), cl::desc("Enable branch prediction"))
static
cl::opt<bool> EnableTimingClassLatency("enable-timing-class-latency", cl::Hidden, cl::init(false), cl::desc("Enable timing class latency"))
static
const int Hexagon_ADDI_OFFSET_MAX = 32767

Definition at line 108 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidOffset().

const int Hexagon_ADDI_OFFSET_MIN = -32768

Definition at line 109 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidOffset().

const int Hexagon_MEMB_AUTOINC_MAX = 7

Definition at line 116 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidAutoIncImm().

const int Hexagon_MEMB_AUTOINC_MIN = -8

Definition at line 117 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidAutoIncImm().

const int Hexagon_MEMB_OFFSET_MAX = 1023

Definition at line 106 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidOffset().

const int Hexagon_MEMB_OFFSET_MIN = -1024

Definition at line 107 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidOffset().

const int Hexagon_MEMD_AUTOINC_MAX = 56

Definition at line 110 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidAutoIncImm().

const int Hexagon_MEMD_AUTOINC_MIN = -64

Definition at line 111 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidAutoIncImm().

const int Hexagon_MEMD_OFFSET_MAX = 8191

Definition at line 102 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidOffset().

const int Hexagon_MEMD_OFFSET_MIN = -8192

Definition at line 103 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidOffset().

const int Hexagon_MEMH_AUTOINC_MAX = 14

Definition at line 114 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidAutoIncImm().

const int Hexagon_MEMH_AUTOINC_MIN = -16

Definition at line 115 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidAutoIncImm().

const int Hexagon_MEMH_OFFSET_MAX = 2047

Definition at line 104 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidOffset().

const int Hexagon_MEMH_OFFSET_MIN = -2048

Definition at line 105 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidOffset().

const int Hexagon_MEMV_AUTOINC_MAX = 192

Definition at line 118 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidAutoIncImm().

const int Hexagon_MEMV_AUTOINC_MAX_128B = 384

Definition at line 120 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidAutoIncImm().

const int Hexagon_MEMV_AUTOINC_MIN = -256

Definition at line 119 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidAutoIncImm().

const int Hexagon_MEMV_AUTOINC_MIN_128B = -512

Definition at line 121 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidAutoIncImm().

const int Hexagon_MEMV_OFFSET_MAX = 448

Definition at line 98 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidOffset().

const int Hexagon_MEMV_OFFSET_MAX_128B = 896

Constants for Hexagon instructions.

Definition at line 96 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidOffset().

const int Hexagon_MEMV_OFFSET_MIN = -512

Definition at line 99 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidOffset().

const int Hexagon_MEMV_OFFSET_MIN_128B = -1024

Definition at line 97 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidOffset().

const int Hexagon_MEMW_AUTOINC_MAX = 28

Definition at line 112 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidAutoIncImm().

const int Hexagon_MEMW_AUTOINC_MIN = -32

Definition at line 113 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidAutoIncImm().

const int Hexagon_MEMW_OFFSET_MAX = 4095

Definition at line 100 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidOffset().

const int Hexagon_MEMW_OFFSET_MIN = -4096

Definition at line 101 of file HexagonInstrInfo.cpp.

Referenced by llvm::HexagonInstrInfo::isValidOffset().

cl::opt<bool> ScheduleInlineAsm("hexagon-sched-inline-asm", cl::Hidden, cl::init(false), cl::desc("Do not consider inline-asm a scheduling/""packetization boundary."))
cl::opt<bool> UseDFAHazardRec("dfa-hazard-rec", cl::init(true), cl::Hidden, cl::ZeroOrMore, cl::desc("Use the DFA based hazard recognizer."))
static