LLVM  5.0.0
Macros | Functions
SIFoldOperands.cpp File Reference
#include "AMDGPU.h"
#include "AMDGPUSubtarget.h"
#include "SIInstrInfo.h"
#include "SIMachineFunctionInfo.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
Include dependency graph for SIFoldOperands.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "si-fold-operands"
 

Functions

static bool isInlineConstantIfFolded (const SIInstrInfo *TII, const MachineInstr &UseMI, unsigned OpNo, const MachineOperand &OpToFold)
 
static bool updateOperand (FoldCandidate &Fold, const TargetRegisterInfo &TRI)
 
static bool isUseMIInFoldList (ArrayRef< FoldCandidate > FoldList, const MachineInstr *MI)
 
static bool tryAddToFoldList (SmallVectorImpl< FoldCandidate > &FoldList, MachineInstr *MI, unsigned OpNo, MachineOperand *OpToFold, const SIInstrInfo *TII)
 
static bool isUseSafeToFold (const SIInstrInfo *TII, const MachineInstr &MI, const MachineOperand &UseMO)
 
static bool evalBinaryInstruction (unsigned Opcode, int32_t &Result, uint32_t LHS, uint32_t RHS)
 
static unsigned getMovOpc (bool IsScalar)
 
static void stripExtraCopyOperands (MachineInstr &MI)
 Remove any leftover implicit operands from mutating the instruction. More...
 
static void mutateCopyOp (MachineInstr &MI, const MCInstrDesc &NewDesc)
 
static MachineOperand * getImmOrMaterializedImm (MachineRegisterInfo &MRI, MachineOperand &Op)
 
static bool tryConstantFoldOp (MachineRegisterInfo &MRI, const SIInstrInfo *TII, MachineInstr *MI, MachineOperand *ImmOp)
 
static bool tryFoldInst (const SIInstrInfo *TII, MachineInstr *MI)
 
static bool hasOneNonDBGUseInst (const MachineRegisterInfo &MRI, unsigned Reg)
 
static int getOModValue (unsigned Opc, int64_t Val)
 

Macro Definition Documentation

#define DEBUG_TYPE   "si-fold-operands"

Definition at line 25 of file SIFoldOperands.cpp.

Function Documentation

static bool evalBinaryInstruction ( unsigned  Opcode,
int32_t &  Result,
uint32_t  LHS,
uint32_t  RHS 
)
static

Definition at line 396 of file SIFoldOperands.cpp.

Referenced by tryConstantFoldOp().

static MachineOperand* getImmOrMaterializedImm ( MachineRegisterInfo &  MRI,
MachineOperand &  Op 
)
static
static unsigned getMovOpc ( bool  IsScalar)
static

Definition at line 447 of file SIFoldOperands.cpp.

Referenced by tryConstantFoldOp(), and tryFoldInst().

static int getOModValue ( unsigned  Opc,
int64_t  Val 
)
static
static bool hasOneNonDBGUseInst ( const MachineRegisterInfo &  MRI,
unsigned  Reg 
)
static
static bool isInlineConstantIfFolded ( const SIInstrInfo *  TII,
const MachineInstr &  UseMI,
unsigned  OpNo,
const MachineOperand &  OpToFold 
)
static
static bool isUseMIInFoldList ( ArrayRef< FoldCandidate >  FoldList,
const MachineInstr *  MI 
)
static

Definition at line 181 of file SIFoldOperands.cpp.

Referenced by tryAddToFoldList().

static bool isUseSafeToFold ( const SIInstrInfo *  TII,
const MachineInstr &  MI,
const MachineOperand &  UseMO 
)
static
static void mutateCopyOp ( MachineInstr &  MI,
const MCInstrDesc &  NewDesc 
)
static

Definition at line 464 of file SIFoldOperands.cpp.

References llvm::MachineInstr::setDesc(), and stripExtraCopyOperands().

Referenced by tryConstantFoldOp(), and tryFoldInst().

static void stripExtraCopyOperands ( MachineInstr &  MI)
static

Remove any leftover implicit operands from mutating the instruction.

e.g. if we replace an s_and_b32 with a copy, we don't need the implicit scc def anymore.

Definition at line 454 of file SIFoldOperands.cpp.

References Desc, llvm::MachineInstr::getDesc(), llvm::MCInstrDesc::getNumImplicitDefs(), llvm::MCInstrDesc::getNumImplicitUses(), llvm::MCInstrDesc::getNumOperands(), llvm::MachineInstr::getNumOperands(), I, and llvm::MachineInstr::RemoveOperand().

Referenced by mutateCopyOp(), and tryConstantFoldOp().

static bool tryAddToFoldList ( SmallVectorImpl< FoldCandidate > &  FoldList,
MachineInstr *  MI,
unsigned  OpNo,
MachineOperand *  OpToFold,
const SIInstrInfo *  TII 
)
static
static bool tryConstantFoldOp ( MachineRegisterInfo &  MRI,
const SIInstrInfo *  TII,
MachineInstr *  MI,
MachineOperand *  ImmOp 
)
static
static bool tryFoldInst ( const SIInstrInfo *  TII,
MachineInstr *  MI 
)
static
static bool updateOperand ( FoldCandidate &  Fold,
const TargetRegisterInfo &  TRI 
)
static