[PATCH] D17894: Interface to get/set profile summary metadata to module

Easwaran Raman via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 4 13:26:54 PST 2016


eraman created this revision.
eraman added a reviewer: davidxl.
eraman added a subscriber: llvm-commits.

This is the first in a  series of patches to remove MaxFunctionCount metadata from module and add profile summary metadata instead. 

http://reviews.llvm.org/D17894

Files:
  include/llvm/IR/Module.h
  lib/IR/Module.cpp

Index: lib/IR/Module.cpp
===================================================================
--- lib/IR/Module.cpp
+++ lib/IR/Module.cpp
@@ -485,3 +485,11 @@
     return None;
   return cast<ConstantInt>(Val->getValue())->getZExtValue();
 }
+
+void Module::setProfileSummary(Metadata *M) {
+  addModuleFlag(ModFlagBehavior::Error, "ProfileSummary", M);
+}
+
+Metadata *Module::getProfileSummary() {
+  return getModuleFlag("ProfileSummary");
+}
Index: include/llvm/IR/Module.h
===================================================================
--- include/llvm/IR/Module.h
+++ include/llvm/IR/Module.h
@@ -639,14 +639,20 @@
   void setPICLevel(PICLevel::Level PL);
 /// @}
 
-  /// @name Utility functions for querying and setting PGO counts
+  /// @name Utility functions for querying and setting PGO summary
   /// @{
 
   /// \brief Set maximum function count in PGO mode
   void setMaximumFunctionCount(uint64_t);
 
   /// \brief Returns maximum function count in PGO mode
   Optional<uint64_t> getMaximumFunctionCount();
+
+  /// \brief Attach profile summary metadata to this module.
+  void setProfileSummary(Metadata *M);
+
+  /// \brief Returns profile summary metadata
+  Metadata *getProfileSummary();
   /// @}
 };
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17894.49847.patch
Type: text/x-patch
Size: 1230 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160304/45cea59c/attachment.bin>


More information about the llvm-commits mailing list