LLVM API Documentation

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

TraceValues.cpp File Reference

#include "llvm/Transforms/Instrumentation.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Instructions.h"
#include "llvm/Module.h"
#include "llvm/Pass.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/ADT/StringExtras.h"
#include <algorithm>
#include <sstream>

Include dependency graph for TraceValues.cpp:

Go to the source code of this file.

Functions

static void TraceValuesAtBBExit (BasicBlock *BB, Function *Printf, Function *HashPtrToSeqNum, std::vector< Instruction * > *valuesStoredInFunction)
static bool TraceThisFunction (Function &F)
FunctionPassllvm::createTraceValuesPassForFunction ()
 Just trace functions.
FunctionPassllvm::createTraceValuesPassForBasicBlocks ()
 Trace BB's and functions.
static GlobalVariablegetStringRef (Module *M, const std::string &str)
static bool LiveAtBBExit (const Instruction *I)
static bool TraceThisOpCode (unsigned opCode)
static bool ShouldTraceValue (const Instruction *I)
static std::string getPrintfCodeFor (const Value *V)
static void InsertPrintInst (Value *V, BasicBlock *BB, Instruction *InsertBefore, std::string Message, Function *Printf, Function *HashPtrToSeqNum)
static void InsertVerbosePrintInst (Value *V, BasicBlock *BB, Instruction *InsertBefore, const std::string &Message, Function *Printf, Function *HashPtrToSeqNum)
static void InsertReleaseInst (Value *V, BasicBlock *BB, Instruction *InsertBefore, Function *ReleasePtrFunc)
static void InsertRecordInst (Value *V, BasicBlock *BB, Instruction *InsertBefore, Function *RecordPtrFunc)
static void ReleasePtrSeqNumbers (BasicBlock *BB, ExternalFuncs &externalFuncs)
static void InsertCodeToShowFunctionEntry (Function &F, Function *Printf, Function *HashPtrToSeqNum)
static void InsertCodeToShowFunctionExit (BasicBlock *BB, Function *Printf, Function *HashPtrToSeqNum)

Variables

static cl::opt< bool > DisablePtrHashing ("tracedisablehashdisable", cl::Hidden, cl::desc("Disable pointer hashing in the -trace or -tracem ""passes"))
static cl::list< std::string > TraceFuncNames ("tracefunc", cl::desc("Only trace specific functions in the ""-trace or -tracem passes"), cl::value_desc("function"), cl::Hidden)


Function Documentation

static std::string getPrintfCodeFor const Value V  )  [static]
 

Definition at line 207 of file TraceValues.cpp.

References DisablePtrHashing, llvm::Value::getType(), llvm::Type::isFloatingPoint(), and llvm::Type::isIntegral().

Referenced by InsertPrintInst().

static GlobalVariable* getStringRef Module M,
const std::string &  str
[inline, static]
 

Definition at line 153 of file TraceValues.cpp.

References llvm::Module::getGlobalList(), and llvm::Value::getType().

Referenced by InsertPrintInst().

static void InsertCodeToShowFunctionEntry Function F,
Function Printf,
Function HashPtrToSeqNum
[inline, static]
 

Definition at line 355 of file TraceValues.cpp.

References llvm::Function::abegin(), llvm::Function::aend(), llvm::BasicBlock::begin(), E, llvm::Function::getEntryBlock(), I, InsertPrintInst(), InsertVerbosePrintInst(), llvm::utostr(), and llvm::WriteAsOperand().

static void InsertCodeToShowFunctionExit BasicBlock BB,
Function Printf,
Function HashPtrToSeqNum
[inline, static]
 

Definition at line 376 of file TraceValues.cpp.

References llvm::BasicBlock::getParent(), llvm::Function::getReturnType(), llvm::ReturnInst::getReturnValue(), llvm::BasicBlock::getTerminator(), InsertPrintInst(), llvm::ISD::Ret, and llvm::WriteAsOperand().

static void InsertPrintInst Value V,
BasicBlock BB,
Instruction InsertBefore,
std::string  Message,
Function Printf,
Function HashPtrToSeqNum
[static]
 

Definition at line 223 of file TraceValues.cpp.

References DisablePtrHashing, llvm::GlobalValue::getParent(), llvm::BasicBlock::getParent(), getPrintfCodeFor(), getStringRef(), llvm::Value::getType(), and I.

Referenced by InsertCodeToShowFunctionEntry(), InsertCodeToShowFunctionExit(), InsertVerbosePrintInst(), and TraceValuesAtBBExit().

static void InsertRecordInst Value V,
BasicBlock BB,
Instruction InsertBefore,
Function RecordPtrFunc
[static]
 

Definition at line 289 of file TraceValues.cpp.

References llvm::Value::getType().

Referenced by ReleasePtrSeqNumbers().

static void InsertReleaseInst Value V,
BasicBlock BB,
Instruction InsertBefore,
Function ReleasePtrFunc
[static]
 

Definition at line 276 of file TraceValues.cpp.

References llvm::Value::getType().

Referenced by ReleasePtrSeqNumbers().

static void InsertVerbosePrintInst Value V,
BasicBlock BB,
Instruction InsertBefore,
const std::string &  Message,
Function Printf,
Function HashPtrToSeqNum
[static]
 

Definition at line 265 of file TraceValues.cpp.

References InsertPrintInst(), and llvm::WriteAsOperand().

Referenced by InsertCodeToShowFunctionEntry(), and TraceValuesAtBBExit().

static bool LiveAtBBExit const Instruction I  )  [inline, static]
 

Definition at line 173 of file TraceValues.cpp.

References llvm::Instruction::getParent(), U, llvm::Value::use_begin(), and llvm::Value::use_end().

Referenced by ShouldTraceValue().

static void ReleasePtrSeqNumbers BasicBlock BB,
ExternalFuncs &  externalFuncs
[static]
 

Definition at line 305 of file TraceValues.cpp.

References llvm::BasicBlock::begin(), llvm::BasicBlock::end(), llvm::BasicBlock::getNext(), InsertRecordInst(), and InsertReleaseInst().

static bool ShouldTraceValue const Instruction I  )  [static]
 

Definition at line 200 of file TraceValues.cpp.

References llvm::Instruction::getOpcode(), llvm::Value::getType(), LiveAtBBExit(), and TraceThisOpCode().

Referenced by TraceValuesAtBBExit().

static bool TraceThisFunction Function F  )  [inline, static]
 

Definition at line 46 of file TraceValues.cpp.

References llvm::Value::getName(), and TraceFuncNames.

static bool TraceThisOpCode unsigned  opCode  )  [inline, static]
 

Definition at line 184 of file TraceValues.cpp.

References llvm::Alloca, and llvm::ISD::PHI.

Referenced by ShouldTraceValue().

static void TraceValuesAtBBExit BasicBlock BB,
Function Printf,
Function HashPtrToSeqNum,
std::vector< Instruction * > *  valuesStoredInFunction
[static]
 

Definition at line 325 of file TraceValues.cpp.

References llvm::BasicBlock::begin(), llvm::BasicBlock::getTerminator(), InsertPrintInst(), InsertVerbosePrintInst(), ShouldTraceValue(), and llvm::WriteAsOperand().


Variable Documentation

cl::opt<bool> DisablePtrHashing("tracedisablehashdisable", cl::Hidden, cl::desc("Disable pointer hashing in the -trace or -tracem ""passes")) [static]
 

Referenced by getPrintfCodeFor(), and InsertPrintInst().

cl::list<std::string> TraceFuncNames("tracefunc", cl::desc("Only trace specific functions in the ""-trace or -tracem passes"), cl::value_desc("function"), cl::Hidden) [static]
 

Referenced by TraceThisFunction().

RegisterOpt<FunctionTracer> X("tracem","Insert Function trace code only") [static]
 

RegisterOpt<BasicBlockTracer> Y("trace","Insert BB and Function trace code") [static]