@@ -37,21 +37,22 @@ using namespace llvm;
3737
3838namespace typeart {
3939
40- TAFunctionDeclarator::TAFunctionDeclarator (Module& m , InstrumentationHelper&, TAFunctions& tafunc )
41- : m(m ), tafunc(tafunc ) {
40+ TAFunctionDeclarator::TAFunctionDeclarator (Module& mod , InstrumentationHelper&, TAFunctions& typeart_funcs )
41+ : module (mod ), typeart_functions(typeart_funcs ) {
4242}
4343
44- llvm::Function* TAFunctionDeclarator::make_function (IFunc id , llvm::StringRef basename,
44+ llvm::Function* TAFunctionDeclarator::make_function (IFunc func_id , llvm::StringRef basename,
4545 llvm::ArrayRef<llvm::Type*> args, bool with_omp, bool fixed_name) {
46- const auto make_fname = [&fixed_name](llvm::StringRef name, llvm::ArrayRef<llvm::Type*> args, bool with_omp) {
46+ const auto make_fname = [&fixed_name](llvm::StringRef name, llvm::ArrayRef<llvm::Type*> callback_arguments,
47+ bool with_omp_postfix) {
4748 std::string fname;
4849 llvm::raw_string_ostream os (fname);
4950 os << name;
5051
5152 if (!fixed_name) {
52- os << " _" << std::to_string (args .size ());
53+ os << " _" << std::to_string (callback_arguments .size ());
5354 }
54- if (with_omp ) {
55+ if (with_omp_postfix ) {
5556 os << " _"
5657 << " omp" ;
5758 }
@@ -60,11 +61,11 @@ llvm::Function* TAFunctionDeclarator::make_function(IFunc id, llvm::StringRef ba
6061
6162 const auto name = make_fname (basename, args, with_omp);
6263
63- if (auto it = f_map .find (name); it != f_map .end ()) {
64+ if (auto it = function_map .find (name); it != function_map .end ()) {
6465 return it->second ;
6566 }
6667
67- auto & c = m .getContext ();
68+ auto & c = module .getContext ();
6869 const auto addOptimizerAttributes = [&](llvm::Function* function) {
6970 function->setDoesNotThrow ();
7071 function->setDoesNotFreeMemory ();
@@ -84,13 +85,13 @@ llvm::Function* TAFunctionDeclarator::make_function(IFunc id, llvm::StringRef ba
8485 function->setLinkage (GlobalValue::ExternalLinkage);
8586 // f->setLinkage(GlobalValue::ExternalWeakLinkage);
8687 };
87- const auto do_make = [&](auto & name , auto f_type ) {
88- const bool has_func_declared = m .getFunction (name ) != nullptr ;
89- auto func_in_module = m .getOrInsertFunction (name, f_type );
88+ const auto do_make = [&](auto & function_name , auto function_type ) {
89+ const bool has_func_declared = module .getFunction (function_name ) != nullptr ;
90+ auto func_in_module = module .getOrInsertFunction (function_name, function_type );
9091
9192 Function* function{nullptr };
9293 if (has_func_declared) {
93- LOG_WARNING (" Function " << name << " is already declared in the module." )
94+ LOG_WARNING (" Function " << function_name << " is already declared in the module." )
9495 function = dyn_cast<Function>(func_in_module.getCallee ()->stripPointerCasts ());
9596 } else {
9697 function = dyn_cast<Function>(func_in_module.getCallee ());
@@ -101,17 +102,17 @@ llvm::Function* TAFunctionDeclarator::make_function(IFunc id, llvm::StringRef ba
101102 return function;
102103 };
103104
104- auto f = do_make (name, FunctionType::get (Type::getVoidTy (c), args, false ));
105+ auto generated_function = do_make (name, FunctionType::get (Type::getVoidTy (c), args, false ));
105106
106- f_map [name] = f ;
107+ function_map [name] = generated_function ;
107108
108- tafunc .putFunctionFor (id, f );
109+ typeart_functions .putFunctionFor (func_id, generated_function );
109110
110- return f ;
111+ return generated_function ;
111112}
112113
113114const llvm::StringMap<llvm::Function*>& TAFunctionDeclarator::getFunctionMap () const {
114- return f_map ;
115+ return function_map ;
115116}
116117
117118TAFunctions::TAFunctions () = default ;
0 commit comments