aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/rust-backend.h
diff options
context:
space:
mode:
authorDavid Faust <david.faust@oracle.com>2022-04-07 09:41:37 -0700
committerDavid Faust <david.faust@oracle.com>2022-04-07 09:57:46 -0700
commit5559bdc86635b2ff6cbaa60e933a7989ff212e1f (patch)
tree96e6621e8cb28606efa91c030d2b9de4c77339f6 /gcc/rust/rust-backend.h
parentb829e7c0a21c94672d09732e4a791e0471f41c13 (diff)
downloadgcc-5559bdc86635b2ff6cbaa60e933a7989ff212e1f.zip
gcc-5559bdc86635b2ff6cbaa60e933a7989ff212e1f.tar.gz
gcc-5559bdc86635b2ff6cbaa60e933a7989ff212e1f.tar.bz2
Emit loop initializer for repeat arrays
This commit changes how arrays of repeating elements, e.g. [5; 12] are compiled. Rather than create a constructor which explicitly initializes each element to the given value (which causes compiler OOM for large arrays), we emit instructions to allocate the array then initialize the elements in a loop. However, we can only take this approach outside of const contexts - const arrays must still use the old approach.
Diffstat (limited to 'gcc/rust/rust-backend.h')
-rw-r--r--gcc/rust/rust-backend.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/rust/rust-backend.h b/gcc/rust/rust-backend.h
index 6bfebe3..17b7bae 100644
--- a/gcc/rust/rust-backend.h
+++ b/gcc/rust/rust-backend.h
@@ -275,6 +275,10 @@ public:
const std::vector<tree> &vals, Location)
= 0;
+ virtual tree array_initializer (tree, tree, tree, tree, tree, tree *,
+ Location)
+ = 0;
+
// Return an expression for ARRAY[INDEX] as an l-value. ARRAY is a valid
// fixed-length array, not a slice.
virtual tree array_index_expression (tree array, tree index, Location) = 0;