editing disabled
vivdesh
guest · Join · Help · Sign In · Wikispaces

Protected
Vector extensions and advanced pseudo compiler

For intermediate representation of the instructions that are transformed, vector constructs were added to the pseudo language.
- An array reference can be a range in the form lb:ub where ‘lb’ and ‘ub’ are arithmetic expressions which represent the lower and upper bounds respectively. So array references can be of the form a[10:20] or a[10*i:20*i]
- Arithmetic operators for vector operands take the ‘range’ in the form ‘op:range’ where range is an integer specifying the length of the operands. For example +:16 specifies ‘+’ operation on two operands of size 16 doubles
- Assignment involving vector data must also be appended with size of data as in,
a[11:20] :=:10 b[11:20] +:10 c[11:20]
● range ß aexpr : aexpr
● vexpr ß ID[range]
ß vexpr ARITH_OP :INT vexpr
● assignment ß ID[range] :=:INT vexpr
The advanced compiler transforms code with normal statements + vector statements to LLVM IR code. In our processing sequence, it takes the intermediate .tmp file as input which is generated by vectorization phase and translates it into LLVM IR vector operations. LLVM IR supports vector operations in the form of vector data types and all the operations work on vector data types. More details of LLVM vector instruction are given in [1].
Abstract Syntax Tree
The advanced pseudo compiler uses abstract syntax tree for the generation of LLVM IR. Since the range of a vector operation is associated with the operator and not with the operands, while parsing the operands this range is not known. So while parsing, all expressions are parsed into an AST which is transformed to LLVM IR operations later when the entire expression is parsed. This also facilitates generation of unnamed temporary variables in program order which is a requirement in LLVM IR. Abstract syntax tree also gives reusability and flexibility.

Home
Loading...
Home Turn Off "Getting Started"
Loading...