当前位置: 首页>>代码示例>>Python>>正文


Python PyGccWrapperTypeObject.c_invoke_add_to_module方法代码示例

本文整理汇总了Python中wrapperbuilder.PyGccWrapperTypeObject.c_invoke_add_to_module方法的典型用法代码示例。如果您正苦于以下问题:Python PyGccWrapperTypeObject.c_invoke_add_to_module方法的具体用法?Python PyGccWrapperTypeObject.c_invoke_add_to_module怎么用?Python PyGccWrapperTypeObject.c_invoke_add_to_module使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wrapperbuilder.PyGccWrapperTypeObject的用法示例。


在下文中一共展示了PyGccWrapperTypeObject.c_invoke_add_to_module方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: generate_concrete_rtx_code_subclasses

# 需要导入模块: from wrapperbuilder import PyGccWrapperTypeObject [as 别名]
# 或者: from wrapperbuilder.PyGccWrapperTypeObject import c_invoke_add_to_module [as 别名]
def generate_concrete_rtx_code_subclasses():
    global modinit_preinit
    global modinit_postinit

    for expr_type in rtl_expr_types:

        cc = expr_type.camel_cased_string()

        getsettable = None
        if getsettable:
            cu.add_defn(getsettable.c_defn())

        pytype = PyGccWrapperTypeObject(identifier = 'PyGcc%s_TypeObj' % cc,
                              localname = cc,
                              tp_name = 'gcc.%s' % cc,
                              struct_name = 'PyGccRtl',
                              tp_new = 'PyType_GenericNew',
                              tp_base = ('&PyGccRtlClassType%s_TypeObj'
                                         % camel_case(expr_type.CLASS)),
                              tp_getset = getsettable.identifier if getsettable else None,
                              tp_repr = '(reprfunc)PyGccRtl_repr',
                              tp_str = '(reprfunc)PyGccRtl_str',
                              )
        cu.add_defn(pytype.c_defn())
        modinit_preinit += pytype.c_invoke_type_ready()
        modinit_postinit += pytype.c_invoke_add_to_module()
开发者ID:B-Rich,项目名称:gcc-python-plugin,代码行数:28,代码来源:generate-rtl-c.py

示例2: generate_variable

# 需要导入模块: from wrapperbuilder import PyGccWrapperTypeObject [as 别名]
# 或者: from wrapperbuilder.PyGccWrapperTypeObject import c_invoke_add_to_module [as 别名]
def generate_variable():
    global modinit_preinit
    global modinit_postinit

    getsettable = PyGetSetDefTable('gcc_Variable_getset_table', [])
    def add_simple_getter(name, c_expression, doc):
        getsettable.add_gsdef(name,
                              cu.add_simple_getter('gcc_Variable_get_%s' % name,
                                                   'PyGccVariable',
                                                   c_expression),
                              None,
                              doc)

    add_simple_getter('decl',
                      'gcc_python_make_wrapper_tree(self->var->decl)',
                      'The declaration of this variable, as a gcc.Tree')

    cu.add_defn(getsettable.c_defn())
    
    pytype = PyGccWrapperTypeObject(identifier = 'gcc_VariableType',
                          localname = 'Variable',
                          tp_name = 'gcc.Variable',
                          tp_dealloc = 'gcc_python_wrapper_dealloc',
                          struct_name = 'PyGccVariable',
                          tp_new = 'PyType_GenericNew',
                          tp_getset = getsettable.identifier,
                          #tp_repr = '(reprfunc)gcc_Variable_repr',
                          #tp_str = '(reprfunc)gcc_Variable_repr',
                          )
    cu.add_defn(pytype.c_defn())
    modinit_preinit += pytype.c_invoke_type_ready()
    modinit_postinit += pytype.c_invoke_add_to_module()
开发者ID:eevee,项目名称:gcc-python-plugin,代码行数:34,代码来源:generate-variable-c.py

示例3: generate_location

