diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-08-22 14:33:23 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-08-22 14:56:27 +0100 |
commit | cbfc0ee239fafc0dadaae314138410f9119c65fa (patch) | |
tree | 3b8d92a090ee0665df75c9b4e7c197d692e2d951 /gcc/rust/backend/rust-compile-resolve-path.h | |
parent | 79092784f20b99f26da847d2b921d3ea1ffc1a24 (diff) | |
download | gcc-cbfc0ee239fafc0dadaae314138410f9119c65fa.zip gcc-cbfc0ee239fafc0dadaae314138410f9119c65fa.tar.gz gcc-cbfc0ee239fafc0dadaae314138410f9119c65fa.tar.bz2 |
This allows for query based compilation
Rust can forward declare items to avoid the need for prototypes for
example. This means when a path resolved to a node we must look it up
and see if it is already compiled or go and compiler it. This also applies
to generics which are monomorphized and might have already been compiled.
This adds two new keyword arguments bool query_mode and ref_locus, these
say to the classes that this is query based mode and ICE when we get
error_mark_node when we fail to compile something. This will need to be
changed once we get to a certain level of maturity but this helps
diagnose bugs for now. The ref_locus refers to the location of the
reference to this item such that the compilation of an item can give us
a reference expression to this item with this ref_locus. For example:
call (123)
And call is query compiled and the ref_locus is this call_expression.
Diffstat (limited to 'gcc/rust/backend/rust-compile-resolve-path.h')
-rw-r--r-- | gcc/rust/backend/rust-compile-resolve-path.h | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/gcc/rust/backend/rust-compile-resolve-path.h b/gcc/rust/backend/rust-compile-resolve-path.h index 6c234d1..2b50ec1 100644 --- a/gcc/rust/backend/rust-compile-resolve-path.h +++ b/gcc/rust/backend/rust-compile-resolve-path.h @@ -54,15 +54,14 @@ private: : HIRCompileBase (ctx), resolved (ctx->get_backend ()->error_expression ()) {} - void resolve (const HIR::PathIdentSegment &final_segment, - const Analysis::NodeMapping &mappings, Location locus, - bool is_qualified_path); - - Bexpression * - query_compile_function (HirId ref, TyTy::FnType *fntype, - const HIR::PathIdentSegment &final_segment, - const Analysis::NodeMapping &mappings, - Location expr_locus, bool is_qualified_path); + Bexpression *resolve (const HIR::PathIdentSegment &final_segment, + const Analysis::NodeMapping &mappings, Location locus, + bool is_qualified_path); + + Bexpression *query_compile (HirId ref, TyTy::BaseType *lookup, + const HIR::PathIdentSegment &final_segment, + const Analysis::NodeMapping &mappings, + Location expr_locus, bool is_qualified_path); Bexpression *resolved; }; |