Chinaunix首页 | 论坛 | 博客
  • 博客访问: 178097
  • 博文数量: 69
  • 博客积分: 2627
  • 博客等级: 少校
  • 技术积分: 715
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-24 22:37
文章分类

全部博文(69)

文章存档

2017年(3)

2014年(1)

2013年(4)

2012年(6)

2011年(21)

2010年(15)

2009年(19)

我的朋友

分类: LINUX

2009-04-13 00:25:02


第十二章 Using Inline Assembly


"constraint"(variable)
where variable is a C variable declared within the program.
In the extended asm format, both local and global variables can be used.
The constraint defines where the variable is placed (for input values) or moved from (for output values).
This is what defines whether the value is placed in a register or a memory location.

The constraint is a single-character code. The constraint codes are shown in the following table.
Constraint       Description
  a            Use the %eax, %ax, or %al registers.
  b            Use the %ebx, %bx, or %bl registers.
  c            Use the %ecx, %cx, or %cl registers.
  d            Use the %edx, %dx, or $dl registers.
  S            Use the %esi or %si registers.
  D            Use the %edi or %di registers.
  r            Use any available general-purpose register.
  q            Use either the %eax, %ebx, %ecx, or %edx register.
  A            Use the %eax and the %edx registers for a 64-bit value.
  f            Use a floating-point register.
  t            Use the first (top) floating-point register.
  u            Use the second floating-point register.
  m            Use the variable’s memory location.
  o            Use an offset memory location.
  V            Use only a direct memory location.
  i            Use an immediate integer value.
  n            Use an immediate integer value with a known value.
  g            Use any register or memory location available.

In addition to these constraints, output values include a constraint modifier,
which indicates how the output value is handled by the compiler.
The output modifiers that can be used are shown in the following table.

Output Modifier Description
--------------------------------
+   The operand can be both read from and written to.
=   The operand can only be written to.
%   The operand can be switched with the next operand if necessary.
&   The operand can be deleted and reused before the inline functions complete.
阅读(465) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~