mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-21 03:05:26 -04:00
Interface to attach maximum function count from PGO to module as module flags.
This provides interface to get and set maximum function counts to Module. This would allow things like determination of function hotness. The actual setting of this max function count will have to be done in the frontend. Differential Revision: http://reviews.llvm.org/D15003 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254647 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -491,3 +491,15 @@ PICLevel::Level Module::getPICLevel() const {
|
||||
void Module::setPICLevel(PICLevel::Level PL) {
|
||||
addModuleFlag(ModFlagBehavior::Error, "PIC Level", PL);
|
||||
}
|
||||
|
||||
void Module::setMaximumFunctionCount(uint64_t Count) {
|
||||
addModuleFlag(ModFlagBehavior::Error, "MaxFunctionCount", Count);
|
||||
}
|
||||
|
||||
Optional<uint64_t> Module::getMaximumFunctionCount() {
|
||||
auto *Val =
|
||||
cast_or_null<ConstantAsMetadata>(getModuleFlag("MaxFunctionCount"));
|
||||
if (!Val)
|
||||
return None;
|
||||
return cast<ConstantInt>(Val->getValue())->getZExtValue();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user