2023-03-31 14:17:59 -03:00
|
|
|
#ifndef Py_INTERNAL_CFG_H
|
|
|
|
#define Py_INTERNAL_CFG_H
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef Py_BUILD_CORE
|
|
|
|
# error "this header requires Py_BUILD_CORE define"
|
|
|
|
#endif
|
|
|
|
|
2023-04-11 07:15:09 -03:00
|
|
|
#include "pycore_compile.h"
|
2024-04-04 12:47:26 -03:00
|
|
|
#include "pycore_instruction_sequence.h"
|
|
|
|
#include "pycore_opcode_utils.h"
|
2023-03-31 14:17:59 -03:00
|
|
|
|
2023-08-10 09:03:47 -03:00
|
|
|
struct _PyCfgBuilder;
|
2023-03-31 14:17:59 -03:00
|
|
|
|
2024-04-04 12:47:26 -03:00
|
|
|
int _PyCfgBuilder_UseLabel(struct _PyCfgBuilder *g, _PyJumpTargetLabel lbl);
|
2024-04-02 07:34:49 -03:00
|
|
|
int _PyCfgBuilder_Addop(struct _PyCfgBuilder *g, int opcode, int oparg, _Py_SourceLocation loc);
|
2023-03-31 14:17:59 -03:00
|
|
|
|
2023-08-10 09:03:47 -03:00
|
|
|
struct _PyCfgBuilder* _PyCfgBuilder_New(void);
|
|
|
|
void _PyCfgBuilder_Free(struct _PyCfgBuilder *g);
|
|
|
|
int _PyCfgBuilder_CheckSize(struct _PyCfgBuilder* g);
|
2023-03-31 14:17:59 -03:00
|
|
|
|
2023-08-10 09:03:47 -03:00
|
|
|
int _PyCfg_OptimizeCodeUnit(struct _PyCfgBuilder *g, PyObject *consts, PyObject *const_cache,
|
2023-07-26 09:32:47 -03:00
|
|
|
int nlocals, int nparams, int firstlineno);
|
2023-08-10 09:03:47 -03:00
|
|
|
|
2024-04-04 12:47:26 -03:00
|
|
|
int _PyCfg_ToInstructionSequence(struct _PyCfgBuilder *g, _PyInstructionSequence *seq);
|
2023-08-10 09:03:47 -03:00
|
|
|
int _PyCfg_OptimizedCfgToInstructionSequence(struct _PyCfgBuilder *g, _PyCompile_CodeUnitMetadata *umd,
|
|
|
|
int code_flags, int *stackdepth, int *nlocalsplus,
|
2024-04-04 12:47:26 -03:00
|
|
|
_PyInstructionSequence *seq);
|
2023-03-31 14:17:59 -03:00
|
|
|
|
2023-04-11 07:15:09 -03:00
|
|
|
PyCodeObject *
|
|
|
|
_PyAssemble_MakeCodeObject(_PyCompile_CodeUnitMetadata *u, PyObject *const_cache,
|
2024-04-04 12:47:26 -03:00
|
|
|
PyObject *consts, int maxdepth, _PyInstructionSequence *instrs,
|
2023-04-11 07:15:09 -03:00
|
|
|
int nlocalsplus, int code_flags, PyObject *filename);
|
2023-03-31 14:17:59 -03:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* !Py_INTERNAL_CFG_H */
|