# 需要导入模块: from wrapperbuilder import PyGccWrapperTypeObject [as 别名]
# 或者: from wrapperbuilder.PyGccWrapperTypeObject import c_invoke_add_to_module [as 别名]
def generate_location():
    #
    # Generate the gcc.Location class:
    #
    global modinit_preinit
    global modinit_postinit

    cu.add_defn("""
static PyObject *
PyGccLocation_get_file(struct PyGccLocation *self, void *closure)
{
    return PyGccString_FromString(gcc_location_get_filename(self->loc));
}
""")

    cu.add_defn("""
static PyObject *
PyGccLocation_get_line(struct PyGccLocation *self, void *closure)
{
    return PyGccInt_FromLong(gcc_location_get_line(self->loc));
}
""")

    cu.add_defn("""
static PyObject *
PyGccLocation_get_column(struct PyGccLocation *self, void *closure)
{
    return PyGccInt_FromLong(gcc_location_get_column(self->loc));
}
""")

    getsettable = PyGetSetDefTable('PyGccLocation_getset_table',
                                   [PyGetSetDef('file', 'PyGccLocation_get_file', None, 'Name of the source file'),
                                    PyGetSetDef('line', 'PyGccLocation_get_line', None, 'Line number within source file'),
                                    PyGetSetDef('column', 'PyGccLocation_get_column', None, 'Column number within source file'),
                                    ],
                                   identifier_prefix='PyGccLocation',
                                   typename='PyGccLocation')
    getsettable.add_simple_getter(cu,
                                  'in_system_header',
                                  'PyBool_FromLong(gcc_location_in_system_header_at(self->loc))',
                                  'Boolean: is this location within a system header?')
    cu.add_defn(getsettable.c_defn())

    pytype = PyGccWrapperTypeObject(identifier = 'PyGccLocation_TypeObj',
                          localname = 'Location',
                          tp_name = 'gcc.Location',
                          struct_name = 'PyGccLocation',
                          tp_new = 'PyType_GenericNew',
                          tp_getset = getsettable.identifier,
                          tp_hash = '(hashfunc)PyGccLocation_hash',
                          tp_repr = '(reprfunc)PyGccLocation_repr',
                          tp_str = '(reprfunc)PyGccLocation_str',
                          tp_richcompare = 'PyGccLocation_richcompare',
                          tp_dealloc = 'PyGccWrapper_Dealloc')
    cu.add_defn(pytype.c_defn())
    modinit_preinit += pytype.c_invoke_type_ready()
    modinit_postinit += pytype.c_invoke_add_to_module()
开发者ID:afrolovskiy,项目名称:gcc-python-plugin,代码行数:60,代码来源:generate-location-c.py

示例4: generate_function

# 需要导入模块: from wrapperbuilder import PyGccWrapperTypeObject [as 别名]
# 或者: from wrapperbuilder.PyGccWrapperTypeObject import c_invoke_add_to_module [as 别名]
def generate_function():
    #
    # Generate the gcc.Function class:
    #
    global modinit_preinit
    global modinit_postinit
    cu.add_defn("\n"
                "static PyObject *\n"
                "PyGccFunction_get_cfg(struct PyGccFunction *self, void *closure)\n"
                "{\n"
                "    return PyGccCfg_New(gcc_function_get_cfg(self->fun));\n"
                "}\n"
                "\n")
    getsettable = PyGetSetDefTable('PyGccFunction_getset_table',
                                   [PyGetSetDef('cfg', 'PyGccFunction_get_cfg', None,
                                                'Instance of gcc.Cfg for this function (or None for early passes)'),
                                    ],
                                   identifier_prefix='PyGccFunction',
                                   typename='PyGccFunction')
    getsettable.add_simple_getter(cu,
                                  'decl', 
                                  'PyGccTree_New(gcc_function_decl_as_gcc_tree(gcc_function_get_decl(self->fun)))',
                                  'The declaration of this function, as a gcc.FunctionDecl instance')
    getsettable.add_simple_getter(cu,
                                  'local_decls',
                                  'VEC_tree_as_PyList(self->fun.inner->local_decls)',
                                  "List of gcc.VarDecl for the function's local variables")
    getsettable.add_simple_getter(cu,
                                  'funcdef_no',
                                  'PyGccInt_FromLong(gcc_function_get_index(self->fun))',
                                  'Function sequence number for profiling, debugging, etc.')
    getsettable.add_simple_getter(cu,
                                  'start',
                                  'PyGccLocation_New(gcc_function_get_start(self->fun))',
                                  'Location of the start of the function')
    getsettable.add_simple_getter(cu,
                                  'end',
                                  'PyGccLocation_New(gcc_function_get_end(self->fun))',
                                  'Location of the end of the function')
    cu.add_defn(getsettable.c_defn())

    pytype = PyGccWrapperTypeObject(identifier = 'PyGccFunction_TypeObj',
                          localname = 'Function',
                          tp_name = 'gcc.Function',
                          tp_dealloc = 'PyGccWrapper_Dealloc',
                          struct_name = 'PyGccFunction',
                          tp_new = 'PyType_GenericNew',
                          tp_repr = '(reprfunc)PyGccFunction_repr',
                          tp_str = '(reprfunc)PyGccFunction_repr',
                          tp_hash = '(hashfunc)PyGccFunction_hash',
                          tp_richcompare = 'PyGccFunction_richcompare',
                          tp_getset = getsettable.identifier,
                                    )
    cu.add_defn(pytype.c_defn())
    modinit_preinit += pytype.c_invoke_type_ready()
    modinit_postinit += pytype.c_invoke_add_to_module()
