• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 int _PyCfg_ToInstructionSequence(struct _PyCfgBuilder *g, _PyInstructionSequence *seq);
28 int _PyCfg_OptimizedCfgToInstructionSequence(struct _PyCfgBuilder *g, _PyCompile_CodeUnitMetadata *umd,
29                                              int code_flags, int *stackdepth, int *nlocalsplus,
30                                              _PyInstructionSequence *seq);
31 
32 PyCodeObject *
33 _PyAssemble_MakeCodeObject(_PyCompile_CodeUnitMetadata *u, PyObject *const_cache,
34                            PyObject *consts, int maxdepth, _PyInstructionSequence *instrs,
35                            int nlocalsplus, int code_flags, PyObject *filename);
36 
37 #ifdef __cplusplus
38 }
39 #endif
40 #endif /* !Py_INTERNAL_CFG_H */
41