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 llvm-svn: 254647
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