LLVM 20.0.0git
Macros | Functions | Variables
TwoAddressInstructionPass.cpp File Reference
#include "llvm/CodeGen/TwoAddressInstructionPass.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/CodeGen/LiveInterval.h"
#include "llvm/CodeGen/LiveIntervals.h"
#include "llvm/CodeGen/LiveVariables.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/SlotIndexes.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetOpcodes.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/Pass.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
#include <cassert>
#include <iterator>
#include <utility>

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "twoaddressinstruction"
 

Functions

 STATISTIC (NumTwoAddressInstrs, "Number of two-address instructions")
 
 STATISTIC (NumCommuted, "Number of instructions commuted to coalesce")
 
 STATISTIC (NumAggrCommuted, "Number of instructions aggressively commuted")
 
 STATISTIC (NumConvertedTo3Addr, "Number of instructions promoted to 3-address")
 
 STATISTIC (NumReSchedUps, "Number of instructions re-scheduled up")
 
 STATISTIC (NumReSchedDowns, "Number of instructions re-scheduled down")
 
 INITIALIZE_PASS_BEGIN (TwoAddressInstructionLegacyPass, DEBUG_TYPE, "Two-Address instruction pass", false, false) INITIALIZE_PASS_END(TwoAddressInstructionLegacyPass
 
static bool isTwoAddrUse (MachineInstr &MI, Register Reg, Register &DstReg)
 Return true if the specified MI uses the specified register as a two-address use.
 
static MCRegister getMappedReg (Register Reg, DenseMap< Register, Register > &RegMap)
 Return the physical register the specified virtual register might be mapped to.
 

Variables

static cl::opt< boolEnableRescheduling ("twoaddr-reschedule", cl::desc("Coalesce copies by rescheduling (default=true)"), cl::init(true), cl::Hidden)
 
static cl::opt< unsignedMaxDataFlowEdge ("dataflow-edge-limit", cl::Hidden, cl::init(3), cl::desc("Maximum number of dataflow edges to traverse when evaluating " "the benefit of commuting operands"))
 
 DEBUG_TYPE
 
Two Address instruction pass
 
Two Address instruction false
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "twoaddressinstruction"

Definition at line 68 of file TwoAddressInstructionPass.cpp.

Function Documentation

◆ getMappedReg()

static MCRegister getMappedReg ( Register  Reg,
DenseMap< Register, Register > &  RegMap 
)
static

Return the physical register the specified virtual register might be mapped to.

Definition at line 530 of file TwoAddressInstructionPass.cpp.

References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find().

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( TwoAddressInstructionLegacyPass  ,
DEBUG_TYPE  ,
"Two-Address instruction pass"  ,
false  ,
false   
)

◆ isTwoAddrUse()

static bool isTwoAddrUse ( MachineInstr MI,
Register  Reg,
Register DstReg 
)
static

Return true if the specified MI uses the specified register as a two-address use.

If so, return the destination register by reference.

Definition at line 471 of file TwoAddressInstructionPass.cpp.

References llvm::MachineOperand::getReg(), llvm::MachineOperand::isReg(), llvm::MachineOperand::isUse(), and MI.

◆ STATISTIC() [1/6]

STATISTIC ( NumAggrCommuted  ,
"Number of instructions aggressively commuted"   
)

◆ STATISTIC() [2/6]

STATISTIC ( NumCommuted  ,
"Number of instructions commuted to coalesce"   
)

◆ STATISTIC() [3/6]

STATISTIC ( NumConvertedTo3Addr  ,
"Number of instructions promoted to 3-address"   
)

◆ STATISTIC() [4/6]

STATISTIC ( NumReSchedDowns  ,
"Number of instructions re-scheduled down"   
)

◆ STATISTIC() [5/6]

STATISTIC ( NumReSchedUps  ,
"Number of instructions re-scheduled up"   
)

◆ STATISTIC() [6/6]

STATISTIC ( NumTwoAddressInstrs  ,
"Number of two-address instructions"   
)

Variable Documentation

◆ DEBUG_TYPE

DEBUG_TYPE

Definition at line 263 of file TwoAddressInstructionPass.cpp.

◆ EnableRescheduling

cl::opt< bool > EnableRescheduling("twoaddr-reschedule", cl::desc("Coalesce copies by rescheduling (default=true)"), cl::init(true), cl::Hidden) ( "twoaddr-reschedule"  ,
cl::desc("Coalesce copies by rescheduling (default=true)")  ,
cl::init(true ,
cl::Hidden   
)
static

◆ false

Two Address instruction false

Definition at line 264 of file TwoAddressInstructionPass.cpp.

◆ MaxDataFlowEdge

cl::opt< unsigned > MaxDataFlowEdge("dataflow-edge-limit", cl::Hidden, cl::init(3), cl::desc("Maximum number of dataflow edges to traverse when evaluating " "the benefit of commuting operands")) ( "dataflow-edge-limit"  ,
cl::Hidden  ,
cl::init(3)  ,
cl::desc("Maximum number of dataflow edges to traverse when evaluating " "the benefit of commuting operands")   
)
static

◆ pass

Two Address instruction pass

Definition at line 264 of file TwoAddressInstructionPass.cpp.