From b8c96f32bd4bfdd28c1e3a630ea18e0dfcb1ce7f Mon Sep 17 00:00:00 2001 From: ceriel Date: Wed, 20 May 1992 10:54:28 +0000 Subject: [PATCH] Improved symbol table for grind --- lang/m2/comp/declar.g | 3 --- lang/m2/comp/stab.c | 18 ++++++++++++++++++ lang/m2/comp/type.c | 9 +++++++++ lang/pc/comp/stab.c | 18 ++++++++++++++++++ lang/pc/comp/type.c | 5 +++++ 5 files changed, 50 insertions(+), 3 deletions(-) diff --git a/lang/m2/comp/declar.g b/lang/m2/comp/declar.g index 50e623560..6b7af4496 100644 --- a/lang/m2/comp/declar.g +++ b/lang/m2/comp/declar.g @@ -188,9 +188,6 @@ TypeDeclaration '=' type(&tp) { DeclareType(nd, df, tp); FreeNode(nd); -#ifdef DBSYMTAB - if (options['g']) stb_string(df, D_TYPE); -#endif /* DBSYMTAB */ } ; diff --git a/lang/m2/comp/stab.c b/lang/m2/comp/stab.c index 604374155..078dc8e79 100644 --- a/lang/m2/comp/stab.c +++ b/lang/m2/comp/stab.c @@ -247,6 +247,24 @@ stb_type(tp, assign_num) } } +stb_addtp(s, tp) + char *s; + t_type *tp; +{ + create_db_str(); + adds_db_str(s); + addc_db_str(':'); + addc_db_str('t'); + stb_type(tp, 1); + addc_db_str(';'); + C_ms_stb_cst(db_str.base, + N_LSYM, + tp == void_type || tp->tp_size >= max_int[2] + ? 0 + : (int)tp->tp_size, + (arith) 0); +} + stb_string(df, kind) register t_def *df; { diff --git a/lang/m2/comp/type.c b/lang/m2/comp/type.c index 715cbefa0..045123540 100644 --- a/lang/m2/comp/type.c +++ b/lang/m2/comp/type.c @@ -25,6 +25,7 @@ #include "node.h" #include "scope.h" #include "walk.h" +#include "main.h" #include "chk_expr.h" #include "warning.h" #include "uns_arith.h" @@ -673,6 +674,9 @@ DeclareType(nd, df, tp) CheckForImports(df); } } +#ifdef DBSYMTAB + if (options['g']) stb_string(df, D_TYPE); +#endif SolveForwardTypeRefs(df); } @@ -688,6 +692,11 @@ SolveForwardTypeRefs(df) df->df_kind = D_TYPE; while (nd) { nd->nd_type->tp_next = df->df_type; +#ifdef DBSYMTAB + if (options['g'] && nd->nd_type->tp_dbindex < 0) { + stb_addtp("(forward_type)", nd->nd_type); + } +#endif nd = nd->nd_RIGHT; } FreeNode(df->df_forw_node); diff --git a/lang/pc/comp/stab.c b/lang/pc/comp/stab.c index 19fc45b0c..24096ee1a 100644 --- a/lang/pc/comp/stab.c +++ b/lang/pc/comp/stab.c @@ -229,6 +229,24 @@ stb_type(tp, assign_num) } } +stb_addtp(s, tp) + char *s; + struct type *tp; +{ + create_db_str(); + adds_db_str(s); + addc_db_str(':'); + addc_db_str('t'); + stb_type(tp, 1); + addc_db_str(';'); + C_ms_stb_cst(db_str.base, + N_LSYM, + tp == void_type || tp->tp_size > 32767 + ? 0 + : (IsPacked(tp) ? (int) tp->tp_psize : (int)tp->tp_size), + (arith) 0); +} + stb_string(df, kind) register struct def *df; long kind; diff --git a/lang/pc/comp/type.c b/lang/pc/comp/type.c index ca27e20eb..6dd131b7a 100644 --- a/lang/pc/comp/type.c +++ b/lang/pc/comp/type.c @@ -550,6 +550,11 @@ chk_forw_types() "identifier \"%s\" is not a type", df->df_idf->id_text); fw_type->f_type->next = tp; +#ifdef DBSYMTAB + if (options['g']) { + stb_addtp("(forward_type)", fw_type->f_type); + } +#endif fw_type = fw_type->f_next; } -- 2.34.1