开发者ID:B-Rich,项目名称:gcc-python-plugin,代码行数:58,代码来源:generate-function-c.py

示例5: generate_param

# 需要导入模块: from wrapperbuilder import PyGccWrapperTypeObject [as 别名]
# 或者: from wrapperbuilder.PyGccWrapperTypeObject import c_invoke_add_to_module [as 别名]
def generate_param():
    #
    # Generate the gcc.Parameter class:
    #
    global modinit_preinit
    global modinit_postinit

    getsettable = PyGetSetDefTable('PyGccParameter_getset_table', [],
                                   identifier_prefix='PyGccParameter',
                                   typename='PyGccParameter')
    def add_simple_getter(name, c_expression, doc):
        getsettable.add_simple_getter(cu, name, c_expression, doc)
    add_simple_getter('option',
                      'PyGccStringOrNone(PARAM_INFO(self).option)',
                      "(string) The name used with the `--param <name>=<value>' switch to set this value")
    add_simple_getter('default_value',
                      'PyGccInt_FromLong(PARAM_INFO(self).default_value)',
                      "(int/long)")
    add_simple_getter('min_value',
                      'PyGccInt_FromLong(PARAM_INFO(self).min_value)',
                      "(int/long) The minimum acceptable value")
    add_simple_getter('max_value',
                      'PyGccInt_FromLong(PARAM_INFO(self).max_value)',
                      "(int/long) The maximum acceptable value, if greater than min_value")
    add_simple_getter('help',
                      'PyGccStringOrNone(PARAM_INFO(self).help)',
                      "(string) A short description of the option.")

    # "current_value":
    getter = cu.add_simple_getter('PyGccParameter_get_current_value',
                                  'PyGccParameter',
                                  'PyGccInt_FromLong(PARAM_VALUE(self->param_num))')
    setter = cu.add_simple_int_setter('PyGccParameter_set_current_value',
                                      'PyGccParameter',
                                      'current_value',
                                      'global_options.x_param_values[self->param_num] = PyGccInt_AsLong(value)') #FIXME
    getsettable.add_gsdef('current_value',
                          getter, setter,
                          "(int/long)")

    cu.add_defn(getsettable.c_defn())

    pytype = PyGccWrapperTypeObject(identifier = 'PyGccParameter_TypeObj',
                          localname = 'Parameter',
                          tp_name = 'gcc.Parameter',
                          tp_dealloc = 'PyGccWrapper_Dealloc',
                          struct_name = 'PyGccParameter',
                          tp_new = 'PyType_GenericNew',
                          tp_getset = getsettable.identifier,
                          #tp_repr = '(reprfunc)PyGccParameter_repr',
                          #tp_str = '(reprfunc)PyGccParameter_str',
                          )
    cu.add_defn(pytype.c_defn())
    modinit_preinit += pytype.c_invoke_type_ready()
    modinit_postinit += pytype.c_invoke_add_to_module()
开发者ID:B-Rich,项目名称:gcc-python-plugin,代码行数:57,代码来源:generate-parameter-c.py

示例6: generate_function

