| |
| /pliant/language/type/pointer/address.pli |
| |
| 1 |
scope "/pliant/language/" "/pliant/install/" | |
| 2 |
module "/pliant/install/ring2.pli" | |
| 3 |
| |
| 4 |
meta '. translate' e | |
| 5 |
if e:size<>2 or not (e:0 cast Address) or (e:1 constant Type)=null | |
| 6 |
return | |
| 7 |
e suckup e:0 | |
| 8 |
var Link:Type t :> (e:1 constant Type) map Type | |
| 9 |
var Link:Argument s :> argument constant Int t:size | |
| 10 |
var Link:Argument a :> argument local Address | |
| 11 |
e add (instruction (the_function '+' Int Int -> Int) e:0:result s a) | |
| 12 |
e set_result a access_read | |
| 13 |
| |
| 14 |
meta '. map' e | |
| 15 |
if e:size<>3 or not (e:0 cast Address) or (e:1 constant Type)=null or not (e:2 cast Int) | |
| 16 |
return | |
| 17 |
e suckup e:0 ; e suckup e:2 | |
| 18 |
var Link:Type t :> (e:1 constant Type) map Type | |
| 19 |
var Link:Argument s :> argument constant Int t:size | |
| 20 |
var Link:Argument m :> argument local Int | |
| 21 |
e add (instruction (the_function '*' Int Int -> Int) s e:2:result m) | |
| 22 |
var Link:Argument a :> argument local Address | |
| 23 |
e add (instruction (the_function '+' Int Int -> Int) e:0:result m a) | |
| 24 |
e set_result (argument indirect t a 0) access_read+access_write | |
| 25 |
| |
| 26 |
export '. translate' '. map' | |
| |