diff options
author | Owen Avery <powerboat9.gamer@gmail.com> | 2023-09-12 12:52:25 -0400 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2023-09-14 21:12:42 +0000 |
commit | bdc7b1fa35659f47bfe30c1e7079847cbaba746e (patch) | |
tree | 5c578c137e34198d2cc448e70a4461d90c397912 /gcc/rust/rust-gcc.cc | |
parent | a7ac7228e390d2c2b6cf431df16689d444b4e468 (diff) | |
download | gcc-bdc7b1fa35659f47bfe30c1e7079847cbaba746e.zip gcc-bdc7b1fa35659f47bfe30c1e7079847cbaba746e.tar.gz gcc-bdc7b1fa35659f47bfe30c1e7079847cbaba746e.tar.bz2 |
Memoize Backend::wchar_type
gcc/rust/ChangeLog:
* rust-gcc.cc
(Backend::wchar_type): Store static wchar tree.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc/rust/rust-gcc.cc')
-rw-r--r-- | gcc/rust/rust-gcc.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc index 4906634..109b5d9 100644 --- a/gcc/rust/rust-gcc.cc +++ b/gcc/rust/rust-gcc.cc @@ -345,8 +345,14 @@ get_identifier_node (const std::string &str) tree wchar_type () { - tree wchar = make_unsigned_type (32); - TYPE_STRING_FLAG (wchar) = 1; + static tree wchar; + + if (wchar == NULL_TREE) + { + wchar = make_unsigned_type (32); + TYPE_STRING_FLAG (wchar) = 1; + } + return wchar; } |