# 需要导入模块: from wrapperbuilder import PyGccWrapperTypeObject [as 别名]
# 或者: from wrapperbuilder.PyGccWrapperTypeObject import c_invoke_add_to_module [as 别名]
def generate_function():
    #
    # Generate the gcc.Function class:
    #
    global modinit_preinit
    global modinit_postinit
    cu.add_defn("\n"
                "static PyObject *\n"
                "gcc_Function_get_cfg(struct PyGccFunction *self, void *closure)\n"
                "{\n"
                "    return gcc_python_make_wrapper_cfg(self->fun->cfg);\n"
                "}\n"
                "\n")
    getsettable = PyGetSetDefTable('gcc_Function_getset_table',
                                   [PyGetSetDef('cfg', 'gcc_Function_get_cfg', None,
                                                'Instance of gcc.Cfg for this function (or None for early passes)'),
                                    ],
                                   identifier_prefix='gcc_Function',
                                   typename='PyGccFunction')
    getsettable.add_simple_getter(cu,
                                  'decl', 
                                  'gcc_python_make_wrapper_tree(self->fun->decl)',
                                  'The declaration of this function, as a gcc.FunctionDecl instance')
    getsettable.add_simple_getter(cu,
                                  'local_decls',
                                  'VEC_tree_as_PyList(self->fun->local_decls)',
                                  "List of gcc.VarDecl for the function's local variables")
    getsettable.add_simple_getter(cu,
                                  'funcdef_no',
                                  'gcc_python_int_from_long(self->fun->funcdef_no)',
                                  'Function sequence number for profiling, debugging, etc.')
    getsettable.add_simple_getter(cu,
                                  'start',
                                  'gcc_python_make_wrapper_location(self->fun->function_start_locus)',
                                  'Location of the start of the function')
    getsettable.add_simple_getter(cu,
                                  'end',
                                  'gcc_python_make_wrapper_location(self->fun->function_end_locus)',
                                  'Location of the end of the function')
    cu.add_defn(getsettable.c_defn())

    pytype = PyGccWrapperTypeObject(identifier = 'gcc_FunctionType',
                          localname = 'Function',
                          tp_name = 'gcc.Function',
                          tp_dealloc = 'gcc_python_wrapper_dealloc',
                          struct_name = 'PyGccFunction',
                          tp_new = 'PyType_GenericNew',
                          tp_repr = '(reprfunc)gcc_Function_repr',
                          tp_str = '(reprfunc)gcc_Function_repr',
                          tp_getset = getsettable.identifier,
                                    )
    cu.add_defn(pytype.c_defn())
    modinit_preinit += pytype.c_invoke_type_ready()
    modinit_postinit += pytype.c_invoke_add_to_module()
开发者ID:eevee,项目名称:gcc-python-plugin,代码行数:56,代码来源:generate-function-c.py

示例7: generate_option

# 需要导入模块: from wrapperbuilder import PyGccWrapperTypeObject [as 别名]
# 或者: from wrapperbuilder.PyGccWrapperTypeObject import c_invoke_add_to_module [as 别名]
def generate_option():
    #
    # Generate the gcc.Option class:
    #
    global modinit_preinit
    global modinit_postinit

    getsettable = PyGetSetDefTable('PyGccOption_getset_table', [],
                                   identifier_prefix='PyGccOption',
                                   typename='PyGccOption')
    def add_simple_getter(name, c_expression, doc):
        getsettable.add_simple_getter(cu, name, c_expression, doc)

    add_simple_getter('text',
      'PyGccStringOrNone(PyGcc_option_to_cl_option(self)->opt_text)',
      '(string) The command-line text used to set this option')
    add_simple_getter('help',
      'PyGccStringOrNone(PyGcc_option_to_cl_option(self)->help)',
      '(string) The help text shown for this option')

    for flag, helptext in (
        ('CL_WARNING', '(bool) Does this option control a warning message?'),
        ('CL_OPTIMIZATION', '(bool) Does this option control an optimization?'),
        ('CL_DRIVER', '(bool) Is this a driver option?'),
        ('CL_TARGET', '(bool) Is this a target-specific option?'),
      ):
        add_simple_getter('is_%s' % flag[3:].lower(),
                          'PyBool_FromLong(PyGcc_option_to_cl_option(self)->flags & %s)' % flag,
                          helptext)

    getsettable.add_gsdef('is_enabled',
                          'PyGccOption_is_enabled',
                          None,
                          'True/False for whether or not this option is enabled, raising a '
                          'NotImplementedError for options for which the plugin cannot tell')

    cu.add_defn(getsettable.c_defn())

    pytype = PyGccWrapperTypeObject(identifier = 'PyGccOption_TypeObj',
                          localname = 'Option',
                          tp_name = 'gcc.Option',
                          tp_dealloc = 'PyGccWrapper_Dealloc',
                          struct_name = 'PyGccOption',
                          tp_init = 'PyGccOption_init',
                          tp_getset = getsettable.identifier,
                          tp_repr = '(reprfunc)PyGccOption_repr',
                          #tp_str = '(reprfunc)PyGccOption_str',
                          #tp_richcompare = 'PyGccOption_richcompare'
                          )
    cu.add_defn(pytype.c_defn())
    modinit_preinit += pytype.c_invoke_type_ready()
    modinit_postinit += pytype.c_invoke_add_to_module()
