Go to the documentation of this file.
28 "Reads and parses a basic block sections profile.",
false,
35 std::pair<bool, SmallVector<BBClusterInfo>>
38 std::pair<bool, SmallVector<BBClusterInfo>> cluster_info(
false, {});
39 auto R = ProgramBBClusterInfo.
find(getAliasName(FuncName));
40 if (R != ProgramBBClusterInfo.
end()) {
41 cluster_info.second =
R->second;
42 cluster_info.first =
true;
66 auto invalidProfileError = [&](
auto Message) {
67 return make_error<StringError>(
69 Twine(LineIt.line_number()) +
": " + Message),
73 auto FI = ProgramBBClusterInfo.
end();
76 unsigned CurrentCluster = 0;
78 unsigned CurrentPosition = 0;
84 for (; !LineIt.is_at_eof(); ++LineIt) {
89 if (!
S.consume_front(
"!") ||
S.empty())
92 if (
S.consume_front(
"!")) {
93 if (FI == ProgramBBClusterInfo.
end())
94 return invalidProfileError(
95 "Cluster list does not follow a function name specifier.");
97 S.split(BBIndexes,
' ');
100 for (
auto BBIndexStr : BBIndexes) {
101 unsigned long long BBIndex;
103 return invalidProfileError(
Twine(
"Unsigned integer expected: '") +
105 if (!FuncBBIDs.
insert(BBIndex).second)
106 return invalidProfileError(
Twine(
"Duplicate basic block id found '") +
108 if (!BBIndex && CurrentPosition)
109 return invalidProfileError(
"Entry BB (0) does not begin a cluster.");
112 ((unsigned)BBIndex), CurrentCluster, CurrentPosition++});
120 S.split(Aliases,
'/');
121 for (
size_t i = 1;
i < Aliases.size(); ++
i)
126 FI = ProgramBBClusterInfo.
try_emplace(Aliases.front()).first;
137 if (
auto Err = getBBClusterInfo(MBuf, ProgramBBClusterInfo, FuncAliasMap))
This is an optimization pass for GlobalISel generic memory operations.
A forward iterator which reads text lines from a buffer.
ImmutablePass class - This class is used to provide information that does not need to be run.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
static ErrorSuccess success()
Create a success value.
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
iterator find(StringRef Key)
This interface provides simple read-only access to a block of memory, and provides simple methods for...
ImmutablePass * createBasicBlockSectionsProfileReaderPass(const MemoryBuffer *Buf)
bool getBBClusterInfoForFunction(const MachineFunction &MF, BasicBlockSectionsProfileReader *BBSectionsProfileReader, std::vector< Optional< BBClusterInfo >> &V)
bool getAsUnsignedInteger(StringRef Str, unsigned Radix, unsigned long long &Result)
Helper functions for StringRef::getAsInteger.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
INITIALIZE_PASS(BasicBlockSectionsProfileReader, "bbsections-profile-reader", "Reads and parses a basic block sections profile.", false, false) bool BasicBlockSectionsProfileReader
virtual StringRef getBufferIdentifier() const
Return an identifier for this buffer, typically the filename it was read from.
void initializePass() override
Read profiles of basic blocks if available here.
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringRef - Represent a constant reference to a string, i.e.
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
Lightweight error class with error context and mandatory checking.
std::pair< bool, SmallVector< BBClusterInfo > > getBBClusterInfoForFunction(StringRef FuncName) const
std::pair< const_iterator, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
std::pair< iterator, bool > try_emplace(StringRef Key, ArgsTy &&... Args)
Emplace a new element for the specified key into the map if the key isn't already in the map.