LLVM API Documentation

GVN.cpp File Reference

#include "llvm/Transforms/Scalar.h"
#include "llvm/BasicBlock.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Function.h"
#include "llvm/Instructions.h"
#include "llvm/Value.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/Dominators.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/MemoryDependenceAnalysis.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include <cstdio>

Include dependency graph for GVN.cpp:

Go to the source code of this file.

Namespaces

namespace  llvm

Classes

struct  llvm::DenseMapInfo< Expression >

Defines

#define DEBUG_TYPE   "gvn"

Functions

 STATISTIC (NumGVNInstr,"Number of instructions deleted")
 STATISTIC (NumGVNLoad,"Number of loads deleted")
 STATISTIC (NumGVNPRE,"Number of instructions PRE'd")
 STATISTIC (NumGVNBlocks,"Number of blocks merged")
 STATISTIC (NumPRELoad,"Number of loads PRE'd")
FunctionPass * llvm::createGVNPass ()
static bool IsValueFullyAvailableInBlock (BasicBlock *BB, DenseMap< BasicBlock *, char > &FullyAvailableBlocks)

Variables

static cl::opt< bool > EnablePRE ("enable-pre", cl::init(true), cl::Hidden)
cl::opt< bool > EnableLoadPRE ("enable-load-pre")
static RegisterPass< GVN > X ("gvn","Global Value Numbering")


Define Documentation

#define DEBUG_TYPE   "gvn"

Definition at line 18 of file GVN.cpp.


Function Documentation

static bool IsValueFullyAvailableInBlock ( BasicBlock *  BB,
DenseMap< BasicBlock *, char > &  FullyAvailableBlocks 
) [static]

IsValueFullyAvailableInBlock - Return true if we can prove that the value we're analyzing is fully available in the specified block. As we go, keep track of which blocks we know are fully alive in FullyAvailableBlocks. This map is actually a tri-state map with the following values: 0) we know the block *is not* fully available. 1) we know the block *is* fully available. 2) we do not know whether the block is fully available or not, but we are currently speculating that it will be. 3) we are speculating for this block and have used that to speculate for other blocks.

Definition at line 866 of file GVN.cpp.

References llvm::SmallVectorImpl< T >::empty(), Entry, llvm::DenseMap< KeyT, ValueT, KeyInfoT, ValueInfoT >::insert(), PI, llvm::SmallVectorImpl< T >::pop_back_val(), llvm::pred_begin(), llvm::pred_end(), llvm::SmallVectorImpl< T >::push_back(), llvm::succ_begin(), and llvm::succ_end().

STATISTIC ( NumPRELoad  ,
"Number of loads PRE'd"   
)

STATISTIC ( NumGVNBlocks  ,
"Number of blocks merged"   
)

STATISTIC ( NumGVNPRE  ,
"Number of instructions PRE'd"   
)

STATISTIC ( NumGVNLoad  ,
"Number of loads deleted"   
)

STATISTIC ( NumGVNInstr  ,
"Number of instructions deleted"   
)


Variable Documentation

Definition at line 121 of file GVN.cpp.

Definition at line 123 of file GVN.cpp.

cl::opt<bool> EnableLoadPRE("enable-load-pre")

cl::opt<bool> EnablePRE("enable-pre", cl::init(true), cl::Hidden) [static]

DenseMap<Expression, uint32_t> expressionNumbering

Definition at line 120 of file GVN.cpp.

uint32_t firstVN

Definition at line 76 of file GVN.cpp.

Definition at line 80 of file GVN.cpp.

char ID [static]

Definition at line 686 of file GVN.cpp.

DenseMap<BasicBlock*, ValueNumberScope*> localAvail

Definition at line 694 of file GVN.cpp.

Definition at line 122 of file GVN.cpp.

uint32_t nextValueNumber

Definition at line 125 of file GVN.cpp.

ExpressionOpcode opcode

ValueNumberScope* parent

PhiMapType phiMap

Definition at line 697 of file GVN.cpp.

uint32_t secondVN

Definition at line 77 of file GVN.cpp.

DenseMap<uint32_t, Value*> table

Definition at line 675 of file GVN.cpp.

uint32_t thirdVN

Definition at line 78 of file GVN.cpp.

const Type* type

Definition at line 75 of file GVN.cpp.

Referenced by llvm::AsmPrinter::EmitGlobalConstant(), and llvm::sys::IdentifyFileType().

Definition at line 119 of file GVN.cpp.

SmallVector<uint32_t, 4> varargs

Definition at line 79 of file GVN.cpp.

ValueTable VN

RegisterPass<GVN> X("gvn","Global Value Numbering") [static]