开发者ID:B-Rich,项目名称:gcc-python-plugin,代码行数:54,代码来源:generate-option-c.py

示例8: generate_edge

# 需要导入模块: from wrapperbuilder import PyGccWrapperTypeObject [as 别名]
# 或者: from wrapperbuilder.PyGccWrapperTypeObject import c_invoke_add_to_module [as 别名]
def generate_edge():
    #
    # Generate the gcc.Edge class:
    #
    global modinit_preinit
    global modinit_postinit

    getsettable = PyGetSetDefTable('PyGccEdge_getset_table',
                                   [PyGetSetDef('src',
                                                cu.add_simple_getter('PyGccEdge_get_src',
                                                                     'PyGccEdge',
                                                                     'PyGccBasicBlock_New(gcc_cfg_edge_get_src(self->e))'),
                                                None,
                                                'The source gcc.BasicBlock of this edge'),
                                    PyGetSetDef('dest',
                                                cu.add_simple_getter('PyGccEdge_get_dest',
                                                                     'PyGccEdge',
                                                                     'PyGccBasicBlock_New(gcc_cfg_edge_get_dest(self->e))'),
                                                None,
                                                'The destination gcc.BasicBlock of this edge')],
                                   identifier_prefix = 'PyGccEdge',
                                   typename = 'PyGccEdge')

    # We only expose the subset of the flags exposed by gcc-c-api
    for attrname, flaggetter in [('true_value', 'is_true_value'),
                                 ('false_value', 'is_false_value'),
                                 ('loop_exit', 'is_loop_exit'),
                                 ('can_fallthru', 'get_can_fallthru'),
                                 ('complex', 'is_complex'),
                                 ('eh', 'is_eh'),
                                 ]:
        getsettable.add_simple_getter(cu,
                                      attrname,
                                      'PyBool_FromLong(gcc_cfg_edge_%s(self->e))' % flaggetter,
                                      None)

    cu.add_defn(getsettable.c_defn())

    pytype = PyGccWrapperTypeObject(identifier = 'PyGccEdge_TypeObj',
                          localname = 'Edge',
                          tp_name = 'gcc.Edge',
                          tp_dealloc = 'PyGccWrapper_Dealloc',
                          struct_name = 'PyGccEdge',
                          tp_new = 'PyType_GenericNew',
                          #tp_repr = '(reprfunc)PyGccEdge_repr',
                          #tp_str = '(reprfunc)PyGccEdge_repr',
                          tp_getset = getsettable.identifier,
                          )
    cu.add_defn(pytype.c_defn())
    modinit_preinit += pytype.c_invoke_type_ready()
    modinit_postinit += pytype.c_invoke_add_to_module()
开发者ID:bganne,项目名称:gcc-python-plugin,代码行数:53,代码来源:generate-cfg-c.py

示例9: generate_basic_block

