static PyObject * PyGcc_get_dump_file_name(PyObject *self, PyObject *noargs) { /* gcc/tree-pass.h declares: extern const char *dump_file_name; */ return PyGccStringOrNone(dump_file_name); }
static PyObject * PyGcc_get_dump_base_name(PyObject *self, PyObject *noargs) { /* The generated gcc/options.h has: #ifdef GENERATOR_FILE extern const char *dump_base_name; #else const char *x_dump_base_name; #define dump_base_name global_options.x_dump_base_name #endif */ return PyGccStringOrNone(dump_base_name); }
PyObject * get_operand_as_object(const_rtx in_rtx, int idx, char fmt) { const char *str; /* The operand types are described in gcc/rtl.c */ switch (fmt) { case 'T': /* pointer to a string, with special meaning */ str = XTMPL (in_rtx, idx); goto string; case 'S': /* optional pointer to a string */ case 's': /* a pointer to a string */ str = XSTR (in_rtx, idx); string: return PyGccStringOrNone(str); case '0': /* unused, or used in a phase-dependent manner */ Py_RETURN_NONE; /* for now */ case 'e': /* pointer to an rtl expression */ /* Nested expression: */ return PyGccRtl_New( gcc_private_make_rtl_insn(XEXP (in_rtx, idx))); case 'E': case 'V': /* Nested list of expressions */ { PyObject *list = PyList_New(XVECLEN (in_rtx, idx)); int j; if (!list) { return NULL; } for (j = 0; j < XVECLEN (in_rtx, idx); j++) { PyObject *item = PyGccRtl_New( gcc_private_make_rtl_insn(XVECEXP (in_rtx, idx, j))); if (!item) { Py_DECREF(list); return NULL; } if (-1 == PyList_Append(list, item)) { Py_DECREF(item); Py_DECREF(list); return NULL; } Py_DECREF(item); } return list; } case 'w': return PyGccInt_FromLong(XWINT (in_rtx, idx)); case 'i': return PyGccInt_FromLong(XINT (in_rtx, idx)); case 'n': /* Return NOTE_INSN names rather than integer codes. */ return PyGccStringOrNone(GET_NOTE_INSN_NAME (XINT (in_rtx, idx))); case 'u': /* a pointer to another insn */ Py_RETURN_NONE; /* for now */ case 't': return PyGccTree_New(gcc_private_make_tree(XTREE (in_rtx, idx))); case '*': Py_RETURN_NONE; /* for now */ case 'B': return PyGccBasicBlock_New( gcc_private_make_cfg_block(XBBDEF (in_rtx, idx))); default: gcc_unreachable (); } }