[PATCH] D15003: Interface to attach maximum function count from PGO to module as module flags.
Easwaran Raman via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 3 13:00:42 PST 2015
This revision was automatically updated to reflect the committed changes.
Closed by commit rL254647: Interface to attach maximum function count from PGO to module as module flags. (authored by eraman).
Changed prior to commit:
http://reviews.llvm.org/D15003?vs=41661&id=41791#toc
Repository:
rL LLVM
http://reviews.llvm.org/D15003
Files:
llvm/trunk/include/llvm/IR/Module.h
llvm/trunk/lib/IR/Module.cpp
Index: llvm/trunk/lib/IR/Module.cpp
===================================================================
--- llvm/trunk/lib/IR/Module.cpp
+++ llvm/trunk/lib/IR/Module.cpp
@@ -491,3 +491,15 @@
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();
+}
Index: llvm/trunk/include/llvm/IR/Module.h
===================================================================
--- llvm/trunk/include/llvm/IR/Module.h
+++ llvm/trunk/include/llvm/IR/Module.h
@@ -15,6 +15,7 @@
#ifndef LLVM_IR_MODULE_H
#define LLVM_IR_MODULE_H
+#include "llvm/ADT/Optional.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/IR/Comdat.h"
#include "llvm/IR/DataLayout.h"
@@ -639,6 +640,16 @@
/// \brief Set the PIC level (small or large model)
void setPICLevel(PICLevel::Level PL);
/// @}
+
+ /// @name Utility functions for querying and setting PGO counts
+ /// @{
+
+ /// \brief Set maximum function count in PGO mode
+ void setMaximumFunctionCount(uint64_t);
+
+ /// \brief Returns maximum function count in PGO mode
+ Optional<uint64_t> getMaximumFunctionCount();
+ /// @}
};
/// An raw_ostream inserter for modules.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15003.41791.patch
Type: text/x-patch
Size: 1539 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151203/376cd23a/attachment.bin>
More information about the llvm-commits
mailing list