36 cl::desc(
"print register usage details collected for analysis."));
39 "Register Usage Information Storage",
false,
true)
48 RegMasks.grow(M.
size());
56 RegMasks.shrink_and_clear();
62 RegMasks[&FP] = RegMask;
67 auto It = RegMasks.find(&FP);
68 if (It != RegMasks.end())
69 return makeArrayRef<uint32_t>(It->second);
74 using FuncPtrRegMaskPair = std::pair<const Function *, std::vector<uint32_t>>;
79 for (
const auto &RegMask : RegMasks)
84 FPRMPairVector.
begin(), FPRMPairVector.
end(),
85 [](
const FuncPtrRegMaskPair *A,
const FuncPtrRegMaskPair *
B) ->
bool {
86 return A->first->getName() <
B->first->getName();
89 for (
const FuncPtrRegMaskPair *FPRMPair : FPRMPairVector) {
90 OS << FPRMPair->first->getName() <<
" " 91 <<
"Clobbered Registers: ";
96 for (
unsigned PReg = 1, PRegE = TRI->
getNumRegs(); PReg < PRegE; ++PReg) {
void push_back(const T &Elt)
ArrayRef< uint32_t > getRegUsageInfo(const Function &FP)
To query stored RegMask for given Function *, it will returns ane empty array if function is not know...
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
Compute iterated dominance frontiers using a linear time algorithm.
A Module instance is used to store all the information related to an LLVM module. ...
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
void print(raw_ostream &OS, const Module *M=nullptr) const override
print - Print out the internal state of the pass.
bool doInitialization(Module &M) override
doInitialization - Virtual method overridden by subclasses to do any necessary initialization before ...
bool doFinalization(Module &M) override
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...
unsigned const TargetRegisterInfo * TRI
Printable printReg(unsigned Reg, const TargetRegisterInfo *TRI=nullptr, unsigned SubIdx=0, const MachineRegisterInfo *MRI=nullptr)
Prints virtual and physical registers with or without a TRI instance.
static cl::opt< bool > DumpRegUsage("print-regusage", cl::init(false), cl::Hidden, cl::desc("print register usage details collected for analysis."))
void storeUpdateRegUsageInfo(const Function &FP, ArrayRef< uint32_t > RegMask)
To store RegMask for given Function *.
unsigned getNumRegs() const
Return the number of registers this target has (useful for sizing arrays holding per register informa...
initializer< Ty > init(const Ty &Val)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
void sort(IteratorTy Start, IteratorTy End)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Module.h This file contains the declarations for the Module class.
static bool clobbersPhysReg(const uint32_t *RegMask, unsigned PhysReg)
clobbersPhysReg - Returns true if this RegMask clobbers PhysReg.
TargetSubtargetInfo - Generic base class for all target subtargets.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
This pass is required to take advantage of the interprocedural register allocation infrastructure...
This class implements an extremely fast bulk output stream that can only output to a stream...
Primary interface to the complete machine description for the target machine.
const STC & getSubtarget(const Function &F) const
This method returns a pointer to the specified type of TargetSubtargetInfo.