MCPcopy Create free account
hub / github.com/Samsung/UTopia / updateDefault

Method updateDefault

lib/propanalysis/ArrayAnalyzer.cpp:475–519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

473}
474
475void ArrayAnalyzer::updateDefault(const llvm::Module &M) {
476 if (!Report)
477 return;
478
479 const std::map<Intrinsic::ID, std::map<unsigned, int>> DefaultIntrinsicMap = {
480 {{Intrinsic::memcpy, {{0, 2}, {1, 2}}},
481 {Intrinsic::memmove, {{0, 2}, {1, 2}}},
482 {Intrinsic::memset, {{0, 2}, {1, 2}}},
483 {Intrinsic::memcpy_element_unordered_atomic, {{0, 2}, {1, 2}}},
484 {Intrinsic::memmove_element_unordered_atomic, {{0, 2}, {1, 2}}},
485 {Intrinsic::memset_element_unordered_atomic, {{0, 2}, {1, 2}}}}};
486 const std::map<std::string, std::map<unsigned, int>> DefaultNameMap = {
487 {{"memcpy", {{0, 2}, {1, 2}}},
488 {"memmove", {{0, 2}, {1, 2}}},
489 {"memset", {{0, 2}, {1, 2}}},
490 {"memcpy_element_unordered_atomic", {{0, 2}, {1, 2}}},
491 {"memmove_element_unordered_atomic", {{0, 2}, {1, 2}}},
492 {"memset_element_unordered_atomic", {{0, 2}, {1, 2}}}}};
493
494 for (const auto &F : M) {
495 if (!F.isDeclaration())
496 continue;
497
498 auto IterIntrinsic = DefaultIntrinsicMap.find(F.getIntrinsicID());
499 if (IterIntrinsic != DefaultIntrinsicMap.end()) {
500 updateDefault(F, IterIntrinsic->second);
501 continue;
502 }
503
504 auto IterName = DefaultNameMap.find(F.getName().str());
505 if (IterName != DefaultNameMap.end())
506 updateDefault(F, IterName->second);
507 }
508
509 for (auto Iter : ArgFlowMap) {
510 auto &AF = Iter.second;
511 if (!AF)
512 continue;
513
514 if (AF->getState() != AnalysisState_Pre_Analyzed)
515 continue;
516
517 Report->add(*AF);
518 }
519}
520
521void ArrayAnalyzer::updateDefault(const llvm::Function &F,
522 const std::map<unsigned, int> &Values) {

Callers

nothing calls this directly

Calls 9

endMethod · 0.80
getStateMethod · 0.80
setStateMethod · 0.80
setIsArrayMethod · 0.80
getArgMethod · 0.80
findMethod · 0.45
getNameMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected