Cleanup the formatting of this header. This removes the namespace indent

and reformats a few constructors using clang-format. Only whitespace
changes here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173018 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chandler Carruth
2013-01-21 10:08:42 +00:00
parent 77c27f4394
commit 4ef13242ab

View File

@@ -19,12 +19,11 @@
#include <climits>
namespace llvm {
class CallSite;
class DataLayout;
class Function;
class CallSite;
class DataLayout;
class Function;
namespace InlineConstants {
namespace InlineConstants {
// Various magic constants used to adjust heuristics.
const int InstrCost = 5;
const int IndirectCallThreshold = 100;
@@ -35,19 +34,19 @@ namespace llvm {
/// Do not inline functions which allocate this many bytes on the stack
/// when the caller is recursive.
const unsigned TotalAllocaSizeRecursiveCaller = 1024;
}
}
/// \brief Represents the cost of inlining a function.
///
/// This supports special values for functions which should "always" or
/// "never" be inlined. Otherwise, the cost represents a unitless amount;
/// smaller values increase the likelihood of the function being inlined.
///
/// Objects of this type also provide the adjusted threshold for inlining
/// based on the information available for a particular callsite. They can be
/// directly tested to determine if inlining should occur given the cost and
/// threshold for this cost metric.
class InlineCost {
/// \brief Represents the cost of inlining a function.
///
/// This supports special values for functions which should "always" or
/// "never" be inlined. Otherwise, the cost represents a unitless amount;
/// smaller values increase the likelihood of the function being inlined.
///
/// Objects of this type also provide the adjusted threshold for inlining
/// based on the information available for a particular callsite. They can be
/// directly tested to determine if inlining should occur given the cost and
/// threshold for this cost metric.
class InlineCost {
enum SentinelValues {
AlwaysInlineCost = INT_MIN,
NeverInlineCost = INT_MAX
@@ -60,10 +59,9 @@ namespace llvm {
const int Threshold;
// Trivial constructor, interesting logic in the factory functions below.
InlineCost(int Cost, int Threshold)
: Cost(Cost), Threshold(Threshold) {}
InlineCost(int Cost, int Threshold) : Cost(Cost), Threshold(Threshold) {}
public:
public:
static InlineCost get(int Cost, int Threshold) {
assert(Cost > AlwaysInlineCost && "Cost crosses sentinel value");
assert(Cost < NeverInlineCost && "Cost crosses sentinel value");
@@ -96,15 +94,15 @@ namespace llvm {
/// Only valid if the cost is of the variable kind. Returns a negative
/// value if the cost is too high to inline.
int getCostDelta() const { return Threshold - getCost(); }
};
};
/// InlineCostAnalyzer - Cost analyzer used by inliner.
class InlineCostAnalyzer {
/// InlineCostAnalyzer - Cost analyzer used by inliner.
class InlineCostAnalyzer {
// DataLayout if available, or null.
const DataLayout *TD;
public:
InlineCostAnalyzer(): TD(0) {}
public:
InlineCostAnalyzer() : TD(0) {}
void setDataLayout(const DataLayout *TData) { TD = TData; }
@@ -128,7 +126,8 @@ namespace llvm {
/// \brief Minimal filter to detect invalid constructs for inlining.
bool isInlineViable(Function &Callee);
};
};
}
#endif