| 456 | | |
| 457 | | * **absence of depends clause**: |
| 458 | | * assigns-or-reads clause |
| 459 | | * assigns clause: `assigns [condition] {memory-list}` |
| 460 | | * reads clause: `reads [condition] {memory-list}` |
| 461 | | * `reads {nothing}` implies `assigns {nothing}` |
| 462 | | * `reads {\nothing}` is equivalent to: `reads {\nothing} assigns {\nothing}` |
| 463 | | * `assigns {X}` where `X != \nothing`, implies `reads {X}` |
| 464 | | * `assigns {X}` is equivalent to:` assigns{X} reads{X}` |
| | 456 | * absence of depends clause: there is no information about the dependency of the function, which means that the analysis needs to figure it out by itself. |
| | 457 | * some facts about assigns-or-reads clause |
| | 458 | * `reads nothing` implies `assigns nothing` |
| | 459 | * `reads nothing` is equivalent to: `ma_union(reads nothing, assigns nothing)` |
| | 460 | * `assigns X` where `X != nothing`, implies `reads X` |
| | 461 | * `assigns X` is equivalent to: `ma_union(assigns X, reads X)` |
| 468 | | * `reads/assigns {\nothing}` doesn’t necessarily means that the function never reads or assigns any variable. The function could still reads/assigns its “local” variables, including function parameters and any variable declared inside the function body. |
| 469 | | |
| 470 | | * For an independent function which has `depends {\nothing}`, usually we also need to specify `reads{nothing}`, for the purpose of reachability analysis. |
| | 465 | * `reads/assigns nothing` doesn’t necessarily means that the function never reads or assigns any variable. The function could still reads/assigns its “local” variables, including function parameters and any variable declared inside the function body. |
| | 466 | |
| | 467 | * For an independent function which has `depends nothing`, usually we also need to specify `reads nothing`, for the purpose of reachability analysis. |
| 482 | | atomic_f sendRecv(Int cmd, Pointer buf; Int) |
| 483 | | depends [eq(cmd, SEND)] {write(buf)} |
| 484 | | depends [eq(cmd, RECV)] {access(deref(buf))} |
| 485 | | assigns [eq(cmd, SEND)] {\nothing} |
| 486 | | assigns [eq(cmd, RECV)] {deref(buf)} |
| 487 | | reads {deref(buf)} |
| | 479 | atomic_f sendRecv(Int cmd, Pointer buf): Integer |
| | 480 | depends [eq(cmd, SEND)] writes(buf) |
| | 481 | depends [eq(cmd, RECV)] access(deref(buf)) |
| | 482 | assigns [eq(cmd, SEND)] nothing |
| | 483 | assigns [eq(cmd, RECV)] deref(buf) |
| | 484 | reads deref(buf) |