Remove the 'N' modifier from llvm-ar.
[oota-llvm.git] / include / llvm / Analysis / InlineCost.h
index 5713fb44fcd69546c312f463cc99864d57399097..383f69713ad276458a43e207e53b8f37987b5b04 100644 (file)
@@ -14,7 +14,7 @@
 #ifndef LLVM_ANALYSIS_INLINECOST_H
 #define LLVM_ANALYSIS_INLINECOST_H
 
-#include "llvm/Analysis/CodeMetrics.h"
+#include "llvm/Analysis/CallGraphSCCPass.h"
 #include <cassert>
 #include <climits>
 
@@ -22,6 +22,7 @@ namespace llvm {
 class CallSite;
 class DataLayout;
 class Function;
+class TargetTransformInfo;
 
 namespace InlineConstants {
   // Various magic constants used to adjust heuristics.
@@ -75,7 +76,7 @@ public:
   }
 
   /// \brief Test whether the inline cost is low enough for inlining.
-  operator bool() const {
+  LLVM_EXPLICIT operator bool() const {
     return Cost < Threshold;
   }
 
@@ -96,15 +97,20 @@ public:
   int getCostDelta() const { return Threshold - getCost(); }
 };
 
-/// InlineCostAnalyzer - Cost analyzer used by inliner.
-class InlineCostAnalyzer {
-  // DataLayout if available, or null.
+/// \brief Cost analyzer used by inliner.
+class InlineCostAnalysis : public CallGraphSCCPass {
   const DataLayout *TD;
+  const TargetTransformInfo *TTI;
 
 public:
-  InlineCostAnalyzer() : TD(0) {}
+  static char ID;
 
-  void setDataLayout(const DataLayout *TData) { TD = TData; }
+  InlineCostAnalysis();
+  ~InlineCostAnalysis();
+
+  // Pass interface implementation.
+  void getAnalysisUsage(AnalysisUsage &AU) const;
+  bool runOnSCC(CallGraphSCC &SCC);
 
   /// \brief Get an InlineCost object representing the cost of inlining this
   /// callsite.
@@ -113,6 +119,9 @@ public:
   /// threshold are computed with any accuracy. The threshold can be used to
   /// bound the computation necessary to determine whether the cost is
   /// sufficiently low to warrant inlining.
+  ///
+  /// Also note that calling this function *dynamically* computes the cost of
+  /// inlining the callsite. It is an expensive, heavyweight call.
   InlineCost getInlineCost(CallSite CS, int Threshold);
 
   /// \brief Get an InlineCost with the callee explicitly specified.