stage3/forced_narrow_candidate_datatypes.cc
author Mario de Sousa <msousa@fe.up.pt>
Thu, 18 Oct 2012 10:57:13 +0100
changeset 681 e837adad2437
parent 679 2f5618c0039a
child 684 0e417d42cf6a
permissions -rw-r--r--
Do not repeat narrow algorithm for ST code, and better comments.
677
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     1
/*
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     2
 *  matiec - a compiler for the programming languages defined in IEC 61131-3
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     3
 *
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     4
 *  Copyright (C) 2012  Mario de Sousa (msousa@fe.up.pt)
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     5
 *
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     6
 *  This program is free software: you can redistribute it and/or modify
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     7
 *  it under the terms of the GNU General Public License as published by
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     8
 *  the Free Software Foundation, either version 3 of the License, or
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     9
 *  (at your option) any later version.
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    10
 *
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    11
 *  This program is distributed in the hope that it will be useful,
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    14
 *  GNU General Public License for more details.
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    15
 *
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    16
 *  You should have received a copy of the GNU General Public License
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    17
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    18
 *
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    19
 *
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    20
 * This code is made available on the understanding that it will not be
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    21
 * used in safety-critical situations without a full and competent review.
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    22
 */
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    23
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    24
/*
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    25
 * An IEC 61131-3 compiler.
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    26
 *
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    27
 * Based on the
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    28
 * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    29
 *
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    30
 */
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    31
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    32
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    33
/*
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    34
 *  Data type analysis of IL code may leave some IL instructions with an undefined datatype.
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    35
 *  This visitor will set the datatype for all these symbols, so that all symbols have a well 
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    36
 *  defined datatype when we reach stage4.
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    37
 *
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    38
 *  Example:
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    39
 * =========
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    40
 *
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    41
 *  VAR 
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    42
 *     N   : INT := 99 ;    
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    43
 *     tonv: TON;
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    44
 *     byte_var: BYTE;
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    45
 *     tonv : TON;
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    46
 *     a : BYTE;
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    47
 *     t : time;
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    48
 *     tod1: tod;
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    49
 *  END_VAR
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    50
 *  
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    51
 * (0) --> Data type before executing forced_narrow_candidate_datatypes_c
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    52
 * (1) --> Data type after executing 1st pass of forced_narrow_candidate_datatypes_c
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    53
 * (2) --> Data type after executing 2nd pass of forced_narrow_candidate_datatypes_c
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    54
 * 
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    55
 * --- --> NULL (undefined datatype)
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    56
 * *** --> invalid_type_name_c (invalid datatype)
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    57
 *
681
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    58
 * (0)   PASS1   (1)    PASS2   (2)
677
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    59
 *      
681
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    60
 * ---     (e)   ***            ***       CAL tonv (                          
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    61
 *                                               PT := T#1s                   
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    62
 *                                            )                               
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    63
 * ---     (e)   ***            ***       JMP l4                              
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    64
 *
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    65
 * ---     (e)   sint           sint  l0: LD  1                               
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    66
 * ---     (e)   sint           sint      ADD 2                               
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    67
 * ---  (c)      sint           sint      CAL tonv (                          
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    68
 *                                            PT := T#1s                      
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    69
 *                                            )                               
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    70
 *                                                                            
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    71
 * ---     (e)   sint           sint      LD  45                              
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    72
 * ---  (c)      sint           sint      ADD 45                              
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    73
 *
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    74
 *
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    75
 * ---     (e)   sint           sint      LD  3                               
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    76
 * ---     (e)   sint           sint  l1:                                     
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    77
 * ---  (c)      sint           sint  l2: ADD 4                               
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    78
 * int           int            int       LD  5                               
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    79
 * int           int            int       ST  n                               
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    80
 * int           int            int       JMP l3                              
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    81
 *                                                                            
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    82
 * ---  (d)      ---      (e)   sint      LD  5                               
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    83
 * ---  (d)      ---      (e)   sint      SUB 6                               
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    84
 * ---  (d)(e)   sint           sint      JMP l1                              
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    85
 *
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    86
 * ---     (e)   bool           bool      LD  FALSE                           
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    87
 * ---     (e)   bool           bool      NOT                                 
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    88
 * ---  (b)      bool           bool      RET                                 
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    89
 *
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    90
 * int           int            int   l3:                                     
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    91
 * int           int            int       ST  n                               
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    92
 * ---  (b)      int            int       RET                                 
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    93
 *
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    94
 * ---     (e)   ***            ***   l4:                                     
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    95
 * ---     (e)   ***            ***       CAL tonv (                          
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    96
 *                                               PT := T#1s                   
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    97
 *                                            )                               
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    98
 * ---  (a)      ***            ***       JMP l0                              
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
    99
 * ---  (b)      byte           byte      LD  88                              
677
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   100
 *
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   101
 *
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   102
 *   
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   103
 */
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   104
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   105
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   106
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   107
#include "forced_narrow_candidate_datatypes.hh"
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   108
#include "datatype_functions.hh"
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   109
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   110
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   111
/* set to 1 to see debug info during execution */
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   112
static int debug = 0;
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   113
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   114
forced_narrow_candidate_datatypes_c::forced_narrow_candidate_datatypes_c(symbol_c *ignore) 
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   115
 :narrow_candidate_datatypes_c(ignore) {
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   116
}
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   117
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   118
forced_narrow_candidate_datatypes_c::~forced_narrow_candidate_datatypes_c(void) {
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   119
}
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   120
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   121
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   122
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   123
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   124
681
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
   125
677
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   126
/****************************************/
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   127
/* B.2 - Language IL (Instruction List) */
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   128
/****************************************/
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   129
/***********************************/
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   130
/* B 2.1 Instructions and Operands */
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   131
/***********************************/
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   132
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   133
/*| instruction_list il_instruction */
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   134
// SYM_LIST(instruction_list_c)
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   135
void *forced_narrow_candidate_datatypes_c::visit(instruction_list_c *symbol) {
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   136
  for(int j = 0; j < 2; j++) {
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   137
    for(int i = symbol->n-1; i >= 0; i--) {
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   138
      symbol->elements[i]->accept(*this);
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   139
    }
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   140
  }
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   141
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   142
  /* Assert that this algorithm managed to remove all NULL datatypes! */
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   143
  for(int i = symbol->n-1; i >= 0; i--) {
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   144
    if (NULL == symbol->elements[i]->datatype)
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   145
      ERROR;
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   146
  }
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   147
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   148
  return NULL;
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   149
}
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   150
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   151
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   152
  
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   153
/* | label ':' [il_incomplete_instruction] eol_list */
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   154
// SYM_REF2(il_instruction_c, label, il_instruction)
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   155
// void *visit(instruction_list_c *symbol);
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   156
void *forced_narrow_candidate_datatypes_c::visit(il_instruction_c *symbol) {
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   157
  if (NULL == symbol->datatype) {
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   158
    if (symbol->candidate_datatypes.empty()) {
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   159
      symbol->datatype = &(search_constant_type_c::invalid_type_name); // This will occur in the situations (a) in the above example
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   160
      // return NULL; // No need to return control to the visit() method of the base class... But we do so, just to be safe (called at the end of this function)!
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   161
    } else {
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   162
      if (symbol->next_il_instruction.empty()) {
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   163
        symbol->datatype = symbol->candidate_datatypes[0]; // This will occur in the situations (b) in the above example
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   164
      } else {
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   165
        symbol_c *next_datatype = NULL;
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   166
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   167
        /* find the datatype of the following IL instructions (they should all be identical by now, but we don't have an assertion checking for this. */
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   168
        for (unsigned int i=0; i < symbol->next_il_instruction.size(); i++)
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   169
          if (NULL != symbol->next_il_instruction[i]->datatype)
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   170
            next_datatype = symbol->next_il_instruction[i]->datatype;
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   171
        if (get_datatype_info_c::is_type_valid(next_datatype)) {
681
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
   172
          //  This will occur in the situations (c) in the above example
677
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   173
          symbol->datatype = symbol->candidate_datatypes[0]; 
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   174
        } else {
681
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
   175
          //  This will occur in the situations (d) in the above example
677
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   176
          // it is not possible to determine the exact situation in the current pass, so we can't do anything just yet. Leave it for the next time around!
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   177
        }
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   178
      }
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   179
    }
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   180
  }
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   181
  
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   182
  /* return control to the visit() method of the base class! */
681
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
   183
  narrow_candidate_datatypes_c::visit(symbol);  //  This handle the situations (e) in the above example
677
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   184
  
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   185
  return NULL;
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   186
}
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   187
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   188
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   189
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   190
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   191
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   192
/* | il_simple_operator [il_operand] */
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   193
// SYM_REF2(il_simple_operation_c, il_simple_operator, il_operand)
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   194
// void *forced_narrow_candidate_datatypes_c::visit(il_simple_operation_c *symbol)
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   195
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   196
/* | function_name [il_operand_list] */
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   197
/* NOTE: The parameters 'called_function_declaration' and 'extensible_param_count' are used to pass data between the stage 3 and stage 4. */
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   198
// SYM_REF2(il_function_call_c, function_name, il_operand_list, symbol_c *called_function_declaration; int extensible_param_count;)
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   199
// void *forced_narrow_candidate_datatypes_c::visit(il_function_call_c *symbol) 
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   200
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   201
/* | il_expr_operator '(' [il_operand] eol_list [simple_instr_list] ')' */
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   202
// SYM_REF3(il_expression_c, il_expr_operator, il_operand, simple_instr_list);
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   203
// void *forced_narrow_candidate_datatypes_c::visit(il_expression_c *symbol)
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   204
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   205
/*  il_jump_operator label */
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   206
// SYM_REF2(il_jump_operation_c, il_jump_operator, label)
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   207
// void *forced_narrow_candidate_datatypes_c::visit(il_jump_operation_c *symbol)
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   208
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   209
/*   il_call_operator prev_declared_fb_name
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   210
 * | il_call_operator prev_declared_fb_name '(' ')'
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   211
 * | il_call_operator prev_declared_fb_name '(' eol_list ')'
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   212
 * | il_call_operator prev_declared_fb_name '(' il_operand_list ')'
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   213
 * | il_call_operator prev_declared_fb_name '(' eol_list il_param_list ')'
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   214
 */
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   215
/* NOTE: The parameter 'called_fb_declaration'is used to pass data between stage 3 and stage4 (although currently it is not used in stage 4 */
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   216
// SYM_REF4(il_fb_call_c, il_call_operator, fb_name, il_operand_list, il_param_list, symbol_c *called_fb_declaration)
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   217
// void *forced_narrow_candidate_datatypes_c::visit(il_fb_call_c *symbol)
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   218
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   219
/* | function_name '(' eol_list [il_param_list] ')' */
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   220
/* NOTE: The parameter 'called_function_declaration' is used to pass data between the stage 3 and stage 4. */
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   221
// SYM_REF2(il_formal_funct_call_c, function_name, il_param_list, symbol_c *called_function_declaration; int extensible_param_count;)
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   222
// void *forced_narrow_candidate_datatypes_c::visit(il_formal_funct_call_c *symbol)
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   223
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   224
// void *visit(il_operand_list_c *symbol);
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   225
// void *forced_narrow_candidate_datatypes_c::visit(simple_instr_list_c *symbol)
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   226
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   227
// SYM_REF1(il_simple_instruction_c, il_simple_instruction, symbol_c *prev_il_instruction;)
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   228
// void *forced_narrow_candidate_datatypes_c::visit(il_simple_instruction_c*symbol)
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   229
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   230
/*
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   231
    void *visit(il_param_list_c *symbol);
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   232
    void *visit(il_param_assignment_c *symbol);
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   233
    void *visit(il_param_out_assignment_c *symbol);
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   234
 */
740da3255d9d Remove all remaining NULL (undefined) datatypes from IL code.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   235
681
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
   236
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
   237
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
   238
/***************************************/
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
   239
/* B.3 - Language ST (Structured Text) */
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
   240
/***************************************/
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
   241
// SYM_LIST(statement_list_c)
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
   242
/* The normal narrow_candidate_datatypes_c algorithm does not leave any symbol, in an ST code, with an undefined datatype.
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
   243
 * There is therefore no need to re-run the narrow algorithm here, so we overide the narrow_candidate_datatypes_c visitor,
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
   244
 * and simply bug out!
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
   245
 */
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
   246
void *forced_narrow_candidate_datatypes_c::visit(statement_list_c *symbol) {return NULL;}
e837adad2437 Do not repeat narrow algorithm for ST code, and better comments.
Mario de Sousa <msousa@fe.up.pt>
parents: 679
diff changeset
   247