MCPcopy Create free account
hub / github.com/AliveToolkit/alive2 / may_be_nonlocal

Function may_be_nonlocal

tools/transform.cpp:842–880  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

840}
841
842static bool may_be_nonlocal(Value *ptr) {
843 vector<Value*> todo = { ptr };
844 set<Value*> seen;
845 do {
846 ptr = todo.back();
847 todo.pop_back();
848 if (!seen.insert(ptr).second)
849 continue;
850
851 if (returns_local(*ptr))
852 continue;
853
854 if (auto gep = dynamic_cast<GEP*>(ptr)) {
855 todo.emplace_back(&gep->getPtr());
856 continue;
857 }
858
859 if (auto c = isNoOp(*ptr)) {
860 todo.emplace_back(c);
861 continue;
862 }
863
864 if (auto phi = dynamic_cast<Phi*>(ptr)) {
865 auto ops = phi->operands();
866 todo.insert(todo.end(), ops.begin(), ops.end());
867 continue;
868 }
869
870 if (auto s = dynamic_cast<Select*>(ptr)) {
871 todo.emplace_back(s->getTrueValue());
872 todo.emplace_back(s->getFalseValue());
873 continue;
874 }
875 return true;
876
877 } while (!todo.empty());
878
879 return false;
880}
881
882static pair<Value*, uint64_t> collect_gep_offsets(Value &v) {
883 Value *ptr = &v;

Callers 1

returns_nonlocalFunction · 0.85

Calls 8

returns_localFunction · 0.85
isNoOpFunction · 0.85
getTrueValueMethod · 0.80
getFalseValueMethod · 0.80
operandsMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected