Computer Laboratory

tesla::CallerInstrumentation Class Reference

Detailed Description

Function instrumentation (caller context).

Definition at line 82 of file Caller.h.

#include "Caller.h"

+ Inheritance diagram for tesla::CallerInstrumentation:
+ Collaboration diagram for tesla::CallerInstrumentation:

Public Member Functions

bool Instrument (llvm::Instruction &)
 Optionally decorate an instruction with calls to instrumentation. More...
 
- Public Member Functions inherited from tesla::FnInstrumentation
void AppendInstrumentation (const Automaton &, const FunctionEvent &, TEquivalenceClass &)
 

Static Public Member Functions

static CallerInstrumentationBuild (llvm::Module &, llvm::Function *Target, FunctionEvent::Direction, bool SuppressDebugInstr)
 Construct an object that can instrument calls to a given function. More...
 

Additional Inherited Members

- Protected Member Functions inherited from tesla::FnInstrumentation
 FnInstrumentation (llvm::Module &M, const llvm::Function *TargetFn, llvm::Function *InstrFn, FunctionEvent::Direction Dir)
 
- Protected Attributes inherited from tesla::FnInstrumentation
llvm::Module & M
 The current module. More...
 
const llvm::Function * TargetFn
 The function being instrumented. More...
 
llvm::Function * InstrFn
 The instrumentation function. More...
 
FunctionEvent::Direction Dir
 Which way we instrument (in or out). More...
 

Member Function Documentation

CallerInstrumentation * tesla::CallerInstrumentation::Build ( llvm::Module &  ,
llvm::Function *  Target,
FunctionEvent::Direction  ,
bool  SuppressDebugInstr 
)
static

Construct an object that can instrument calls to a given function.

Definition at line 140 of file Caller.cpp.

References tesla::FunctionInstrumentation().

142  {
143 
144  assert(Target != NULL);
145 
146  Function *InstrFn = FunctionInstrumentation(M, *Target, Dir,
148  SuppressDebugInstr);
149 
150  return new CallerInstrumentation(M, Target, InstrFn, Dir);
151 }

+ Here is the call graph for this function:

bool tesla::CallerInstrumentation::Instrument ( llvm::Instruction &  )
virtual

Optionally decorate an instruction with calls to instrumentation.

Returns
whether or not any instrumentation was actually added.

Implements tesla::InstInstrumentation.

Definition at line 154 of file Caller.cpp.

Referenced by tesla::FnCallerInstrumenter::runOnBasicBlock().

154  {
155  assert(isa<CallInst>(Inst));
156  CallInst &Call = cast<CallInst>(Inst);
157 
158  ArgVector Args;
159  for (size_t i = 0; i < Call.getNumArgOperands(); i++)
160  Args.push_back(Call.getArgOperand(i));
161 
162  switch (Dir) {
164  CallInst::Create(InstrFn, Args)->insertBefore(&Inst);
165  break;
166 
167  case FunctionEvent::Exit:
168  if (!Call.getType()->isVoidTy())
169  Args.push_back(&Call);
170 
171  CallInst::Create(InstrFn, Args)->insertAfter(&Inst);
172  break;
173  }
174 
175  return true;
176 }

+ Here is the caller graph for this function:


The documentation for this class was generated from the following files: