LLVM API Documentation

DeadArgumentElimination.cpp File Reference

#include "llvm/Transforms/IPO.h"
#include "llvm/Module.h"
#include "llvm/Pass.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Constant.h"
#include "llvm/Instructions.h"
#include "llvm/Support/CallSite.h"
#include "llvm/Support/Debug.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/iterator"
#include <iostream>
#include <set>

Include dependency graph for DeadArgumentElimination.cpp:

Go to the source code of this file.

Defines

#define DEBUG_TYPE   "deadargelim"

Functions

ModulePassllvm::createDeadArgEliminationPass ()
ModulePassllvm::createDeadArgHackingPass ()
static bool CallPassesValueThoughVararg (Instruction *Call, const Value *Arg)

Variables

Statistic NumArgumentsEliminated ("deadargelim","Number of unread args removed")
Statistic NumRetValsEliminated ("deadargelim","Number of unused return values removed")
std::set< Argument * > DeadArguments
std::set< Argument * > MaybeLiveArguments
std::set< Argument * > LiveArguments
std::set< Function * > DeadRetVal
std::set< Function * > MaybeLiveRetVal
std::set< Function * > LiveRetVal
std::vector< Instruction * > InstructionsToInspect
std::multimap< Function *,
CallSite
CallSites
RegisterOpt< DAE > X ("deadargelim","Dead Argument Elimination")
RegisterPass< DAH > Y ("deadarghaX0r","Dead Argument Hacking (BUGPOINT USE ONLY; DO NOT USE)")


Define Documentation

#define DEBUG_TYPE   "deadargelim"

Definition at line 20 of file DeadArgumentElimination.cpp.


Function Documentation

static bool CallPassesValueThoughVararg ( Instruction Call,
const Value Arg 
) [inline, static]

Definition at line 114 of file DeadArgumentElimination.cpp.

References AI, llvm::CallSite::arg_begin(), llvm::CallSite::arg_end(), llvm::Call, llvm::CallSite::getCalledValue(), and llvm::Value::getType().


Variable Documentation

std::multimap<Function*, CallSite> CallSites

CallSites - Keep track of the call sites of functions that have MaybeLive arguments or return values.

Definition at line 77 of file DeadArgumentElimination.cpp.

Referenced by llvm::Inliner::runOnSCC().

std::set<Argument*> DeadArguments

LiveArguments, MaybeLiveArguments, DeadArguments - These sets contain all of the arguments in the program. The Dead set contains arguments which are completely dead (never used in the function). The MaybeLive set contains arguments which are only passed into other function calls, thus may be live and may be dead. The Live set contains arguments which are known to be alive.

Definition at line 57 of file DeadArgumentElimination.cpp.

std::set<Function*> DeadRetVal

DeadRetVal, MaybeLiveRetVal, LifeRetVal - These sets contain all of the functions in the program. The Dead set contains functions whose return value is known to be dead. The MaybeLive set contains functions whose return values are only used by return instructions, and the Live set contains functions whose return values are used, functions that are external, and functions that already return void.

Definition at line 66 of file DeadArgumentElimination.cpp.

std::vector<Instruction*> InstructionsToInspect

InstructionsToInspect - As we mark arguments and return values MaybeLive, we keep track of which instructions could make the values live here. Once the entire program has had the return value and arguments analyzed, this set is scanned to promote the MaybeLive objects to be Live if they really are used.

Definition at line 73 of file DeadArgumentElimination.cpp.

std::set<Argument*> LiveArguments

Definition at line 57 of file DeadArgumentElimination.cpp.

std::set<Function*> LiveRetVal

Definition at line 66 of file DeadArgumentElimination.cpp.

std::set<Argument*> MaybeLiveArguments

Definition at line 57 of file DeadArgumentElimination.cpp.

std::set<Function*> MaybeLiveRetVal

Definition at line 66 of file DeadArgumentElimination.cpp.

Statistic NumArgumentsEliminated("deadargelim","Number of unread args removed") [static]

Statistic NumRetValsEliminated("deadargelim","Number of unused return values removed") [static]

RegisterOpt<DAE> X("deadargelim","Dead Argument Elimination") [static]

RegisterPass<DAH> Y("deadarghaX0r","Dead Argument Hacking (BUGPOINT USE ONLY; DO NOT USE)") [static]