Changes between Version 132 and Version 133 of IR
- Timestamp:
- 12/10/15 16:49:05 (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
IR
v132 v133 387 387 mpi_requires expr ; 388 388 mpi_ensures expr ; 389 assigns expr ; 390 reads expr ; 391 depends actions ; 389 behavior name: 390 assigns expr ; 391 reads expr ; 392 depends actions ; 392 393 { 393 394 // all of the following are missing for a system function... … … 444 445 445 446 * memory set action expressions: 446 * `read s e`: `e` has type `Mem`. The function reads the memory units specified by `e`.447 * ` assigns e`: `e` has type `Mem`. The function writes the memory units specified by `e`.448 * `call s f, <e1, ...>`: `f` has type `Function`. The function calls `f` with parameters `e1, ...`.449 * `no thing`: no action450 * ` everything`: all actions451 * ` ma_union(ma0, ma1)`: the union of the two memory set actions `ma0` and `ma1`.452 * ` ma_comp(ma0, ma1)`: action complement (everything not in `ma1`)453 * ` ma_isect(ma0, ma1)`: action intersection454 455 * depends clause: `depends [condition]action0, action1, action2, ... `456 * Example: `depends ma_union(ma_comp(reads n, calls inc, <x>)), calls(dec, y))`447 * `read(e)`: `e` has type `Mem`. The function reads the memory units specified by `e`. 448 * `write(e)`: `e` has type `Mem`. The function writes the memory units specified by `e`. 449 * `call(f, <e1, ...>)`: `f` has type `Function`. The function calls `f` with parameters `e1, ...`. 450 * `noaction`: no action 451 * `anyaction`: all actions 452 * `act_union(ma0, ma1)`: the union of the two memory set actions `ma0` and `ma1`. 453 * `act_comp(ma0, ma1)`: action complement (everything not in `ma1`) 454 * `act_isect(ma0, ma1)`: action intersection 455 456 * depends clause: `depends action0, action1, action2, ... ` 457 * Example: `depends act_union(act_comp(read(n), call(inc, <x>))), call(dec, <y>))` 457 458 * 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. 458 459 * some facts about assigns-or-reads clause 459 * `reads nothing` implies `assigns nothing` 460 * `reads nothing` is equivalent to: `ma_union(reads nothing, assigns nothing)` 461 * `assigns X` where `X != nothing`, implies `reads X` 462 * `assigns X` is equivalent to: `ma_union(assigns X, reads X)` 463 * absence: 464 * absence of `reads` clause: there is no assumption about the read access of the function, i.e., the function could read anything 460 * absence of `reads`/`assigns` clause: there is no assumption about the read/assign access of the function, i.e., the function could read/assign anything 465 461 * absence of `assigns` clause: similar to the absence of `reads` clause 466 * `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. 462 * `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. **check it** 467 463 468 464 * For an independent function which has `depends nothing`, usually we also need to specify `reads nothing`, for the purpose of reachability analysis. … … 479 475 {{{ 480 476 fun[atomic] sendRecv(Int cmd, Pointer buf): Integer 481 depends [eq(cmd, SEND)] writes(buf) 482 depends [eq(cmd, RECV)] access(deref(buf)) 483 assigns [eq(cmd, SEND)] nothing 484 assigns [eq(cmd, RECV)] deref(buf) 485 reads deref(buf) 477 reads deref(buf); 478 behavior send: 479 depends writes(buf); 480 assigns nothing; 481 behavior receive: 482 depends access(deref(buf)); 483 assigns deref(buf); 486 484 { 487 485 begin choose 488 when (eq(cmd, SEND))486 when (eq(cmd, 0)) 489 487 do CALL send, <buf, ...>; goto L1; 490 when (eq(cmd, RECV))488 when (eq(cmd, 1)) 491 489 do CALL recv, <buf, ...>; goto L1; 492 when (and(neq(cmd, SEND), neq(cmd, RECV)))490 when (and(neq(cmd, 0), neq(cmd, 1))) 493 491 do NOOP; goto L1; 494 492 end choose
