LLVM  4.0.0
Macros | Functions
SIFoldOperands.cpp File Reference
#include "AMDGPU.h"
#include "AMDGPUSubtarget.h"
#include "SIInstrInfo.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 isSafeToFold (const MachineInstr &MI)
 
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 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 MachineOperandgetImmOrMaterializedImm (MachineRegisterInfo &MRI, MachineOperand &Op)
 
static bool tryConstantFoldOp (MachineRegisterInfo &MRI, const SIInstrInfo *TII, MachineInstr *MI, MachineOperand *ImmOp)
 

Macro Definition Documentation

#define DEBUG_TYPE   "si-fold-operands"

Definition at line 23 of file SIFoldOperands.cpp.

Function Documentation

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

Definition at line 390 of file SIFoldOperands.cpp.

Referenced by tryConstantFoldOp().

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

Definition at line 441 of file SIFoldOperands.cpp.

Referenced by tryConstantFoldOp().

static bool isInlineConstantIfFolded ( const SIInstrInfo TII,
const MachineInstr UseMI,
unsigned  OpNo,
const MachineOperand OpToFold 
)
static
static bool isSafeToFold ( const MachineInstr MI)
static
static bool isUseMIInFoldList ( ArrayRef< FoldCandidate >  FoldList,
const MachineInstr MI 
)
static

Definition at line 183 of file SIFoldOperands.cpp.

Referenced by tryAddToFoldList().

static bool isUseSafeToFold ( const MachineInstr MI,
const MachineOperand UseMO 
)
static

Definition at line 263 of file SIFoldOperands.cpp.

References llvm::MachineOperand::isUndef().

static void mutateCopyOp ( MachineInstr MI,
const MCInstrDesc NewDesc 
)
static

Definition at line 458 of file SIFoldOperands.cpp.

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

Referenced by tryConstantFoldOp().

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 448 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 updateOperand ( FoldCandidate &  Fold,
const TargetRegisterInfo TRI 
)
static