Converts calls to TESLA pseudo-assertions into instrumentation sites.
Definition at line 52 of file FieldReference.h.
#include "FieldReference.h"
tesla::FieldReferenceInstrumenter::FieldReferenceInstrumenter |
( |
const Manifest & |
M, |
|
|
bool |
SuppressDI |
|
) |
| |
|
inline |
tesla::FieldReferenceInstrumenter::~FieldReferenceInstrumenter |
( |
| ) |
|
const char* tesla::FieldReferenceInstrumenter::getPassName |
( |
| ) |
const |
|
inline |
Definition at line 58 of file FieldReference.h.
58 {
return "field reference instrumenter"; }
bool tesla::FieldReferenceInstrumenter::runOnModule |
( |
llvm::Module & |
M | ) |
|
|
virtual |
Definition at line 97 of file FieldReference.cpp.
References tesla::Cast(), tesla::FieldAnnotation::completeFieldName(), tesla::debug, tesla::LLVM_PTR_ANNOTATION, and tesla::panic().
99 <<
"===================================================================\n"
100 << __PRETTY_FUNCTION__ <<
"\n"
101 <<
"-------------------------------------------------------------------\n"
102 <<
"module: " << Mod.getModuleIdentifier() <<
"\n";
112 debug <<
"instrumentation:\n";
113 for (
auto& i : Instrumentation) {
114 debug <<
" " << i.getKey() <<
" -> ";
115 i.getValue()->getTarget()->getType()->print(
debug);
120 <<
"-------------------------------------------------------------------\n"
121 <<
"looking for field references...\n"
128 std::map<LoadInst*,FieldInstrumentation*> Loads;
129 std::map<StoreInst*,FieldInstrumentation*> Stores;
134 for (Function& Fn : Mod.getFunctionList()) {
138 for (
auto i = Fn.use_begin(); i != Fn.use_end(); i++) {
144 auto *Annotation = dyn_cast<FieldAnnotation>(A.get());
149 auto Name = Annotation->completeFieldName();
150 auto *Instr = Instrumentation[Name];
154 for (User *U : *Annotation) {
155 auto *
Cast = dyn_cast<CastInst>(U);
158 panic(
"annotation user not a bitcast",
false);
161 for (
auto k =
Cast->use_begin(); k !=
Cast->use_end(); k++) {
162 if (
auto *Load = dyn_cast<LoadInst>(*k))
163 Loads.insert(std::make_pair(Load, Instr));
165 else if (
auto *Store = dyn_cast<StoreInst>(*k))
166 Stores.insert(std::make_pair(Store, Instr));
170 panic(
"expected load or store with annotated value",
false);
178 InstrumentLoad(i.first, i.second);
180 for (
auto i : Stores)
181 InstrumentStore(i.first, i.second);
char tesla::FieldReferenceInstrumenter::ID = 0 |
|
static |
The documentation for this class was generated from the following files: