Changes between Version 56 and Version 57 of IR


Ignore:
Timestamp:
11/25/15 11:29:13 (10 years ago)
Author:
zmanchun
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • IR

    v56 v57  
    159159  * **what particular notations for floating values?**
    160160 * '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)
    163163 * `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]`
    165165 * `"abc"` : string literals: value of type `Array[Char]`
    166166 * `\root`, `\here` : values of type `Scope`
     
    169169* variables
    170170* `\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`
    172172* `\new(t)` : new (default) value of specified dynamic type
    173173* `\defined(e)` : is `e` defined? Type is `Bool`
     
    183183* `\mod(e1, e2)` : modulus
    184184* `\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?**
    186186* `\deref(e)` : pointer dereference
    187 * `\address_of(e)` : address-of. **Or: \addressof ?   After all, we have \sizeof.**
     187* `\addressof(e)` : address-of.
    188188* `\not(e)` : logical not
    189189* `\neg(e)` : negative
     
    213213
    214214* 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);`
    216216 * regular function (one with flow graph)
    217217 * ** 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);`
    219219* 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
    221221* Allocation
    222222 * `\allocate e, h, t, e0;`, where
    223   * `h` as type `Heap`
     223  * `e` has type `Pointer`
     224  * `h` has type `Heap`
    224225  * `t` has type `Dytype`
    225226  * `e0` has integer type.
    226227 * 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))`.
    228229* Free: `\free p;`
    229230* 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);
     
    233234* Atomic_enter: `\atomic_enter;`
    234235* 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;`
    238239
    239240== Declarations and Function Definitions ==
     
    319320  \reads {\deref(buf)}
    320321{
    321   if(\eq(cmd, SEND)){
    322      send(\deref(buf), ...);
    323   }else if(\eq(cmd, RECV)){
    324     \deref(buf):=recv(...);
    325   }
     322L0:
     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;
     329L1:
    326330}
    327331}}}