Appearance
| 1 | namespace Syntax.Process is | |
| 2 | use Trees; | |
| 3 | ||
| 4 | // Classifies innate operation bodies for the store-free analysis. | |
| 5 | // The innates are the operator functions in the internal library | |
| 6 | // whose bodies lower directly to IL instructions; value | |
| 7 | // arithmetic, comparisons, boolean logic, range construction and | |
| 8 | // reads are store-free, while reference and pointer assignment | |
| 9 | // store through their operand. Any innate not explicitly listed | |
| 10 | // is treated as storing. | |
| 11 | class STORE_FREE_INNATES is | |
| 12 | is_store_free(name: Identifiers.Identifier?) -> bool static is | |
| 13 | if !name? then | |
| 14 | return false; | |
| 15 | fi | |
| 16 | ||
| 17 | let leaf = name.name; | |
| 18 | ||
| 19 | if let name.qualifier? then | |
| 20 | let family = qualifier.name; | |
| 21 | ||
| 22 | if | |
| 23 | family =~ "arithmetic" \/ | |
| 24 | family =~ "arithmetic_decimal" \/ | |
| 25 | family =~ "bool" \/ | |
| 26 | family =~ "compare" \/ | |
| 27 | family =~ "compare_decimal" \/ | |
| 28 | family =~ "range" | |
| 29 | then | |
| 30 | return true; | |
| 31 | fi | |
| 32 | ||
| 33 | if family =~ "string" /\ leaf =~ "equals" then | |
| 34 | return true; | |
| 35 | fi | |
| 36 | ||
| 37 | if (family =~ "reference" \/ family =~ "pointer") /\ leaf =~ "read" then | |
| 38 | return true; | |
| 39 | fi | |
| 40 | fi | |
| 41 | ||
| 42 | return false; | |
| 43 | si | |
| 44 | si | |
| 45 | si |