Changes between Version 113 and Version 114 of IR


Ignore:
Timestamp:
12/02/15 11:20:55 (10 years ago)
Author:
zmanchun
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • IR

    v113 v114  
    3939varopts: '[' varopt+ ']' ;
    4040varopt: 'input' | 'output' ;
    41 fundef:  'fun' funopts? ID '(' paramlist ')' ':' typeName conclause* block ;
     41fundef:  'fun' funopts? ID '(' paramlist ')' (':' typeName)? conclause* block ;
    4242funopts: '[' funopt+ ']' ;
    4343conclause : 'assigns' expr ';'
     
    128128* `Array[T]` : arrays of any length whose elements belong to T
    129129 * Note: there is also a dynamic type `Array[T,n]`, signifying arrays of length n.  That is a subtype of the dynamic type of `Array[T]`.
    130 * `Function[<T0,T1,...>,T]` : functions consuming `T0`,`T1`,... and returning `T`.  `T` can be `void` to indicate nothing is returned.
     130* `Function[<T0,T1,...>,T]` : functions consuming `T0`,`T1`,... and returning `T`. 
     131 * `T` can be absent. `Function[<T0,T1,...>]` means the function returns nothing.
    131132* `Mem` : type representing a memory set.  May be thought of as a set of pointers.
    132133* `Pointer` : all pointers, a subtype of `Mem`
     
    332333* `PARSPAWN p, d, f;` : spawn a sequence of procs
    333334 * `p` has type `Pointer[Proc]`,  `d` has `Domain` type and `f` has `Function` type.
     335
     336The CIVL-C code `$parfor(int i,j: dom) S;` is translated into the following:
     337{{{
     338  var i:Integer;
     339  var j:Integer;
     340  var p:Array[Proc];
     341
     342  fun f()
     343  {
     344    S;
     345  }
     346
     347  PARSPAWN addr(asub(p,0)), dom, f;
     348  WAITALL addr(asub(p,0)), domsize(dom);
     349}}}
     350
    334351* `NEXT <i,j,...>, dom, flag;` : move to next element in domain
    335352 * `i`,`j`,... have integral types
     
    389406}
    390407}}}
     408
     409To specify a function returning nothing, simply leave out the return type part. For example: `fun foo(x:Intger, ...) {...}`.
    391410
    392411