# 需要导入模块: from wrapperbuilder import PyGccWrapperTypeObject [as 别名]
# 或者: from wrapperbuilder.PyGccWrapperTypeObject import c_invoke_add_to_module [as 别名]
def generate_basic_block():
    #
    # Generate the gcc.BasicBlock class:
    #
    global modinit_preinit
    global modinit_postinit

    getsettable = PyGetSetDefTable('PyGccBasicBlock_getset_table',
                                   [PyGetSetDef('preds',
                                                'PyGccBasicBlock_get_preds',
                                                None,
                                                'The list of predecessor gcc.Edge instances leading into this block'),
                                    PyGetSetDef('succs',
                                                'PyGccBasicBlock_get_succs',
                                                None,
                                                'The list of successor gcc.Edge instances leading out of this block'),
                                    PyGetSetDef('gimple',
                                                'PyGccBasicBlock_get_gimple',
                                                'PyGccBasicBlock_set_gimple',
                                                'The list of gcc.Gimple instructions, if appropriate for this pass, or None'),
                                    PyGetSetDef('phi_nodes',
                                                'PyGccBasicBlock_get_phi_nodes',
                                                None,
                                                'The list of gcc.GimplePhi phoney functions, if appropriate for this pass, or None'),
                                    PyGetSetDef('rtl',
                                                'PyGccBasicBlock_get_rtl',
                                                None,
                                                'The list of gcc.Rtl instructions, if appropriate for this pass, or None'),
                                    ],
                                   identifier_prefix='PyGccBasicBlock',
                                   typename='PyGccBasicBlock')
    getsettable.add_simple_getter(cu,
                                  'index',
                                  'PyGccInt_FromLong(gcc_cfg_block_get_index(self->bb))',
                                  None)
    cu.add_defn(getsettable.c_defn())

    pytype = PyGccWrapperTypeObject(identifier = 'PyGccBasicBlock_TypeObj',
                          localname = 'BasicBlock',
                          tp_name = 'gcc.BasicBlock',
                          tp_dealloc = 'PyGccWrapper_Dealloc',
                          struct_name = 'PyGccBasicBlock',
                          tp_new = 'PyType_GenericNew',
                          tp_repr = '(reprfunc)PyGccBasicBlock_repr',
                          #tp_str = '(reprfunc)PyGccBasicBlock_repr',
                          tp_getset = getsettable.identifier,
                          )
    cu.add_defn(pytype.c_defn())
    modinit_preinit += pytype.c_invoke_type_ready()
    modinit_postinit += pytype.c_invoke_add_to_module()
开发者ID:bganne,项目名称:gcc-python-plugin,代码行数:52,代码来源:generate-cfg-c.py

示例10: generate_edge

# 需要导入模块: from wrapperbuilder import PyGccWrapperTypeObject [as 别名]
# 或者: from wrapperbuilder.PyGccWrapperTypeObject import c_invoke_add_to_module [as 别名]
def generate_edge():
    #
    # Generate the gcc.Edge class:
    #
    global modinit_preinit
    global modinit_postinit

    getsettable = PyGetSetDefTable('gcc_Edge_getset_table',
                                   [PyGetSetDef('src',
                                                cu.add_simple_getter('gcc_Edge_get_src',
                                                                     'PyGccEdge',
                                                                     'gcc_python_make_wrapper_basic_block(self->e->src)'),
                                                None,
                                                'The source gcc.BasicBlock of this edge'),
                                    PyGetSetDef('dest',
                                                cu.add_simple_getter('gcc_Edge_get_dest',
                                                                     'PyGccEdge',
                                                                     'gcc_python_make_wrapper_basic_block(self->e->dest)'),
                                                None,
                                                'The destination gcc.BasicBlock of this edge')],
                                   identifier_prefix = 'gcc_Edge',
                                   typename = 'PyGccEdge')
    for flag in ('EDGE_FALLTHRU', 'EDGE_ABNORMAL', 'EDGE_ABNORMAL_CALL',
                 'EDGE_EH', 'EDGE_FAKE', 'EDGE_DFS_BACK', 'EDGE_CAN_FALLTHRU',
                 'EDGE_IRREDUCIBLE_LOOP', 'EDGE_SIBCALL', 'EDGE_LOOP_EXIT',
                 'EDGE_TRUE_VALUE', 'EDGE_FALSE_VALUE', 'EDGE_EXECUTABLE',
                 'EDGE_CROSSING'):
        assert flag.startswith('EDGE_')
        flagname = flag[5:].lower()
        getsettable.add_simple_getter(cu,
                                      flagname,
                                      'PyBool_FromLong(self->e->flags & %s)' % flag,
                                      'Boolean, corresponding to flag %s' % flag)
    cu.add_defn(getsettable.c_defn())

    pytype = PyGccWrapperTypeObject(identifier = 'gcc_EdgeType',
                          localname = 'Edge',
                          tp_name = 'gcc.Edge',
                          tp_dealloc = 'gcc_python_wrapper_dealloc',
                          struct_name = 'PyGccEdge',
                          tp_new = 'PyType_GenericNew',
                          #tp_repr = '(reprfunc)gcc_Edge_repr',
                          #tp_str = '(reprfunc)gcc_Edge_repr',
                          tp_getset = getsettable.identifier,
                          )
    cu.add_defn(pytype.c_defn())
    modinit_preinit += pytype.c_invoke_type_ready()
    modinit_postinit += pytype.c_invoke_add_to_module()
开发者ID:eevee,项目名称:gcc-python-plugin,代码行数:50,代码来源:generate-cfg-c.py

