LLVM  8.0.1
Public Member Functions | Friends | List of all members
llvm::GISelCSEInfo Class Reference

The CSE Analysis object. More...

#include "llvm/CodeGen/GlobalISel/CSEInfo.h"

Inheritance diagram for llvm::GISelCSEInfo:
Inheritance graph
[legend]
Collaboration diagram for llvm::GISelCSEInfo:
Collaboration graph
[legend]

Public Member Functions

 GISelCSEInfo ()=default
 
virtual ~GISelCSEInfo ()
 
void setMF (MachineFunction &MF)
 
More...
 
void recordNewInstruction (MachineInstr *MI)
 Records a newly created inst in a list and lazily insert it to the CSEMap. More...
 
void handleRecordedInst (MachineInstr *MI)
 Use this callback to inform CSE about a newly fully created instruction. More...
 
void handleRecordedInsts ()
 Use this callback to insert all the recorded instructions. More...
 
void handleRemoveInst (MachineInstr *MI)
 Remove this inst from the CSE map. More...
 
void releaseMemory ()
 
void setCSEConfig (std::unique_ptr< CSEConfig > Opt)
 
bool shouldCSE (unsigned Opc) const
 
void analyze (MachineFunction &MF)
 
void countOpcodeHit (unsigned Opc)
 
void print ()
 
void erasingInstr (MachineInstr &MI) override
 An instruction is about to be erased. More...
 
void createdInstr (MachineInstr &MI) override
 An instruction was created and inserted into the function. More...
 
void changingInstr (MachineInstr &MI) override
 This instruction is about to be mutated in some way. More...
 
void changedInstr (MachineInstr &MI) override
 This instruction was mutated in some way. More...
 
- Public Member Functions inherited from llvm::GISelChangeObserver
virtual ~GISelChangeObserver ()
 
void changingAllUsesOfReg (const MachineRegisterInfo &MRI, unsigned Reg)
 All the instructions using the given register are being changed. More...
 
void finishedChangingAllUsesOfReg ()
 All instructions reported as changing by changingAllUsesOfReg() have finished being changed. More...
 

Friends

class CSEMIRBuilder
 

Detailed Description

The CSE Analysis object.

This installs itself as a delegate to the MachineFunction to track new instructions as well as deletions. It however will not be able to track instruction mutations. In such cases, recordNewInstruction should be called (for eg inside MachineIRBuilder::recordInsertion). Also because of how just the instruction can be inserted without adding any operands to the instruction, instructions are uniqued and inserted lazily. CSEInfo should assert when trying to enter an incomplete instruction into the CSEMap. There is Opcode level granularity on which instructions can be CSE'd and for now, only Generic instructions are CSEable.

Definition at line 69 of file CSEInfo.h.

Constructor & Destructor Documentation

◆ GISelCSEInfo()

llvm::GISelCSEInfo::GISelCSEInfo ( )
default

◆ ~GISelCSEInfo()

GISelCSEInfo::~GISelCSEInfo ( )
virtual

Definition at line 72 of file CSEInfo.cpp.

References assert().

Member Function Documentation

◆ analyze()

void GISelCSEInfo::analyze ( MachineFunction MF)

◆ changedInstr()

void GISelCSEInfo::changedInstr ( MachineInstr MI)
overridevirtual

This instruction was mutated in some way.

Implements llvm::GISelChangeObserver.

Definition at line 217 of file CSEInfo.cpp.

◆ changingInstr()

void GISelCSEInfo::changingInstr ( MachineInstr MI)
overridevirtual

This instruction is about to be mutated in some way.

Implements llvm::GISelChangeObserver.

Definition at line 212 of file CSEInfo.cpp.

◆ countOpcodeHit()

void GISelCSEInfo::countOpcodeHit ( unsigned  Opc)

Definition at line 148 of file CSEInfo.cpp.

◆ createdInstr()

void GISelCSEInfo::createdInstr ( MachineInstr MI)
overridevirtual

An instruction was created and inserted into the function.

Implements llvm::GISelChangeObserver.

Definition at line 211 of file CSEInfo.cpp.

◆ erasingInstr()

void GISelCSEInfo::erasingInstr ( MachineInstr MI)
overridevirtual

An instruction is about to be erased.

Implements llvm::GISelChangeObserver.

Definition at line 210 of file CSEInfo.cpp.

◆ handleRecordedInst()

void GISelCSEInfo::handleRecordedInst ( MachineInstr MI)

Use this callback to inform CSE about a newly fully created instruction.

Now insert the new instruction.

We'll reuse the same UniqueMachineInstr to avoid the new allocation.

This is a new instruction. Allocate a new UniqueMachineInstr and Insert.

Definition at line 165 of file CSEInfo.cpp.

References assert(), llvm::dbgs(), llvm::MachineInstr::getOpcode(), and LLVM_DEBUG.

◆ handleRecordedInsts()

void GISelCSEInfo::handleRecordedInsts ( )

Use this callback to insert all the recorded instructions.

At this point, all of these insts need to be fully constructed and should not be missing any operands.

Definition at line 195 of file CSEInfo.cpp.

◆ handleRemoveInst()

void GISelCSEInfo::handleRemoveInst ( MachineInstr MI)

Remove this inst from the CSE map.

If this inst has not been inserted yet, it will be removed from the Tempinsts list if it exists.

Definition at line 187 of file CSEInfo.cpp.

Referenced by llvm::CSEMIRBuilder::buildInstr().

◆ print()

void GISelCSEInfo::print ( )

Definition at line 247 of file CSEInfo.cpp.

References llvm::dbgs().

◆ recordNewInstruction()

void GISelCSEInfo::recordNewInstruction ( MachineInstr MI)

Records a newly created inst in a list and lazily insert it to the CSEMap.

Sometimes, this method might be called with a partially constructed MachineInstr,

Definition at line 158 of file CSEInfo.cpp.

References llvm::dbgs(), llvm::MachineInstr::getOpcode(), and LLVM_DEBUG.

◆ releaseMemory()

void GISelCSEInfo::releaseMemory ( )

Definition at line 233 of file CSEInfo.cpp.

References MRI.

Referenced by llvm::GISelCSEAnalysisWrapper::releaseMemory().

◆ setCSEConfig()

void llvm::GISelCSEInfo::setCSEConfig ( std::unique_ptr< CSEConfig Opt)
inline

Definition at line 142 of file CSEInfo.h.

References MI, and print().

◆ setMF()

void GISelCSEInfo::setMF ( MachineFunction MF)


-----— GISelCSEInfo ----------—//

Definition at line 67 of file CSEInfo.cpp.

References llvm::MachineFunction::getRegInfo(), and MRI.

Referenced by llvm::IRTranslator::runOnMachineFunction().

◆ shouldCSE()

bool GISelCSEInfo::shouldCSE ( unsigned  Opc) const

Definition at line 202 of file CSEInfo.cpp.

References assert(), and llvm::isPreISelGenericOpcode().

Friends And Related Function Documentation

◆ CSEMIRBuilder

friend class CSEMIRBuilder
friend

Definition at line 71 of file CSEInfo.h.


The documentation for this class was generated from the following files: