mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-17 21:32:04 +00:00
the inliner pass now passes targetdata down through the inliner api's
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33677 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1dfdf8255e
commit
ff2dad3128
lib/Transforms/IPO
@ -19,6 +19,7 @@
|
|||||||
#include "llvm/Instructions.h"
|
#include "llvm/Instructions.h"
|
||||||
#include "llvm/Analysis/CallGraph.h"
|
#include "llvm/Analysis/CallGraph.h"
|
||||||
#include "llvm/Support/CallSite.h"
|
#include "llvm/Support/CallSite.h"
|
||||||
|
#include "llvm/Target/TargetData.h"
|
||||||
#include "llvm/Transforms/Utils/Cloning.h"
|
#include "llvm/Transforms/Utils/Cloning.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
@ -37,12 +38,21 @@ namespace {
|
|||||||
|
|
||||||
Inliner::Inliner() : InlineThreshold(InlineLimit) {}
|
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,
|
// InlineCallIfPossible - If it is possible to inline the specified call site,
|
||||||
// do so and update the CallGraph for this operation.
|
// do so and update the CallGraph for this operation.
|
||||||
static bool InlineCallIfPossible(CallSite CS, CallGraph &CG,
|
static bool InlineCallIfPossible(CallSite CS, CallGraph &CG,
|
||||||
const std::set<Function*> &SCCFunctions) {
|
const std::set<Function*> &SCCFunctions,
|
||||||
|
const TargetData &TD) {
|
||||||
Function *Callee = CS.getCalledFunction();
|
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
|
// If we inlined the last possible call site to the function, delete the
|
||||||
// function body now.
|
// function body now.
|
||||||
@ -134,7 +144,8 @@ bool Inliner::runOnSCC(const std::vector<CallGraphNode*> &SCC) {
|
|||||||
<< ", Call: " << *CS.getInstruction();
|
<< ", Call: " << *CS.getInstruction();
|
||||||
|
|
||||||
// Attempt to inline the function...
|
// 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
|
// Remove this call site from the list. If possible, use
|
||||||
// swap/pop_back for efficiency, but do not use it if doing so would
|
// 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
|
// move a call site to a function in this SCC before the
|
||||||
|
@ -29,6 +29,11 @@ namespace llvm {
|
|||||||
struct Inliner : public CallGraphSCCPass {
|
struct Inliner : public CallGraphSCCPass {
|
||||||
Inliner();
|
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
|
// Main run interface method, this implements the interface required by the
|
||||||
// Pass class.
|
// Pass class.
|
||||||
virtual bool runOnSCC(const std::vector<CallGraphNode *> &SCC);
|
virtual bool runOnSCC(const std::vector<CallGraphNode *> &SCC);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user