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

Method isWritable

ir/pointer.cpp:858–877  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

856}
857
858expr Pointer::isWritable() const {
859 auto bid = getShortBid();
860 expr non_local
861 = num_consts_src == 1 ? bid != has_null_block :
862 (num_consts_src ? bid.ugt(has_null_block + num_consts_src - 1) : true);
863 if (m.numNonlocals() > num_nonlocals_src)
864 non_local &= bid.ult(num_nonlocals_src);
865 if (has_null_block && null_is_dereferenceable)
866 non_local |= bid == 0;
867
868 non_local &= expr::mkUF("#is_writable", {bid}, expr(false));
869
870 // check for non-writable byval blocks (which are non-local)
871 for (auto [byval, is_const] : m.byval_blks) {
872 if (is_const)
873 non_local &= bid != byval;
874 }
875
876 return isLocal() || non_local;
877}
878
879expr Pointer::isByval() const {
880 auto this_bid = getShortBid();

Callers 1

isDereferenceableMethod · 0.80

Calls 4

ugtMethod · 0.80
numNonlocalsMethod · 0.80
ultMethod · 0.80
exprClass · 0.70

Tested by

no test coverage detected