| 1 |
#ifndef Py_INTERNAL_CFG_H |
| 2 |
#define Py_INTERNAL_CFG_H |
| 3 |
#ifdef __cplusplus |
| 4 |
extern "C" { |
| 5 |
#endif |
| 6 |
|
| 7 |
#ifndef Py_BUILD_CORE |
| 8 |
# error "this header requires Py_BUILD_CORE define" |
| 9 |
#endif |
| 10 |
|
| 11 |
#include "pycore_compile.h" |
| 12 |
#include "pycore_instruction_sequence.h" |
| 13 |
#include "pycore_opcode_utils.h" |
| 14 |
|
| 15 |
struct _PyCfgBuilder; |
| 16 |
|
| 17 |
int _PyCfgBuilder_UseLabel(struct _PyCfgBuilder *g, _PyJumpTargetLabel lbl); |
| 18 |
int _PyCfgBuilder_Addop(struct _PyCfgBuilder *g, int opcode, int oparg, _Py_SourceLocation loc); |
| 19 |
|
| 20 |
struct _PyCfgBuilder* _PyCfgBuilder_New(void); |
| 21 |
void _PyCfgBuilder_Free(struct _PyCfgBuilder *g); |
| 22 |
int _PyCfgBuilder_CheckSize(struct _PyCfgBuilder* g); |
| 23 |
|
| 24 |
int _PyCfg_OptimizeCodeUnit(struct _PyCfgBuilder *g, PyObject *consts, PyObject *const_cache, |
| 25 |
int nlocals, int nparams, int firstlineno); |
| 26 |
|
| 27 |
struct _PyCfgBuilder* _PyCfg_FromInstructionSequence(_PyInstructionSequence *seq); |
| 28 |
int _PyCfg_ToInstructionSequence(struct _PyCfgBuilder *g, _PyInstructionSequence *seq); |
| 29 |
int _PyCfg_OptimizedCfgToInstructionSequence(struct _PyCfgBuilder *g, _PyCompile_CodeUnitMetadata *umd, |
| 30 |
int code_flags, int *stackdepth, int *nlocalsplus, |
| 31 |
_PyInstructionSequence *seq); |
| 32 |
|
| 33 |
PyCodeObject * |
| 34 |
_PyAssemble_MakeCodeObject(_PyCompile_CodeUnitMetadata *u, PyObject *const_cache, |
| 35 |
PyObject *consts, int maxdepth, _PyInstructionSequence *instrs, |
| 36 |
int nlocalsplus, int code_flags, PyObject *filename); |
| 37 |
|
| 38 |
// Export for '_testinternalcapi' shared extension |
| 39 |
PyAPI_FUNC(PyObject*) _PyCompile_OptimizeCfg( |
| 40 |
PyObject *instructions, |
| 41 |
PyObject *consts, |
| 42 |
int nlocals); |
| 43 |
|
| 44 |
#ifdef __cplusplus |
| 45 |
} |
| 46 |
#endif |
| 47 |
#endif /* !Py_INTERNAL_CFG_H */ |