forked from OSchip/llvm-project
Assorted comment/naming fixes, 80-col violations, and reindentation.
- No functionality change. llvm-svn: 58352
This commit is contained in:
parent
2c34c130bf
commit
cc20455346
|
|
@ -11,8 +11,8 @@
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#ifndef INLINECOST_H
|
#ifndef LLVM_TRANSFORMS_UTILS_INLINECOST_H
|
||||||
#define INLINECOST_H
|
#define LLVM_TRANSFORMS_UTILS_INLINECOST_H
|
||||||
|
|
||||||
#include "llvm/ADT/SmallPtrSet.h"
|
#include "llvm/ADT/SmallPtrSet.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
@ -46,7 +46,7 @@ namespace llvm {
|
||||||
/// is used to estimate the code size cost of inlining it.
|
/// is used to estimate the code size cost of inlining it.
|
||||||
unsigned NumInsts, NumBlocks;
|
unsigned NumInsts, NumBlocks;
|
||||||
|
|
||||||
/// NumVectorInsts - Keep track how many instrctions produce vector
|
/// NumVectorInsts - Keep track of how many instructions produce vector
|
||||||
/// values. The inliner is being more aggressive with inlining vector
|
/// values. The inliner is being more aggressive with inlining vector
|
||||||
/// kernels.
|
/// kernels.
|
||||||
unsigned NumVectorInsts;
|
unsigned NumVectorInsts;
|
||||||
|
|
|
||||||
|
|
@ -51,14 +51,13 @@ namespace {
|
||||||
|
|
||||||
char AlwaysInliner::ID = 0;
|
char AlwaysInliner::ID = 0;
|
||||||
static RegisterPass<AlwaysInliner>
|
static RegisterPass<AlwaysInliner>
|
||||||
X("always-inline", "Inliner that handles always_inline functions");
|
X("always-inline", "Inliner for always_inline functions");
|
||||||
|
|
||||||
Pass *llvm::createAlwaysInlinerPass() { return new AlwaysInliner(); }
|
Pass *llvm::createAlwaysInlinerPass() { return new AlwaysInliner(); }
|
||||||
|
|
||||||
// doInitialization - Initializes the vector of functions that have not
|
// doInitialization - Initializes the vector of functions that have not
|
||||||
// been annotated with the "always inline" attribute.
|
// been annotated with the "always inline" attribute.
|
||||||
bool AlwaysInliner::doInitialization(CallGraph &CG) {
|
bool AlwaysInliner::doInitialization(CallGraph &CG) {
|
||||||
|
|
||||||
Module &M = CG.getModule();
|
Module &M = CG.getModule();
|
||||||
|
|
||||||
for (Module::iterator I = M.begin(), E = M.end();
|
for (Module::iterator I = M.begin(), E = M.end();
|
||||||
|
|
@ -68,4 +67,3 @@ bool AlwaysInliner::doInitialization(CallGraph &CG) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,11 +95,12 @@ void BasicInlinerImpl::inlineFunctions() {
|
||||||
bool Changed = false;
|
bool Changed = false;
|
||||||
do {
|
do {
|
||||||
Changed = false;
|
Changed = false;
|
||||||
for (unsigned index = 0; index != CallSites.size() && !CallSites.empty(); ++index) {
|
for (unsigned index = 0; index != CallSites.size() && !CallSites.empty();
|
||||||
|
++index) {
|
||||||
CallSite CS = CallSites[index];
|
CallSite CS = CallSites[index];
|
||||||
if (Function *Callee = CS.getCalledFunction()) {
|
if (Function *Callee = CS.getCalledFunction()) {
|
||||||
|
|
||||||
// Eliminate calls taht are never inlinable.
|
// Eliminate calls that are never inlinable.
|
||||||
if (Callee->isDeclaration() ||
|
if (Callee->isDeclaration() ||
|
||||||
CS.getInstruction()->getParent()->getParent() == Callee) {
|
CS.getInstruction()->getParent()->getParent() == Callee) {
|
||||||
CallSites.erase(CallSites.begin() + index);
|
CallSites.erase(CallSites.begin() + index);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue