|
LLVM
3.7.0
|
#include "RegisterCoalescer.h"#include "llvm/ADT/STLExtras.h"#include "llvm/ADT/SmallSet.h"#include "llvm/ADT/Statistic.h"#include "llvm/Analysis/AliasAnalysis.h"#include "llvm/CodeGen/LiveIntervalAnalysis.h"#include "llvm/CodeGen/LiveRangeEdit.h"#include "llvm/CodeGen/MachineFrameInfo.h"#include "llvm/CodeGen/MachineInstr.h"#include "llvm/CodeGen/MachineLoopInfo.h"#include "llvm/CodeGen/MachineRegisterInfo.h"#include "llvm/CodeGen/Passes.h"#include "llvm/CodeGen/RegisterClassInfo.h"#include "llvm/CodeGen/VirtRegMap.h"#include "llvm/IR/Value.h"#include "llvm/Pass.h"#include "llvm/Support/CommandLine.h"#include "llvm/Support/Debug.h"#include "llvm/Support/ErrorHandling.h"#include "llvm/Support/Format.h"#include "llvm/Support/raw_ostream.h"#include "llvm/Target/TargetInstrInfo.h"#include "llvm/Target/TargetMachine.h"#include "llvm/Target/TargetRegisterInfo.h"#include "llvm/Target/TargetSubtargetInfo.h"#include <algorithm>#include <cmath>Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "regalloc" |
Functions | |
| STATISTIC (numJoins,"Number of interval joins performed") | |
| STATISTIC (numCrossRCs,"Number of cross class joins performed") | |
| STATISTIC (numCommutes,"Number of instruction commuting performed") | |
| STATISTIC (numExtends,"Number of copies extended") | |
| STATISTIC (NumReMats,"Number of instructions re-materialized") | |
| STATISTIC (NumInflated,"Number of register classes inflated") | |
| STATISTIC (NumLaneConflicts,"Number of dead lane conflicts tested") | |
| STATISTIC (NumLaneResolves,"Number of dead lane conflicts resolved") | |
| INITIALIZE_PASS_BEGIN (RegisterCoalescer,"simple-register-coalescing","Simple Register Coalescing", false, false) INITIALIZE_PASS_END(RegisterCoalescer | |
| static bool | isMoveInstr (const TargetRegisterInfo &tri, const MachineInstr *MI, unsigned &Src, unsigned &Dst, unsigned &SrcSub, unsigned &DstSub) |
| static bool | isSplitEdge (const MachineBasicBlock *MBB) |
| Return true if this block should be vacated by the coalescer to eliminate branches. More... | |
| static void | addSegmentsWithValNo (LiveRange &Dst, VNInfo *DstValNo, const LiveRange &Src, const VNInfo *SrcValNo) |
Copy segements with value number SrcValNo from liverange Src to live range and use value number DstValNo there. More... | |
| static bool | definesFullReg (const MachineInstr &MI, unsigned Reg) |
Returns true if MI defines the full vreg Reg, as opposed to just defining a subregister. More... | |
| static int | compareMBBPriority (const MBBPriorityInfo *LHS, const MBBPriorityInfo *RHS) |
| C-style comparator that sorts first based on the loop depth of the basic block (the unsigned), and then on the MBB number. More... | |
| static bool | isLocalCopy (MachineInstr *Copy, const LiveIntervals *LIS) |
| static bool | isTerminalReg (unsigned DstReg, const MachineInstr &Copy, const MachineRegisterInfo *MRI) |
| Check if DstReg is a terminal node. More... | |
Variables | |
| static cl::opt< bool > | EnableJoining ("join-liveintervals", cl::desc("Coalesce copies (default=true)"), cl::init(true)) |
| static cl::opt< bool > | UseTerminalRule ("terminal-rule", cl::desc("Apply the terminal rule"), cl::init(false), cl::Hidden) |
| static cl::opt< bool > | EnableJoinSplits ("join-splitedges", cl::desc("Coalesce copies on split edges (default=subtarget)"), cl::Hidden) |
| Temporary flag to test critical edge unsplitting. More... | |
| static cl::opt< cl::boolOrDefault > | EnableGlobalCopies ("join-globalcopies", cl::desc("Coalesce copies that span blocks (default=subtarget)"), cl::init(cl::BOU_UNSET), cl::Hidden) |
| Temporary flag to test global copy optimization. More... | |
| static cl::opt< bool > | VerifyCoalescing ("verify-coalescing", cl::desc("Verify machine instrs before and after register coalescing"), cl::Hidden) |
| simple register | coalescing |
| simple register Simple Register | Coalescing |
| simple register Simple Register | false |
| #define DEBUG_TYPE "regalloc" |
Definition at line 45 of file RegisterCoalescer.cpp.
|
static |
Copy segements with value number SrcValNo from liverange Src to live range and use value number DstValNo there.
Definition at line 620 of file RegisterCoalescer.cpp.
References llvm::LiveRange::addSegment(), llvm::LiveRange::Segment::end, llvm::LiveRange::segments, llvm::LiveRange::Segment::start, and llvm::LiveRange::Segment::valno.
C-style comparator that sorts first based on the loop depth of the basic block (the unsigned), and then on the MBB number.
EnableGlobalCopies assumes that the primary sort key is loop depth.
Definition at line 2715 of file RegisterCoalescer.cpp.
|
static |
Returns true if MI defines the full vreg Reg, as opposed to just defining a subregister.
Definition at line 866 of file RegisterCoalescer.cpp.
References llvm::TargetRegisterInfo::isPhysicalRegister(), and llvm::MachineInstr::operands().
| INITIALIZE_PASS_BEGIN | ( | RegisterCoalescer | , |
| "simple-register-coalescing" | , | ||
| "Simple Register Coalescing" | , | ||
| false | , | ||
| false | |||
| ) |
|
static |
Definition at line 2737 of file RegisterCoalescer.cpp.
References llvm::LiveIntervals::getInterval(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::LiveIntervals::intervalIsInOneMBB(), llvm::MachineInstr::isCopy(), llvm::TargetRegisterInfo::isPhysicalRegister(), and llvm::MachineOperand::isUndef().
|
static |
Definition at line 284 of file RegisterCoalescer.cpp.
Referenced by llvm::CoalescerPair::isCoalescable(), and llvm::CoalescerPair::setRegisters().
|
static |
Return true if this block should be vacated by the coalescer to eliminate branches.
The important cases to handle in the coalescer are critical edges split during phi elimination which contain only copies. Simple blocks that contain non-branches should also be vacated, but this can be handled by an earlier pass similar to early if-conversion.
Definition at line 308 of file RegisterCoalescer.cpp.
References llvm::AArch64CC::MI, llvm::MachineBasicBlock::pred_size(), and llvm::MachineBasicBlock::succ_size().
|
static |
Check if DstReg is a terminal node.
I.e., it does not have any affinity other than Copy.
Definition at line 2777 of file RegisterCoalescer.cpp.
References llvm::MachineInstr::isCopyLike(), and llvm::MachineRegisterInfo::reg_nodbg_instructions().
| STATISTIC | ( | numJoins | , |
| "Number of interval joins performed" | |||
| ) |
| STATISTIC | ( | numCrossRCs | , |
| "Number of cross class joins performed" | |||
| ) |
| STATISTIC | ( | numCommutes | , |
| "Number of instruction commuting performed" | |||
| ) |
| STATISTIC | ( | numExtends | , |
| "Number of copies extended" | |||
| ) |
| STATISTIC | ( | NumReMats | , |
| "Number of instructions re-materialized" | |||
| ) |
| STATISTIC | ( | NumInflated | , |
| "Number of register classes inflated" | |||
| ) |
| STATISTIC | ( | NumLaneConflicts | , |
| "Number of dead lane conflicts tested" | |||
| ) |
| STATISTIC | ( | NumLaneResolves | , |
| "Number of dead lane conflicts resolved" | |||
| ) |
| simple register coalescing |
Definition at line 279 of file RegisterCoalescer.cpp.
| simple register Simple Register Coalescing |
Definition at line 279 of file RegisterCoalescer.cpp.
|
static |
Temporary flag to test global copy optimization.
|
static |
|
static |
Temporary flag to test critical edge unsplitting.
| simple register Simple Register false |
Definition at line 279 of file RegisterCoalescer.cpp.
|
static |
|
static |
1.8.6