16#ifndef LLVM_CODEGEN_VIRTREGMAP_H
17#define LLVM_CODEGEN_VIRTREGMAP_H
30class MachineRegisterInfo;
75 assert(MF &&
"getMachineFunction called before runOnMachineFunction");
92 return Virt2PhysMap[virtReg];
102 return Virt2ShapeMap.
contains(virtReg);
107 return Virt2ShapeMap.
lookup(virtReg);
111 Virt2ShapeMap[virtReg] = shape;
118 assert(Virt2PhysMap[virtReg] &&
119 "attempt to clear a not assigned virtual register");
125 Virt2PhysMap.
clear();
139 Virt2SplitMap[virtReg] = SReg;
141 Virt2ShapeMap[virtReg] =
getShape(SReg);
147 return Virt2SplitMap[virtReg];
156 return Orig ? Orig : VirtReg;
166 return (Virt2SplitMap[virtReg] && Virt2PhysMap[virtReg]);
173 return Virt2StackSlotMap[virtReg];
unsigned const MachineRegisterInfo * MRI
This header defines various interfaces for pass management in LLVM.
This file implements an indexed map.
unsigned const TargetRegisterInfo * TRI
ModuleAnalysisManager MAM
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A container for analyses that lazily runs them and caches their results.
Represent the analysis usage information of a pass.
void setPreservesAll()
Set by analyses that do not transform their input at all.
ValueT lookup(const_arg_type_t< KeyT > Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
bool contains(const_arg_type_t< KeyT > Val) const
Return true if the specified key is in the map, false otherwise.
Wrapper class representing physical registers. Should be passed by value.
constexpr bool isValid() const
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
A Module instance is used to store all the information related to an LLVM module.
A set of analyses that are preserved following a run of a transformation pass.
Wrapper class representing virtual and physical registers.
constexpr bool isVirtual() const
Return true if the specified register number is in the virtual register namespace.
TargetInstrInfo - Interface to description of machine instruction set.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
VirtRegMap run(MachineFunction &MF, MachineFunctionAnalysisManager &MAM)
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
VirtRegMapPrinterPass(raw_ostream &OS)
VirtRegMapWrapperLegacy()
const VirtRegMap & getVRM() const
void print(raw_ostream &OS, const Module *M=nullptr) const override
print - Print out the internal state of the pass.
bool runOnMachineFunction(MachineFunction &MF) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
bool hasKnownPreference(Register VirtReg) const
returns true if VirtReg has a known preferred register.
void init(MachineFunction &MF)
int assignVirt2StackSlot(Register virtReg)
create a mapping for the specifed virtual register to the next available stack slot
void clearVirt(Register virtReg)
clears the specified virtual register's, physical register mapping
int getStackSlot(Register virtReg) const
returns the stack slot mapped to the specified virtual register
void clearAllVirt()
clears all virtual to physical register mappings
void setIsSplitFromReg(Register virtReg, Register SReg)
records virtReg is a split live interval from SReg.
bool hasShape(Register virtReg) const
bool hasPreferredPhys(Register VirtReg) const
returns true if VirtReg is assigned to its preferred physreg.
Register getOriginal(Register VirtReg) const
getOriginal - Return the original virtual register that VirtReg descends from through splitting.
Register getPreSplitReg(Register virtReg) const
returns the live interval virtReg is split from.
MachineRegisterInfo & getRegInfo() const
ShapeT getShape(Register virtReg) const
MachineFunction & getMachineFunction() const
MCRegister getPhys(Register virtReg) const
returns the physical register mapped to the specified virtual register
void print(raw_ostream &OS, const Module *M=nullptr) const
VirtRegMap(VirtRegMap &&)=default
VirtRegMap(const VirtRegMap &)=delete
bool hasPhys(Register virtReg) const
returns true if the specified virtual register is mapped to a physical register
void assignVirt2Shape(Register virtReg, ShapeT shape)
bool isAssignedReg(Register virtReg) const
returns true if the specified virtual register is not mapped to a stack slot or rematerialized.
static constexpr int NO_STACK_SLOT
const TargetRegisterInfo & getTargetRegInfo() const
VirtRegMap & operator=(const VirtRegMap &)=delete
void assignVirt2Phys(Register virtReg, MCPhysReg physReg)
creates a mapping for the specified virtual register to the specified physical register
bool isShapeMapEmpty() const
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
A CRTP mix-in that provides informational APIs needed for analysis passes.
A special type used by analysis passes to provide an address that identifies that particular analysis...
A CRTP mix-in to automatically provide informational APIs needed for passes.