aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2020-12-21 15:52:23 +0000
committerPhilip Herron <herron.philip@googlemail.com>2020-12-23 14:47:34 +0000
commitd1afbb7ead51347a84da62a6be9f98b0742538de (patch)
tree220f0a8396e7018041622da455562362a23041e6 /gcc/rust/backend
parentf701ad5352c7bc8dad53a1ee7f666c8365b35307 (diff)
downloadgcc-d1afbb7ead51347a84da62a6be9f98b0742538de.zip
gcc-d1afbb7ead51347a84da62a6be9f98b0742538de.tar.gz
gcc-d1afbb7ead51347a84da62a6be9f98b0742538de.tar.bz2
Implement compilation of ArrayElemsCopied to GIMPLE
let mut array = [123; 5]
Diffstat (limited to 'gcc/rust/backend')
-rw-r--r--gcc/rust/backend/rust-compile-expr.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.h b/gcc/rust/backend/rust-compile-expr.h
index 6ea97ee..5c3206a 100644
--- a/gcc/rust/backend/rust-compile-expr.h
+++ b/gcc/rust/backend/rust-compile-expr.h
@@ -211,6 +211,15 @@ public:
});
}
+ void visit (HIR::ArrayElemsCopied &elems)
+ {
+ Bexpression *translated_expr
+ = CompileExpr::Compile (elems.get_elem_to_copy (), ctx);
+
+ for (size_t i = 0; i < elems.get_num_elements (); ++i)
+ constructor.push_back (translated_expr);
+ }
+
void visit (HIR::ArithmeticOrLogicalExpr &expr)
{
Operator op;