[llvm-commits] CVS: llvm/lib/Transforms/IPO/Inliner.cpp Inliner.h
Chris Lattner
sabre at nondot.org
Tue Jan 30 15:28:55 PST 2007
Changes in directory llvm/lib/Transforms/IPO:
Inliner.cpp updated: 1.36 -> 1.37
Inliner.h updated: 1.8 -> 1.9
---
Log message:
the inliner pass now passes targetdata down through the inliner api's
---
Diffs of the changes: (+19 -3)
Inliner.cpp | 17 ++++++++++++++---
Inliner.h | 5 +++++
2 files changed, 19 insertions(+), 3 deletions(-)
Index: llvm/lib/Transforms/IPO/Inliner.cpp
diff -u llvm/lib/Transforms/IPO/Inliner.cpp:1.36 llvm/lib/Transforms/IPO/Inliner.cpp:1.37
--- llvm/lib/Transforms/IPO/Inliner.cpp:1.36 Tue Jan 30 14:08:38 2007
+++ llvm/lib/Transforms/IPO/Inliner.cpp Tue Jan 30 17:28:39 2007
@@ -19,6 +19,7 @@
#include "llvm/Instructions.h"
#include "llvm/Analysis/CallGraph.h"
#include "llvm/Support/CallSite.h"
+#include "llvm/Target/TargetData.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
@@ -37,12 +38,21 @@
Inliner::Inliner() : InlineThreshold(InlineLimit) {}
+/// getAnalysisUsage - For this class, we declare that we require and preserve
+/// the call graph. If the derived class implements this method, it should
+/// always explicitly call the implementation here.
+void Inliner::getAnalysisUsage(AnalysisUsage &Info) const {
+ Info.addRequired<TargetData>();
+ CallGraphSCCPass::getAnalysisUsage(Info);
+}
+
// InlineCallIfPossible - If it is possible to inline the specified call site,
// do so and update the CallGraph for this operation.
static bool InlineCallIfPossible(CallSite CS, CallGraph &CG,
- const std::set<Function*> &SCCFunctions) {
+ const std::set<Function*> &SCCFunctions,
+ const TargetData &TD) {
Function *Callee = CS.getCalledFunction();
- if (!InlineFunction(CS, &CG)) return false;
+ if (!InlineFunction(CS, &CG, &TD)) return false;
// If we inlined the last possible call site to the function, delete the
// function body now.
@@ -134,7 +144,8 @@
<< ", Call: " << *CS.getInstruction();
// Attempt to inline the function...
- if (InlineCallIfPossible(CS, CG, SCCFunctions)) {
+ if (InlineCallIfPossible(CS, CG, SCCFunctions,
+ getAnalysis<TargetData>())) {
// Remove this call site from the list. If possible, use
// swap/pop_back for efficiency, but do not use it if doing so would
// move a call site to a function in this SCC before the
Index: llvm/lib/Transforms/IPO/Inliner.h
diff -u llvm/lib/Transforms/IPO/Inliner.h:1.8 llvm/lib/Transforms/IPO/Inliner.h:1.9
--- llvm/lib/Transforms/IPO/Inliner.h:1.8 Thu Apr 21 18:39:37 2005
+++ llvm/lib/Transforms/IPO/Inliner.h Tue Jan 30 17:28:39 2007
@@ -29,6 +29,11 @@
struct Inliner : public CallGraphSCCPass {
Inliner();
+ /// getAnalysisUsage - For this class, we declare that we require and preserve
+ /// the call graph. If the derived class implements this method, it should
+ /// always explicitly call the implementation here.
+ virtual void getAnalysisUsage(AnalysisUsage &Info) const;
+
// Main run interface method, this implements the interface required by the
// Pass class.
virtual bool runOnSCC(const std::vector<CallGraphNode *> &SCC);
More information about the llvm-commits
mailing list