Computer Laboratory

tesla::FnCalleeInstrumenter Class Reference

Detailed Description

Instruments function calls in the callee context.

Definition at line 57 of file Callee.h.

#include "Callee.h"

+ Inheritance diagram for tesla::FnCalleeInstrumenter:
+ Collaboration diagram for tesla::FnCalleeInstrumenter:

Public Member Functions

 FnCalleeInstrumenter (const Manifest &M, bool SuppressDI)
 
 ~FnCalleeInstrumenter ()
 
const char * getPassName () const
 
virtual bool runOnModule (llvm::Module &M)
 
- Public Member Functions inherited from tesla::Instrumenter
 Instrumenter (const Manifest &M, bool SuppressDI)
 
virtual ~Instrumenter ()
 

Static Public Attributes

static char ID = 0
 

Additional Inherited Members

- Protected Attributes inherited from tesla::Instrumenter
const ManifestM
 TESLA manifest that describes automata. More...
 
const bool SuppressDebugInstr
 Don't produce debug instrumentation (e.g., printf() statements). More...
 

Constructor & Destructor Documentation

tesla::FnCalleeInstrumenter::FnCalleeInstrumenter ( const Manifest M,
bool  SuppressDI 
)
inline

Definition at line 60 of file Callee.h.

61  : Instrumenter(M, SuppressDI), ModulePass(ID) {}
tesla::FnCalleeInstrumenter::~FnCalleeInstrumenter ( )

Definition at line 57 of file Callee.cpp.

57  {
58  google::protobuf::ShutdownProtobufLibrary();
59 }

Member Function Documentation

const char* tesla::FnCalleeInstrumenter::getPassName ( ) const
inline

Definition at line 64 of file Callee.h.

64  {
65  return "TESLA function instrumenter (callee-side)";
66  }
bool tesla::FnCalleeInstrumenter::runOnModule ( llvm::Module &  M)
virtual

Definition at line 61 of file Callee.cpp.

References tesla::FnTransition::FnEvent().

61  {
62  bool ModifiedIR = false;
63 
64  for (auto i : M.RootAutomata()) {
65  auto& A = *M.FindAutomaton(i->identifier());
66  for (auto EquivClass : A) {
67  assert(!EquivClass.empty());
68 
69  auto *Head = dyn_cast<FnTransition>(*EquivClass.begin());
70  if (!Head)
71  continue;
72 
73  auto& FnEvent = Head->FnEvent();
74  if (FnEvent.context() != FunctionEvent::Callee)
75  continue;
76 
77  Function *Target = Mod.getFunction(FnEvent.function().name());
78 
79  // Only handle functions that are defined in this module.
80  if (!Target || Target->empty())
81  continue;
82 
83  GetOrCreateInstr(Mod, Target, FnEvent.direction())
84  ->AppendInstrumentation(A, FnEvent, EquivClass);
85 
86  ModifiedIR = true;
87  }
88  }
89 
90  return ModifiedIR;
91 }

+ Here is the call graph for this function:

Member Data Documentation

char tesla::FnCalleeInstrumenter::ID = 0
static

Definition at line 59 of file Callee.h.


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