@@ -307,12 +307,6 @@ don't yet pass)
307307 */
308308 template < typename T >
309309 std::optional< T > lookup (const std::vector< T > &items, const std::string &name) {
310- for (const auto &item : items) {
311- if (item.id == name) {
312- return item;
313- }
314- }
315- LOG (WARNING ) << " Falling back to lookup by name: '" << name << " '\n " ;
316310 return lookup_by_name (items, name);
317311 }
318312
@@ -358,14 +352,14 @@ don't yet pass)
358352 config = std::move (config_or_err.value ());
359353 for (auto &spec : config->libraries .patches ) {
360354 auto patches_file_path =
361- ConfigurationFile::getInstance ().resolve_path (spec.implementation . code_file );
355+ ConfigurationFile::getInstance ().resolve_path (spec.code_file );
362356 if (!llvm::sys::fs::exists (patches_file_path)) {
363357 LOG (ERROR ) << " Patch file " << patches_file_path << " does not exist\n " ;
364358 continue ;
365359 }
366360
367361 auto patch_file_path =
368- ConfigurationFile::getInstance ().resolve_path (spec.implementation . code_file );
362+ ConfigurationFile::getInstance ().resolve_path (spec.code_file );
369363 spec.patch_module = emitModuleAsString (patch_file_path, config->target .arch );
370364 if (!spec.patch_module ) {
371365 LOG (ERROR ) << " Failed to emit patch module for " << spec.name << " \n " ;
@@ -374,7 +368,7 @@ don't yet pass)
374368 }
375369 for (auto &spec : config->libraries .contracts ) {
376370 auto contracts_file_path =
377- ConfigurationFile::getInstance ().resolve_path (spec.implementation . code_file );
371+ ConfigurationFile::getInstance ().resolve_path (spec.code_file );
378372 if (!llvm::sys::fs::exists (contracts_file_path)) {
379373 LOG (ERROR ) << " Contract file " << contracts_file_path << " does not exist\n " ;
380374 continue ;
@@ -861,9 +855,6 @@ don't yet pass)
861855 arg_map[symbol_reference] =
862856 create_cast_if_needed (builder, call_op, load_op, patch_arg_type);
863857 }
864-
865- // LOG(DEBUG) << "arg_map[symbol] key=" << valueToString(symbol_reference)
866- // << " value=" << valueToString(arg_map[symbol_reference]) << "\n";
867858 }
868859
869860 void InstrumentationPass::handle_return_value_argument (
@@ -909,9 +900,6 @@ don't yet pass)
909900 }
910901
911902 arg_map[arg_value] = create_cast_if_needed (builder, call_op, arg_value, patch_arg_type);
912-
913- // LOG(DEBUG) << "arg_map[constant] key=" << valueToString(arg_value)
914- // << " value=" << valueToString(arg_map[arg_value]) << "\n";
915903 }
916904
917905 mlir::Value InstrumentationPass::parse_constant_operand (
@@ -1255,11 +1243,11 @@ don't yet pass)
12551243 builder.setInsertionPoint (target_op);
12561244 auto module = target_op->getParentOfType < mlir::ModuleOp >();
12571245
1258- std::string patch_function_name =
1259- namifyFunction (patch_spec.implementation .function_name );
1246+ std::string patch_function_name = namifyFunction (patch_spec.function_name );
12601247 auto input_types = llvm::to_vector (target_op->getOperandTypes ());
12611248 if (!patch_module.lookupSymbol < cir::FuncOp >(patch_function_name)) {
1262- LOG (ERROR ) << " Patch module not found or patch function not defined\n " ;
1249+ LOG (ERROR ) << " Patch module not found or patch function not defined: "
1250+ << patch_function_name << " \n " ;
12631251 return ;
12641252 }
12651253
@@ -1331,11 +1319,11 @@ don't yet pass)
13311319 auto module = target_op->getParentOfType < mlir::ModuleOp >();
13321320 builder.setInsertionPointAfter (target_op);
13331321
1334- std::string patch_function_name =
1335- namifyFunction (patch_spec.implementation .function_name );
1322+ std::string patch_function_name = namifyFunction (patch_spec.function_name );
13361323 auto input_types = llvm::to_vector (target_op->getResultTypes ());
13371324 if (!patch_module.lookupSymbol < cir::FuncOp >(patch_function_name)) {
1338- LOG (ERROR ) << " Patch module not found or patch function not defined\n " ;
1325+ LOG (ERROR ) << " Patch module not found or patch function not defined: "
1326+ << patch_function_name << " \n " ;
13391327 return ;
13401328 }
13411329
@@ -1409,11 +1397,12 @@ don't yet pass)
14091397 auto callee_name = call_op.getCallee ()->str ();
14101398 assert (!callee_name.empty () && " Wrap around patch: callee name is empty" );
14111399
1412- auto patch_function_name = namifyFunction (patch_spec.implementation . function_name );
1400+ auto patch_function_name = namifyFunction (patch_spec.function_name );
14131401 auto result_types = llvm::to_vector (call_op.getResultTypes ());
14141402
14151403 if (!patch_module.lookupSymbol < cir::FuncOp >(patch_function_name)) {
1416- LOG (ERROR ) << " Patch module not found or patch function not defined\n " ;
1404+ LOG (ERROR ) << " Patch module not found or patch function not defined: "
1405+ << patch_function_name << " \n " ;
14171406 return ;
14181407 }
14191408
@@ -1431,8 +1420,7 @@ don't yet pass)
14311420
14321421 auto wrap_func = module .lookupSymbol < cir::FuncOp >(patch_function_name);
14331422 if (!wrap_func) {
1434- LOG (ERROR ) << " Wrap around patch: patch function "
1435- << patch_spec.implementation .function_name
1423+ LOG (ERROR ) << " Wrap around patch: patch function " << patch_function_name
14361424 << " not defined. Patching failed...\n " ;
14371425 return ;
14381426 }
@@ -1953,7 +1941,7 @@ don't yet pass)
19531941 builder.setInsertionPoint (target_op);
19541942 auto module = target_op->getParentOfType < mlir::ModuleOp >();
19551943
1956- std::string contract_function_name = namifyFunction (spec.implementation . function_name );
1944+ std::string contract_function_name = namifyFunction (spec.function_name );
19571945 auto input_types = llvm::to_vector (target_op->getOperandTypes ());
19581946 if (!contract_module.lookupSymbol < cir::FuncOp >(contract_function_name)) {
19591947 LOG (ERROR ) << " Contract module not found or contract function not defined: "
@@ -2018,10 +2006,11 @@ don't yet pass)
20182006 auto module = target_op->getParentOfType < mlir::ModuleOp >();
20192007 builder.setInsertionPointAfter (target_op);
20202008
2021- std::string contract_function_name = namifyFunction (spec.implementation . function_name );
2009+ std::string contract_function_name = namifyFunction (spec.function_name );
20222010 auto input_types = llvm::to_vector (target_op->getResultTypes ());
20232011 if (!contract_module.lookupSymbol < cir::FuncOp >(contract_function_name)) {
2024- LOG (ERROR ) << " Contract module not found or contract function not defined\n " ;
2012+ LOG (ERROR ) << " Contract module not found or contract function not defined: "
2013+ << contract_function_name << " \n " ;
20252014 return ;
20262015 }
20272016
@@ -2077,10 +2066,10 @@ don't yet pass)
20772066 }
20782067
20792068 const auto &contract_spec = contract.spec .value ();
2080- std::string contract_function_name =
2081- namifyFunction (contract_spec.implementation .function_name );
2069+ std::string contract_function_name = namifyFunction (contract_spec.function_name );
20822070 if (!contract_module.lookupSymbol < cir::FuncOp >(contract_function_name)) {
2083- LOG (ERROR ) << " Contract module not found or contract function not defined\n " ;
2071+ LOG (ERROR ) << " Contract module not found or contract function not defined: "
2072+ << contract_function_name << " \n " ;
20842073 return ;
20852074 }
20862075
0 commit comments