LLVM API Documentation

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

LevelRaise.cpp File Reference

#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils/Local.h"
#include "TransformInternals.h"
#include "llvm/Instructions.h"
#include "llvm/Pass.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/STLExtras.h"
#include <algorithm>

Include dependency graph for LevelRaise.cpp:

Go to the source code of this file.

Defines

#define PRINT_PEEPHOLE(ID, NUM, I)   DEBUG(std::cerr << "Inst P/H " << ID << "[" << NUM << "] " << I)
#define PRINT_PEEPHOLE1(ID, I1)   do { PRINT_PEEPHOLE(ID, 0, I1); } while (0)
#define PRINT_PEEPHOLE2(ID, I1, I2)   do { PRINT_PEEPHOLE(ID, 0, I1); PRINT_PEEPHOLE(ID, 1, I2); } while (0)
#define PRINT_PEEPHOLE3(ID, I1, I2, I3)
#define PRINT_PEEPHOLE4(ID, I1, I2, I3, I4)

Functions

FunctionPassllvm::createRaisePointerReferencesPass ()
static bool isReinterpretingCast (const CastInst *CI)
static bool HandleCastToPointer (BasicBlock::iterator BI, const PointerType *DestPTy, const TargetData &TD)
static bool PeepholeOptimizeAddCast (BasicBlock *BB, BasicBlock::iterator &BI, Value *AddOp1, CastInst *AddOp2, const TargetData &TD)

Variables

static cl::opt< std::string > StartInst ("raise-start-inst", cl::Hidden, cl::value_desc("inst name"), cl::desc("Start raise pass at the instruction with the specified name"))
static Statistic NumLoadStorePeepholes ("raise","Number of load/store peepholes")
static Statistic NumGEPInstFormed ("raise","Number of other getelementptr's formed")
static Statistic NumExprTreesConv ("raise","Number of expression trees converted")
static Statistic NumCastOfCast ("raise","Number of cast-of-self removed")
static Statistic NumDCEorCP ("raise","Number of insts DCEd or constprop'd")
static Statistic NumVarargCallChanges ("raise","Number of vararg call peepholes")


Define Documentation

#define PRINT_PEEPHOLE ID,
NUM,
 )     DEBUG(std::cerr << "Inst P/H " << ID << "[" << NUM << "] " << I)
 

Definition at line 55 of file LevelRaise.cpp.

#define PRINT_PEEPHOLE1 ID,
I1   )     do { PRINT_PEEPHOLE(ID, 0, I1); } while (0)
 

Definition at line 58 of file LevelRaise.cpp.

Referenced by HandleCastToPointer().

#define PRINT_PEEPHOLE2 ID,
I1,
I2   )     do { PRINT_PEEPHOLE(ID, 0, I1); PRINT_PEEPHOLE(ID, 1, I2); } while (0)
 

Definition at line 59 of file LevelRaise.cpp.

Referenced by HandleCastToPointer(), and PeepholeOptimizeAddCast().

#define PRINT_PEEPHOLE3 ID,
I1,
I2,
I3   ) 
 

Value:

do { PRINT_PEEPHOLE(ID, 0, I1); PRINT_PEEPHOLE(ID, 1, I2); \
       PRINT_PEEPHOLE(ID, 2, I3); } while (0)

Definition at line 61 of file LevelRaise.cpp.

Referenced by PeepholeOptimizeAddCast().

#define PRINT_PEEPHOLE4 ID,
I1,
I2,
I3,
I4   ) 
 

Value:

do { PRINT_PEEPHOLE(ID, 0, I1); PRINT_PEEPHOLE(ID, 1, I2); \
       PRINT_PEEPHOLE(ID, 2, I3); PRINT_PEEPHOLE(ID, 3, I4); } while (0)

Definition at line 64 of file LevelRaise.cpp.


Function Documentation

static bool HandleCastToPointer BasicBlock::iterator  BI,
const PointerType DestPTy,
const TargetData TD
[static]
 

Definition at line 107 of file LevelRaise.cpp.

References Add(), llvm::ConvertibleToGEP(), E, llvm::BasicBlock::getInstList(), llvm::Value::getName(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::Value::getType(), I, PRINT_PEEPHOLE1, PRINT_PEEPHOLE2, llvm::ReplaceInstWithInst(), llvm::User::setOperand(), llvm::Value::use_begin(), llvm::Value::use_empty(), and llvm::Value::use_end().

static bool isReinterpretingCast const CastInst CI  )  [inline, static]
 

Definition at line 95 of file LevelRaise.cpp.

References llvm::User::getOperand(), llvm::Value::getType(), and llvm::Type::isLosslesslyConvertibleTo().

static bool PeepholeOptimizeAddCast BasicBlock BB,
BasicBlock::iterator &  BI,
Value AddOp1,
CastInst AddOp2,
const TargetData TD
[static]
 

Definition at line 199 of file LevelRaise.cpp.

References llvm::ConvertibleToGEP(), llvm::BasicBlock::getInstList(), llvm::Value::getName(), llvm::User::getOperand(), llvm::getPointedToComposite(), llvm::GetElementPtrInst::getType(), llvm::Value::getType(), llvm::Type::isInteger(), PRINT_PEEPHOLE2, PRINT_PEEPHOLE3, and llvm::ReplaceInstWithInst().


Variable Documentation

Statistic NumCastOfCast("raise","Number of cast-of-self removed") [static]
 

Statistic NumDCEorCP("raise","Number of insts DCEd or constprop'd") [static]
 

Statistic NumExprTreesConv("raise","Number of expression trees converted") [static]
 

Statistic NumGEPInstFormed("raise","Number of other getelementptr's formed") [static]
 

Statistic NumLoadStorePeepholes("raise","Number of load/store peepholes") [static]
 

Statistic NumVarargCallChanges("raise","Number of vararg call peepholes") [static]
 

cl::opt<std::string> StartInst("raise-start-inst", cl::Hidden, cl::value_desc("inst name"), cl::desc("Start raise pass at the instruction with the specified name")) [static]
 

RegisterOpt<RPR> X("raise","Raise Pointer References") [static]