diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-10-28 11:07:13 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-10-28 11:07:13 +0100 |
commit | 0114e3e5b3b222c190a640bdeda8e781042389c4 (patch) | |
tree | 4afc284f874d636b620e233f08050d607faecc59 /gcc/rust/backend | |
parent | 657a9735339f6e5b0723bc24f74ad55d78daae8e (diff) | |
download | gcc-0114e3e5b3b222c190a640bdeda8e781042389c4.zip gcc-0114e3e5b3b222c190a640bdeda8e781042389c4.tar.gz gcc-0114e3e5b3b222c190a640bdeda8e781042389c4.tar.bz2 |
Add constant folding to ArrayIndexExpr
This ensures that constexpr is enforced for array-index-exprs resulting in
gimple like this:
```rust
fn main() {
const A: [i32; 3] = [1, 2, 3];
const B: i32 = A[1];
const C: usize = 42;
const D: i32 = 7;
let _a = C;
let _b: [i32; C] = [0; C];
let _c = B + D;
}
```
```c
void main ()
{
const usize _a;
i32 _b[42];
const i32 _c;
try
{
_a = 42;
_b = {};
_1 = 2;
_c = _1 + 7;
}
finally
{
_b = {CLOBBER};
}
}
```
Diffstat (limited to 'gcc/rust/backend')
0 files changed, 0 insertions, 0 deletions