31class DetailedRecordsEmitter {
55 printReportHeading(
OS);
59 printAllocationStats(
OS);
63void DetailedRecordsEmitter::printReportHeading(
raw_ostream &
OS) {
64 OS <<
formatv(
"DETAILED RECORDS for file {0}\n",
Records.getInputFilename());
68void DetailedRecordsEmitter::printSectionHeading(
StringRef Title,
int Count,
70 OS <<
formatv(
"\n{0} {1} ({2}) {0}\n",
"--------------------", Title, Count);
75 const auto GlobalList =
Records.getGlobals();
76 printSectionHeading(
"Global Variables", GlobalList.size(),
OS);
79 for (
const auto &Var : GlobalList)
80 OS << Var.first <<
" = " << Var.second->getAsString() <<
'\n';
85 const auto &ClassList =
Records.getClasses();
86 printSectionHeading(
"Classes", ClassList.size(),
OS);
88 for (
const auto &[
Name, Class] : ClassList) {
91 printTemplateArgs(*Class,
OS);
92 printSuperclasses(*Class,
OS);
93 printFields(*Class,
OS);
99 const auto &RecordList =
Records.getDefs();
100 printSectionHeading(
"Records", RecordList.size(),
OS);
102 for (
const auto &[DefName, Rec] : RecordList) {
103 std::string
Name = Rec->getNameInitAsString();
106 printDefms(*Rec,
OS);
107 printSuperclasses(*Rec,
OS);
108 printFields(*Rec,
OS);
113void DetailedRecordsEmitter::printAllocationStats(
raw_ostream &
OS) {
114 OS <<
formatv(
"\n{0} Memory Allocation Stats {0}\n",
"--------------------");
121 const auto &LocList = Rec.
getLoc();
122 if (LocList.size() < 2)
125 OS <<
" Defm sequence:";
132void DetailedRecordsEmitter::printTemplateArgs(
const Record &Rec,
136 OS <<
" Template args: (none)\n";
140 OS <<
" Template args:\n";
141 for (
const Init *ArgName : Args) {
143 assert(
Value &&
"Template argument value not found.");
153void DetailedRecordsEmitter::printSuperclasses(
const Record &Rec,
157 if (Superclasses.
empty()) {
158 OS <<
" Superclasses: (none)\n";
162 OS <<
" Superclasses:";
163 for (
const auto &[ClassRec, Loc] : Superclasses) {
165 OS <<
formatv(
" {0}", ClassRec->getNameInitAsString());
167 OS <<
formatv(
" ({0})", ClassRec->getNameInitAsString());
175 if (ValueList.empty()) {
176 OS <<
" Fields: (none)\n";
193 DetailedRecordsEmitter(RK).run(
OS);
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
bool empty() const
empty - Check if the array is empty.
This class represents a field in a record, including its name, type, value, and source location.
ArrayRef< std::pair< const Record *, SMRange > > getSuperClasses() const
ArrayRef< SMLoc > getLoc() const
const RecordVal * getValue(const Init *Name) const
bool hasDirectSuperClass(const Record *SuperClass) const
Determine whether this record has the specified direct superclass.
bool isTemplateArg(const Init *Name) const
ArrayRef< RecordVal > getValues() const
ArrayRef< const Init * > getTemplateArgs() const
Represents a location in source code.
std::string getFormattedLocationNoOffset(SMLoc Loc, bool IncludePath=false) const
Get a string with the SMLoc filename and line number formatted in the standard style.
StringRef - Represent a constant reference to a string, i.e.
LLVM Value Representation.
void print(raw_ostream &O, bool IsForDebug=false) const
Implement operator<< on Value.
This class implements an extremely fast bulk output stream that can only output to a stream.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
llvm::SmallVector< std::shared_ptr< RecordsSlice >, 4 > Records
PointerTypeMap run(const Module &M)
Compute the PointerTypeMap for the module M.
This is an optimization pass for GlobalISel generic memory operations.
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
auto reverse(ContainerTy &&C)
void EmitDetailedRecords(const RecordKeeper &RK, raw_ostream &OS)