#include <assert.h>
#include "db.h"
#include "defines.h"
#include "expr.h"
#include "func_unit.h"
#include "gen_item.h"
#include "link.h"
#include "obfuscate.h"
#include "profiler.h"
#include "statement.h"
#include "stmt_blk.h"
Functions | |
void | stmt_blk_add_to_remove_list (statement *stmt) |
void | stmt_blk_remove () |
Removes all statement blocks listed for removal. | |
void | stmt_blk_specify_removal_reason (logic_rm_type type, const char *file, int line, const char *cfile, int cline) |
Variables | |
static stmt_link * | rm_stmt_head = NULL |
static stmt_link * | rm_stmt_tail = NULL |
static const char * | logic_rm_msgs [LOGIC_RM_NUM] |
func_unit * | curr_funit |
char | user_msg [USER_MSG_LENGTH] |
void stmt_blk_add_to_remove_list | ( | statement * | stmt | ) |
Adds the statement block containing the specified statement to the list of statement blocks to remove after parsing, binding and race condition checking has occurred.
stmt | Pointer to statement in a statement block that needs to be removed |
References statement_s::exp, funit_find_by_id(), generate_remove_stmt(), statement_s::head, expression_s::id, statement_s::part, PROFILE, PROFILE_END, stmt_link_add(), stmt_link_find(), statement_s::suppl, and TRUE.
Referenced by bind_perform(), bind_signal(), expression_dealloc(), funit_remove_stmt_blks_calling_stmt(), race_check_modules(), and statement_dealloc_recursive().
00061 { PROFILE(STMT_BLK_ADD_TO_REMOVE_LIST); 00062 00063 func_unit* funit; /* Pointer to functional unit containing this statement */ 00064 00065 assert( stmt != NULL ); 00066 00067 #ifndef VPI_ONLY 00068 if( !generate_remove_stmt( stmt ) ) { 00069 #endif 00070 00071 /* If this is a head statement, don't bother looking this up again */ 00072 if( stmt->suppl.part.head == 0 ) { 00073 00074 /* Find the functional unit that contains this statement */ 00075 funit = funit_find_by_id( stmt->exp->id ); 00076 assert( funit != NULL ); 00077 00078 /* Find the head statement of the statement block that contains this statement */ 00079 stmt = stmt->head; 00080 00081 } 00082 00083 /* If this statement has not been added to the removal list already, do so now */ 00084 if( stmt_link_find( stmt->exp->id, rm_stmt_head ) == NULL ) { 00085 (void)stmt_link_add( stmt, TRUE, &rm_stmt_head, &rm_stmt_tail ); 00086 } 00087 00088 #ifndef VPI_ONLY 00089 } 00090 #endif 00091 00092 PROFILE_END; 00093 00094 }
void stmt_blk_remove | ( | ) |
Removes all statement blocks listed for removal.
Iterates through rm_stmt list, deallocating each statement block in that list. This function is only called once after the parsing, binding and race condition checking phases have completed.
References db_remove_stmt_blks_calling_statement(), statement_s::exp, FUNIT_AFUNCTION, FUNIT_ANAMED_BLOCK, FUNIT_ATASK, funit_find_by_id(), FUNIT_FUNCTION, FUNIT_NAMED_BLOCK, FUNIT_NO_SCORE, FUNIT_TASK, expression_s::id, PROFILE, PROFILE_END, statement_dealloc_recursive(), stmt_link_s::stmt, stmt_link_unlink(), TRUE, and func_unit_s::type.
Referenced by parse_design().
00101 { PROFILE(STMT_BLK_REMOVE); 00102 00103 statement* stmt; /* Temporary pointer to current statement to deallocate */ 00104 00105 /* Remove all statement blocks */ 00106 while( rm_stmt_head != NULL ) { 00107 stmt = rm_stmt_head->stmt; 00108 stmt_link_unlink( stmt, &rm_stmt_head, &rm_stmt_tail ); 00109 curr_funit = funit_find_by_id( stmt->exp->id ); 00110 assert( curr_funit != NULL ); 00111 /* 00112 If we are removing the statement contained in a task, function or named block, we need to remove all statement 00113 blocks that contain expressions that call this task, function or named block. 00114 */ 00115 if( (curr_funit->type == FUNIT_FUNCTION) || (curr_funit->type == FUNIT_TASK) || (curr_funit->type == FUNIT_NAMED_BLOCK) || 00116 (curr_funit->type == FUNIT_AFUNCTION) || (curr_funit->type == FUNIT_ATASK) || (curr_funit->type == FUNIT_ANAMED_BLOCK) ) { 00117 curr_funit->type = FUNIT_NO_SCORE; 00118 db_remove_stmt_blks_calling_statement( stmt ); 00119 } 00120 /* Deallocate the statement block now */ 00121 statement_dealloc_recursive( stmt, TRUE ); 00122 } 00123 00124 PROFILE_END; 00125 00126 }
void stmt_blk_specify_removal_reason | ( | logic_rm_type | type, | |
const char * | file, | |||
int | line, | |||
const char * | cfile, | |||
int | cline | |||
) |
Outputs the reason why a logic block is being removed from coverage consideration.
type | Reason for removing the logic block | |
file | Filename containing logic block being removed | |
line | Line containing logic that is causing logic block removal | |
cfile | File containing removal line | |
cline | Line containing removal line |
References logic_rm_msgs, print_output(), PROFILE, PROFILE_END, user_msg, USER_MSG_LENGTH, WARNING, and WARNING_WRAP.
00137 { PROFILE(STMT_BLK_SPECIFY_REMOVAL_REASON); 00138 00139 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Removing logic block containing line %d in file %s because", line, file ); 00140 assert( rv < USER_MSG_LENGTH ); 00141 print_output( user_msg, WARNING, cfile, cline ); 00142 print_output( logic_rm_msgs[type], WARNING_WRAP, cfile, cline ); 00143 00144 PROFILE_END; 00145 00146 }
Pointer to the functional unit structure for the functional unit that is currently being parsed.
const char* logic_rm_msgs[LOGIC_RM_NUM] [static] |
{ "it contains a real number (currently unsupported)", "it contains an unsupported system function", "it contains an unsupported system task" }
Array containing reasons for logic block removal
Referenced by stmt_blk_specify_removal_reason().
stmt_link* rm_stmt_head = NULL [static] |
Pointer to head of statement block list to remove
stmt_link* rm_stmt_tail = NULL [static] |
Pointer to tail of statement block list to remove
char user_msg[USER_MSG_LENGTH] |
Holds some output that will be displayed via the print_output command. This is created globally so that memory does not need to be reallocated for each function that wishes to use it.