aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-expr.h
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-05-20 13:35:54 +0100
committerPhilip Herron <philip.herron@embecosm.com>2022-05-20 15:57:22 +0100
commit39ae84825c5cc15edbb2fa9f5ecc70f93870e3ee (patch)
tree802a3e75033824c712556d092fb5d36760d9c399 /gcc/rust/backend/rust-compile-expr.h
parent5ad0ea3e0ed288569d52556b9aa796beea73d8a3 (diff)
downloadgcc-39ae84825c5cc15edbb2fa9f5ecc70f93870e3ee.zip
gcc-39ae84825c5cc15edbb2fa9f5ecc70f93870e3ee.tar.gz
gcc-39ae84825c5cc15edbb2fa9f5ecc70f93870e3ee.tar.bz2
Canonicalize types based on hashing than HirIds and TyTy equality
When we compile types for GCC we need to make sure we canonicalize them, this means that for any user defined type such as Structs or Tuples we want all expressions or declarations to use the same tree. Even if we have duplicate tree's we can end up confusing the middle-end and lose out on optimizations as we will be using view_convert_exprs to maintain the consistancy which will marshall between the objects unnessecarily. The old method for doing this kept mappings of HirIds which was fine for simple cases but when generics are involved new Id's are generated so this meant we ended up having a vector of pairs {TyTy::BaseType, tree} and we did a liner search to find the relevant TyTy::BaseType that we equaled to. This was not only slow but did not handle the cases for generic associated types or nested generics. So we needed a more general faster implementation therefore hashing. This patch takes the gcc/tree.h type_hash_canon code and adds in hashing for RECORD and UNION types. This means we will generate a duplicate type then hash it and look for an existing type. This patch will also allow us to fix how we implement monomorphization of functions by nesting the hashes behind DefId's.
Diffstat (limited to 'gcc/rust/backend/rust-compile-expr.h')
-rw-r--r--gcc/rust/backend/rust-compile-expr.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.h b/gcc/rust/backend/rust-compile-expr.h
index b05b129..655ffbb 100644
--- a/gcc/rust/backend/rust-compile-expr.h
+++ b/gcc/rust/backend/rust-compile-expr.h
@@ -20,7 +20,6 @@
#define RUST_COMPILE_EXPR
#include "rust-compile-base.h"
-#include "rust-compile-tyty.h"
#include "rust-compile-resolve-path.h"
#include "rust-compile-block.h"
#include "rust-compile-struct-field-expr.h"