Predator
[unstable] git snapshot
|
code listener interface - useful to write compiler plug-ins, etc. More...
#include <stdbool.h>
Go to the source code of this file.
Data Structures | |
struct | cl_loc |
generic location info. More... | |
struct | cl_init_data |
collection of call-backs for writing various types of messages More... | |
struct | cl_type_item |
used for nesting types into another (composite) type More... | |
struct | cl_type |
type definition available for each operand. More... | |
struct | cl_accessor |
accessor definition, available for some operands. More... | |
struct | cl_cst |
constant, in the C language terminology: literal More... | |
struct | cl_var |
variable (local, global, fnc argument, register, etc.) More... | |
struct | cl_operand |
generic operand. More... | |
struct | cl_insn |
single instruction definition More... | |
struct | cl_initializer |
initializer, used mainly for global/static variables More... | |
struct | cl_code_listener |
listener object - the core part of this interface More... |
Typedefs | |
typedef void(* | cl_print_fnc_t )(const char *msg) |
type of function writing a message |
Functions | |
struct cl_loc * | cl_loc_fallback (const struct cl_loc *loc, const struct cl_loc *fallback) |
return loc if it is a valid location info; return fallback otherwise | |
void | cl_global_init (struct cl_init_data *init_data) |
global initialization - it sets message printing call-backs | |
void | cl_global_init_defaults (const char *app_name, int debug_level) |
global initialization - it sets built-in functions to print messages | |
void | cl_global_cleanup (void) |
free resources allocated by cl_global_init() or cl_global_init_defaults() | |
bool | cl_is_term_insn (enum cl_insn_e code) |
return true if the given code denotes a terminal instruction | |
struct cl_code_listener * | cl_code_listener_create (const char *config_string) |
create cl_code_listener object | |
struct cl_code_listener * | cl_chain_create (void) |
create cl_code_listener object for grouping another cl_code_listener objects | |
void | cl_chain_append (struct cl_code_listener *chain, struct cl_code_listener *listener) |
append cl_code_listener object to chain |
Variables | |
struct cl_loc | cl_loc_unknown |
nullified location info, which means "unknown location" |
code listener interface - useful to write compiler plug-ins, etc.
Definition in file code_listener.h.
typedef void(* cl_print_fnc_t)(const char *msg) |
type of function writing a message
msg | zero-terminated string to write |
Definition at line 78 of file code_listener.h.
enum cl_accessor_e |
basic accessor enumeration
Definition at line 300 of file code_listener.h.
enum cl_binop_e |
binary operation's enumeration
Definition at line 641 of file code_listener.h.
enum cl_insn_e |
basic instruction enumeration
CL_INSN_NOP |
no instruction, used only internally for now |
CL_INSN_JMP |
goto instruction |
CL_INSN_COND |
if (EXPR) instruction |
CL_INSN_RET |
return instruction |
CL_INSN_ABORT |
this follows each call of a function declared with attribute noreturn |
CL_INSN_UNOP |
unary (lhs + 1) operation |
CL_INSN_BINOP |
binary (lhs + 2) operation |
CL_INSN_CALL |
this code is never emitted by cl_insn callback |
CL_INSN_SWITCH |
this code is never emitted by cl_insn callback |
CL_INSN_LABEL |
label |
Definition at line 544 of file code_listener.h.
enum cl_operand_e |
generic operand kind enumeration
Definition at line 479 of file code_listener.h.
enum cl_ptr_type_e |
used for specialization of CL_TYPE_PTR, which can also represent both C++ lvalue and rvalue references.
CL_PTR_TYPE_NOT_PTR |
to avoid accidental misuse bugs |
CL_PTR_TYPE_BASIC | |
CL_PTR_TYPE_LVALUE_REF | |
CL_PTR_TYPE_RVALUE_REF |
used only when C++11 code is processed |
Definition at line 212 of file code_listener.h.
enum cl_scope_e |
symbol scope enumeration (linearly ordered)
CL_SCOPE_GLOBAL |
scope is unlimited |
CL_SCOPE_STATIC |
scope is limited to current source file |
CL_SCOPE_FUNCTION |
scope is limited to currently processed function |
Definition at line 147 of file code_listener.h.
enum cl_type_e |
basic type enumeration
CL_TYPE_VOID | |
CL_TYPE_UNKNOWN | |
CL_TYPE_PTR | |
CL_TYPE_STRUCT | |
CL_TYPE_UNION | |
CL_TYPE_ARRAY | |
CL_TYPE_FNC | |
CL_TYPE_INT | |
CL_TYPE_CHAR |
not used by the gcc plug-in at the moment |
CL_TYPE_BOOL | |
CL_TYPE_ENUM | |
CL_TYPE_REAL | |
CL_TYPE_STRING |
used only by cl_cst |
Definition at line 167 of file code_listener.h.
enum cl_unop_e |
unary operation's enumeration
Definition at line 604 of file code_listener.h.
void cl_chain_append | ( | struct cl_code_listener * | chain, |
struct cl_code_listener * | listener | ||
) |
append cl_code_listener object to chain
chain | Object returned by cl_chain_create() function. |
listener | Object ought to be added to the chain. |
|
read |
create cl_code_listener object for grouping another cl_code_listener objects
|
read |
create cl_code_listener object
config_string | determines the type and attributes of the listener. |
void cl_global_cleanup | ( | void | ) |
free resources allocated by cl_global_init() or cl_global_init_defaults()
void cl_global_init | ( | struct cl_init_data * | init_data | ) |
global initialization - it sets message printing call-backs
init_data | - collection of call-backs to set (none of them can be NULL) |
void cl_global_init_defaults | ( | const char * | app_name, |
int | debug_level | ||
) |
global initialization - it sets built-in functions to print messages
app_name | - name of the application which appears in all messages. If NULL is given, no application name will be printed. |
debug_level | - debugging level, the greater number the more output, 0 means no debugging |
bool cl_is_term_insn | ( | enum cl_insn_e | code | ) |
return true if the given code denotes a terminal instruction
return loc if it is a valid location info; return fallback otherwise
struct cl_loc cl_loc_unknown |
nullified location info, which means "unknown location"