From e00d31baa0e7190b959cfb03df03b260e402da05 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 22 Oct 2014 13:15:33 +0200 Subject: Rework for support of generic packages. --- sem_inst.ads | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 sem_inst.ads (limited to 'sem_inst.ads') diff --git a/sem_inst.ads b/sem_inst.ads new file mode 100644 index 000000000..da8cd5d27 --- /dev/null +++ b/sem_inst.ads @@ -0,0 +1,26 @@ +-- Package (and subprograms) instantiations + +-- When a package is instantiated, we need to 'duplicate' its declaration. +-- This looks useless for analysis but it isn't: a type from a package +-- instantiated twice declares two different types. Without duplication, we +-- need to attach to each declaration its instance, which looks more expansive +-- that duplicating the declaration. +-- +-- Furthermore, for generic type interface, it looks a good idea to duplicate +-- the body (macro expansion). +-- +-- Duplicating is not trivial: internal links must be kept and external +-- links preserved. A table is used to map nodes from the uninstantiated +-- package to its duplicated node. Links from instantiated declaration to +-- the original declaration are also stored in that table. + +with Iirs; use Iirs; + +package Sem_Inst is + -- Return the origin of node N, the node from which N was instantiated. + -- If N is not an instance, this function returns Null_Iir. + function Get_Origin (N : Iir) return Iir; + + -- Create declaration chain and generic declarations for INST from PKG. + procedure Instantiate_Package_Declaration (Inst : Iir; Pkg : Iir); +end Sem_Inst; -- cgit v1.2.3