示例11: generate_cfg

# 需要导入模块: from wrapperbuilder import PyGccWrapperTypeObject [as 别名]
# 或者: from wrapperbuilder.PyGccWrapperTypeObject import c_invoke_add_to_module [as 别名]
def generate_cfg():
    #
    # Generate the gcc.Cfg class:
    #
    global modinit_preinit
    global modinit_postinit

    getsettable = PyGetSetDefTable('PyGccCfg_getset_table',
                                   [PyGetSetDef('basic_blocks',
                                                'PyGccCfg_get_basic_blocks',
                                                None,
                                                'The list of gcc.BasicBlock instances in this graph'),
                                    PyGetSetDef('entry',
                                                cu.add_simple_getter('PyGccCfg_get_entry',
                                                                     'PyGccCfg',
                                                                     'PyGccBasicBlock_New(gcc_cfg_get_entry(self->cfg))'),
                                                None,
                                                'The initial gcc.BasicBlock in this graph'),
                                    PyGetSetDef('exit', 
                                                cu.add_simple_getter('PyGccCfg_get_exit',
                                                                     'PyGccCfg',
                                                                     'PyGccBasicBlock_New(gcc_cfg_get_exit(self->cfg))'),
                                                None,
                                                'The final gcc.BasicBlock in this graph'),
                                    ])
    cu.add_defn(getsettable.c_defn())
    pytype = PyGccWrapperTypeObject(identifier = 'PyGccCfg_TypeObj',
                          localname = 'Cfg',
                          tp_name = 'gcc.Cfg',
                          tp_dealloc = 'PyGccWrapper_Dealloc',
                          struct_name = 'PyGccCfg',
                          tp_new = 'PyType_GenericNew',
                          #tp_repr = '(reprfunc)PyGccCfg_repr',
                          #tp_str = '(reprfunc)PyGccCfg_repr',
                          tp_getset = getsettable.identifier,
                          )
    methods = PyMethodTable('PyGccCfg_methods', [])
    methods.add_method('get_block_for_label',
                       'PyGccCfg_get_block_for_label',
                       'METH_VARARGS',
                       "Given a gcc.LabelDecl, get the corresponding gcc.BasicBlock")
    cu.add_defn(methods.c_defn())
    pytype.tp_methods = methods.identifier

    cu.add_defn(pytype.c_defn())
    modinit_preinit += pytype.c_invoke_type_ready()
    modinit_postinit += pytype.c_invoke_add_to_module()
开发者ID:bganne,项目名称:gcc-python-plugin,代码行数:49,代码来源:generate-cfg-c.py

示例12: generate_intermediate_rtx_class_subclasses

# 需要导入模块: from wrapperbuilder import PyGccWrapperTypeObject [as 别名]
# 或者: from wrapperbuilder.PyGccWrapperTypeObject import c_invoke_add_to_module [as 别名]
def generate_intermediate_rtx_class_subclasses():
    global modinit_preinit
    global modinit_postinit

    for rtx_class in enum_rtx_class:
        cc = camel_case(rtx_class)
        pytype = PyGccWrapperTypeObject(identifier = 'PyGccRtlClassType%s_TypeObj' % cc,
                              localname = 'RtlClassType' + cc,
                              tp_name = 'gcc.%s' % cc,
                              struct_name = 'PyGccRtl',
                              tp_new = 'PyType_GenericNew',
                              tp_base = '&PyGccRtl_TypeObj',
                              #tp_getset = getsettable.identifier,
                              #tp_repr = '(reprfunc)PyGccRtl_repr',
                              #tp_str = '(reprfunc)PyGccRtl_str',
                              )
        cu.add_defn(pytype.c_defn())
        modinit_preinit += pytype.c_invoke_type_ready()
        modinit_postinit += pytype.c_invoke_add_to_module()
开发者ID:B-Rich,项目名称:gcc-python-plugin,代码行数:21,代码来源:generate-rtl-c.py

示例13: generate_pass_subclasses

# 需要导入模块: from wrapperbuilder import PyGccWrapperTypeObject [as 别名]
# 或者: from wrapperbuilder.PyGccWrapperTypeObject import c_invoke_add_to_module [as 别名]
def generate_pass_subclasses():
    global modinit_preinit
    global modinit_postinit

    for opt_pass_type in ('GIMPLE_PASS', 'RTL_PASS',
                          'SIMPLE_IPA_PASS', 'IPA_PASS'):
        cc = camel_case(opt_pass_type)
        pytype = PyGccWrapperTypeObject(identifier = 'PyGcc%s_TypeObj' % cc,
                              localname = cc,
                              tp_name = 'gcc.%s' % cc,
                              tp_dealloc = 'PyGccWrapper_Dealloc',
                              struct_name = 'PyGccPass',
                              tp_new = 'PyType_GenericNew',
                              tp_init = 'PyGcc%s_init' % cc,
                              tp_base = '&PyGccPass_TypeObj',
                              tp_flags = '(Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE)'
                              )
        cu.add_defn(pytype.c_defn())
        modinit_preinit += pytype.c_invoke_type_ready()
        modinit_postinit += pytype.c_invoke_add_to_module()
开发者ID:B-Rich,项目名称:gcc-python-plugin,代码行数:22,代码来源:generate-pass-c.py

示例14: generate_gimple_struct_subclasses

# 需要导入模块: from wrapperbuilder import PyGccWrapperTypeObject [as 别名]
# 或者: from wrapperbuilder.PyGccWrapperTypeObject import c_invoke_add_to_module [as 别名]
def generate_gimple_struct_subclasses():
    global modinit_preinit
    global modinit_postinit
    
    for gt in gimple_struct_types:
    #print gimple_types
        cc = gt.camel_cased_string()
        pytype = PyGccWrapperTypeObject(identifier = 'PyGccGimpleStructType%s_TypeObj' % cc,
                              localname = 'GimpleStructType' + cc,
                              tp_name = 'gcc.GimpleStructType%s' % cc,
                              tp_dealloc = 'PyGccWrapper_Dealloc',
                              struct_name = 'PyGccGimple',
                              tp_new = 'PyType_GenericNew',
                              tp_base = '&PyGccGimple_TypeObj',
                              #tp_getset = getsettable.identifier,
                              #tp_repr = '(reprfunc)PyGccGimple_repr',
                              #tp_str = '(reprfunc)PyGccGimple_str',
                              )
        cu.add_defn(pytype.c_defn())
        modinit_preinit += pytype.c_invoke_type_ready()
        modinit_postinit += pytype.c_invoke_add_to_module()
开发者ID:B-Rich,项目名称:gcc-python-plugin,代码行数:23,代码来源:generate-gimple-c.py

示例15: generate_rtl_base_class

# 需要导入模块: from wrapperbuilder import PyGccWrapperTypeObject [as 别名]
# 或者: from wrapperbuilder.PyGccWrapperTypeObject import c_invoke_add_to_module [as 别名]
def generate_rtl_base_class():
    #
    # Generate the gcc.Rtl class:
    #
    global modinit_preinit
    global modinit_postinit
    '''
    cu.add_defn("""
static PyObject *
PyGccRtl_get_block(struct PyGccRtl *self, void *closure)
{
    return PyGccTree_New(rtl_block(self->stmt));
}
""")
    '''
    getsettable = PyGetSetDefTable('PyGccRtl_getset_table', [])
    if GCC_VERSION < 5000:
        getsettable.add_gsdef('loc',
                              'PyGccRtl_get_location',
                              None,
                              'Source code location of this instruction, as a gcc.Location')
    getsettable.add_gsdef('operands',
                          'PyGccRtl_get_operands',
                          None,
                          'Operands of this expression, as a tuple')
    cu.add_defn(getsettable.c_defn())

    pytype = PyGccWrapperTypeObject(identifier = 'PyGccRtl_TypeObj',
                          localname = 'Rtl',
                          tp_name = 'gcc.Rtl',
                          tp_dealloc = 'PyGccWrapper_Dealloc',
                          struct_name = 'PyGccRtl',
                          tp_new = 'PyType_GenericNew',
                          tp_getset = getsettable.identifier,
                          tp_repr = '(reprfunc)PyGccRtl_repr',
                          tp_str = '(reprfunc)PyGccRtl_str',
                          )
    cu.add_defn(pytype.c_defn())
    modinit_preinit += pytype.c_invoke_type_ready()
    modinit_postinit += pytype.c_invoke_add_to_module()
开发者ID:HackLinux,项目名称:gcc-python-plugin,代码行数:42,代码来源:generate-rtl-c.py


注:本文中的wrapperbuilder.PyGccWrapperTypeObject.c_invoke_add_to_module方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。