CX51 用户手册----REGPARMS伪指令

声明:

1、本翻译仅供个人学习使用,本人没有提供技术支持的义务,也不承担由此引发的任何后果。

2、请勿用于商业用途。

3、英文来自:http://www.keil.com/support/man/docs/c51/。

4、欢迎大家共同与我交流探讨(290207203@qq.com)。

REGPARMS Compiler Directive

Abbreviation

None.

Arguments

None.

Default

REGPARMS

µVision

Options — C51 — Misc controls.

Description

The REGPARMS directive instructs the compiler to pass up to three function arguments in registers. Parameters that cannot be passed in registers are passed using fixed memory locations. This technique is used in assembly programs to improve speed and reduce memory utilization. It is significantly faster than storing function arguments in memory.

 Note

  • You may specify both the REGPARMS and NOREGPARMS directive several times within a source file to compile some functions using register parameters and other functions using the old style of parameter passing. For example:
    #pragma NOREGPARMS      /* Parm passing-old style */
    extern int old_func (int, char);
    
    #pragma REGPARMS        /* Parm passing-in registers */
    extern int new_func (int, char);
    
    main  ()  {
            char a;
            int  x1, x2;
            x1 = old_func (x2, a);
            x1 = new_func (x2, a);
    }
    
  • You may use the NOREGPARMS directive when accessing assembly functions or libraries that were built with older tools.
See Also

NOREGPARMS

Example
C51 SAMPLE.C REGPARMS

 Related Knowledgebase Articles


REGPARMS 编译器伪指令

缩写

无。

参数

无。

缺省

REGPARMS

µVision

Options — C51 — Misc controls.

描述

REGPARMS 伪指令告诉编译器最多传递3个函数参数到寄存器中。不能传递到寄存器的参数保存在固定的存储器位置。这个技术用在汇编程序中,可以提高速度,并降低存储器的使用。这比存储函数参数到存储器中更快。

 注意

  • 用户可以在源文件中多次指定 REGPARMS 和 NOREGPARMS 伪指令编译使用寄存器参数的函数和使用旧风格传递参数的函数。例如:
    #pragma NOREGPARMS      /* Parm passing-old style */
    extern int old_func (int, char);
    
    #pragma REGPARMS        /* Parm passing-in registers */
    extern int new_func (int, char);
    
    main  ()  {
            char a;
            int  x1, x2;
            x1 = old_func (x2, a);
            x1 = new_func (x2, a);
    }
    
  • 当访问旧工具构建的汇编函数或库函数时,用户可以使用 NOREGPARMS 伪指令。 
参考

NOREGPARMS

示例
C51 SAMPLE.C REGPARMS

相关知识库标题






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值