Changes between Version 56 and Version 57 of IR
- Timestamp:
- 11/25/15 11:29:13 (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
IR
v56 v57 159 159 * **what particular notations for floating values?** 160 160 * 'a', 'b', ... **UNICODE?** 161 * `\ cast(Array[T], {e0, e1, ...})` : values of type `Array[T]` **THIS IS NOT A CAST. Need better notation **162 * `\ cast(S, {e0, ...})` : values of type `S` (struct literal) **THIS IS NOT A CAST. Need better notation **161 * `\array(T, (e0, e1, e2, ...))`: values of type `Array[T]`; and `\array(T, n, e)`: an array of type `T` with `n` elements each of which being `e` 162 * `\tuple(S, (e0, e1, ...))` : values of type `S` (struct literal) 163 163 * `e1..e2`, `e1..e2#e3` : values of type `\Range` 164 * `\ cast(Domain, {r1,...,rn})` : value of type `Domain[n]` **NOT A CAST**164 * `\domain(r1,...,rn)` : value of type `Domain[n]` 165 165 * `"abc"` : string literals: value of type `Array[Char]` 166 166 * `\root`, `\here` : values of type `Scope` … … 169 169 * variables 170 170 * `\sizeof_type(t)` : the size of the dynamic type t 171 * `\sizeof (e)` : the size of the value of expression `e` **Should this be \sizeof_expr since the other one is \sizeof_type ?**171 * `\sizeof_expr(e)` : the size of the value of expression `e` 172 172 * `\new(t)` : new (default) value of specified dynamic type 173 173 * `\defined(e)` : is `e` defined? Type is `Bool` … … 183 183 * `\mod(e1, e2)` : modulus 184 184 * `\array_subscript(e1, e2)` : array subscript expression. Note that `e1` must have array type, not pointer type. (This is different from C.) If `e1` has pointer type, use `\deref(\padd(e1, e2))` instead. 185 * **maybe shorten to `\sub`? **185 * **maybe shorten to `\sub`? --do you mean `\array_sub` instead?** 186 186 * `\deref(e)` : pointer dereference 187 * `\address _of(e)` : address-of. **Or: \addressof ? After all, we have \sizeof.**187 * `\addressof(e)` : address-of. 188 188 * `\not(e)` : logical not 189 189 * `\neg(e)` : negative … … 213 213 214 214 * Assign: `e1:=e2;` 215 * Call: `\call e0, (e1,...,en);` and `\call e, e0, (e1,...,en);`215 * Call: `\call f, (e1,...,en);` and `\call e, f, (e1,...,en);` 216 216 * regular function (one with flow graph) 217 217 * ** distinguish this kind of call from an expression involving a pure system or abstract call???** 218 * Spawn: `\spawn e0, (e1,...,en);` and `\spawn e, e0, (e1,...,en);`218 * Spawn: `\spawn f, (e1,...,en);` and `\spawn e, f, (e1,...,en);` 219 219 * Wait: `\wait e;` 220 * Wailtall: `\waitall e ` where `e` is an array of process references (`Proc`) to be waited for;220 * Wailtall: `\waitall e, n` where `e` is a pointer to a process reference and `n` is the number of processes to be waited for 221 221 * Allocation 222 222 * `\allocate e, h, t, e0;`, where 223 * `h` as type `Heap` 223 * `e` has type `Pointer` 224 * `h` has type `Heap` 224 225 * `t` has type `Dytype` 225 226 * `e0` has integer type. 226 227 * Allocates `e0` objects of type `t` on heap `h` 227 * To translate the C `malloc` you first need to figure out the type of the elements being malloced. If the argument to malloc is `n`, then you first need to insert an assertion `\eq(\mod(n, \sizeof_type(t)), 0)`, and then `\allocate (h,t,\div(n, \sizeof_t(t)))`.228 * To translate the C `malloc` you first need to figure out the type of the elements being malloced. If the argument to malloc is `n`, then you first need to insert an assertion `\eq(\mod(n, \sizeof_type(t)), 0)`, and then `\allocate e, h, t, \div(n, \sizeof_type(t))`. 228 229 * Free: `\free p;` 229 230 * Expression statement: `e;`, where `e` is side effect free except that it might contain error/exception (e.g., array index out of bound, division by zero); … … 233 234 * Atomic_enter: `\atomic_enter;` 234 235 * Atomic_exit: `\atomic_exit;` 235 * Parfor_spawn: `\parspawn (int i,j,..: dom) f(i,j,...);`236 * Domain iterator: `\next (dom,i,j,…)` updates `i`, `j`, ... to be the value of the inter tuple in `dom` after `(i, j, ...)`237 * For_dom_enter (for domains): `\for_enter (i,j,k..: dom);`236 * Parfor_spawn: `\parspawn p, d, f;` where `p` is pointer to process reference, `d` has `Domain` type and `f` has `Function` type. 237 * Domain iterator: `\next dom, (i,j,…)` updates `i`, `j`, ... to be the value of the inter tuple in `dom` after `(i, j, ...)` 238 * For_dom_enter (for domains): `\for_enter dom;` 238 239 239 240 == Declarations and Function Definitions == … … 319 320 \reads {\deref(buf)} 320 321 { 321 if(\eq(cmd, SEND)){ 322 send(\deref(buf), ...); 323 }else if(\eq(cmd, RECV)){ 324 \deref(buf):=recv(...); 325 } 322 L0: 323 when (\eq(cmd, SEND)) 324 send(\deref(buf), ...); goto L1; 325 when (\eq(cmd, RECV)) 326 \deref(buf):=recv(...); goto L1; 327 when (\and(\neq(cmd, SEND), \neq(cmd, RECV))) 328 ; goto L1; 329 L1: 326 330 } 327 331 }}}
