PIPS
misc.c File Reference
#include <stdio.h>
#include "genC.h"
#include "misc.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "text-util.h"
#include "ri-util.h"
#include "prettyprint.h"
#include "effects-util.h"
#include "semantics.h"
#include "properties.h"
+ Include dependency graph for misc.c:

Go to the source code of this file.

Functions

int call_site_count (entity m)
 low level routines which should be added to other packages More...
 
int caller_count (entity m)
 
int dynamic_call_count (entity m)
 
static void semantics_user_warning_alist (const char *func_name, const char *format, va_list *args)
 Some other warnings include the pass name. More...
 
void semantics_user_warning_func (const char *func_name, const char *format,...)
 
void semantics_user_warning_func2 (const char *format,...)
 

Function Documentation

◆ call_site_count()

int call_site_count ( entity  m)

low level routines which should be added to other packages

cproto-generated files

Francois Irigoin, April 1990

Modifications:

  • passage a l'utilisation de database probably to add to the future callgraph library

number of "call to m" sites within the current program; they are all in m's CALLERS

I do not know yet; let's return 1 to please the semantic analysis

Definition at line 51 of file misc.c.

53 {
54  /* number of "call to m" sites within the current program;
55  they are all in m's CALLERS */
56  pips_assert("call_site_count", value_code_p(entity_initial(m)));
57  /* I do not know yet; let's return 1 to please the semantic analysis */
58  user_warning("call_site_count",
59  "not implemented yet, always returns 1\n");
60  return 1;
61 }
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define user_warning(fn,...)
Definition: misc-local.h:262
#define value_code_p(x)
Definition: ri.h:3065
#define entity_initial(x)
Definition: ri.h:2796

References entity_initial, pips_assert, user_warning, and value_code_p.

◆ caller_count()

int caller_count ( entity  m)

number of modules calling m within the current program; i.e. number of modules containing at least one call site to m

I do not know yet; let's return 1 to please the semantic analysis

Definition at line 63 of file misc.c.

65 {
66  /* number of modules calling m within the current program;
67  i.e. number of modules containing at least one call site to m */
68  pips_assert("caller_count", value_code_p(entity_initial(m)));
69  /* I do not know yet; let's return 1 to please the semantic analysis */
70  user_warning("caller_count",
71  "not implemented yet, always returns 1\n");
72  return 1;
73 }

References entity_initial, pips_assert, user_warning, and value_code_p.

◆ dynamic_call_count()

int dynamic_call_count ( entity  m)

number of call to m during the current program execution; return 0 if m is never called, either because it's a call graph root or because it was linked by mistake; return -1 if the dynamic call count is unknow, for instance because one of m's call site is located in a loop of unknown bounds; return k when it can be evaluated

I do not know yet; let's return 1 to please the semantic analysis

Definition at line 75 of file misc.c.

76 {
77  /* number of call to m during the current program execution;
78  return 0 if m is never called, either because it's a call
79  graph root or because it was linked by mistake;
80  return -1 if the dynamic call count is unknow, for instance
81  because one of m's call site is located in a loop of unknown
82  bounds;
83  return k when it can be evaluated */
84  pips_assert("Entity m is a function with defined code",
86  /* I do not know yet; let's return 1 to please the semantic analysis */
87  pips_internal_error("Not implemented yet, always returns -1.\n");
88  return -1;
89 }
#define pips_internal_error
Definition: misc-local.h:149

References entity_initial, pips_assert, pips_internal_error, and value_code_p.

◆ semantics_user_warning_alist()

static void semantics_user_warning_alist ( const char *  func_name,
const char *  format,
va_list *  args 
)
static

Some other warnings include the pass name.

Definition at line 93 of file misc.c.

97 {
98  if (get_bool_property("NO_USER_WARNING"))
99  return;
100 
102  int ln = statement_undefined_p(cs)? -1: statement_number(cs);
103 
104  // this may be big... truncate?
105  const string scs = proper_statement_to_string(cs);
106 
108  warning_log,
110  (const string) func_name, NULL, -1,
111  (string) get_current_module_name(), NULL, ln, -1,
112  (const string) scs, NULL, (const string) format, args);
113 
114  free(scs);
115  return;
116 }
void pips_log_alist(const pips_log_t tag, const string pips_pass, const string pips_owner, const string pips_func, const string pips_file, const int pips_line, const string user_func, const string user_file, const int user_line, const int user_line2, const string stmt, const string suggestion, const string format, va_list *args)
log entry with unprocessed format/alist arguments
Definition: message.c:1200
string get_pips_current_pass_name(void)
Export this piece of information to customize warning functions in passes.
Definition: message.c:77
string get_pips_current_module(void)
Definition: message.c:82
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
void free(void *)
const char * get_current_module_name(void)
Get the name of the current module.
Definition: static.c:121
@ warning_log
Definition: misc-local.h:34
string proper_statement_to_string(statement)
statement get_current_statement_from_statement_global_stack(void)
Definition: static.c:344
#define statement_undefined_p(x)
Definition: ri.h:2420
#define statement_number(x)
Definition: ri.h:2452

References free(), get_bool_property(), get_current_module_name(), get_current_statement_from_statement_global_stack(), get_pips_current_module(), get_pips_current_pass_name(), pips_log_alist(), proper_statement_to_string(), statement_number, statement_undefined_p, and warning_log.

Referenced by semantics_user_warning_func(), and semantics_user_warning_func2().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ semantics_user_warning_func()

void semantics_user_warning_func ( const char *  func_name,
const char *  format,
  ... 
)
Parameters
func_nameunc_name
formatormat

Definition at line 118 of file misc.c.

122 {
123  va_list args;
124  va_start(args, format);
125  semantics_user_warning_alist(func_name, format, &args);
126  va_end(args);
127 }
static void semantics_user_warning_alist(const char *func_name, const char *format, va_list *args)
Some other warnings include the pass name.
Definition: misc.c:93

References semantics_user_warning_alist().

+ Here is the call graph for this function:

◆ semantics_user_warning_func2()

void semantics_user_warning_func2 ( const char *  format,
  ... 
)
Parameters
formatormat

Definition at line 129 of file misc.c.

132 {
133  va_list args;
134  va_start(args, format);
136  va_end(args);
137 }
#define pips_unknown_function
Definition: misc-local.h:63

References pips_unknown_function, and semantics_user_warning_alist().

+ Here is the call graph for this function: