標(biāo)題: 請教一個擴(kuò)展匯編的問題 [打印本頁] 作者: flw2 時間: 2007-06-20 14:32 標(biāo)題: 請教一個擴(kuò)展匯編的問題 我在內(nèi)核代碼看匯編的時候,不明白'=&r'和'=r'是什么區(qū)別,看了n多資料都一樣的,就幾句話,還是沒看懂作者: 帥絕人寰 時間: 2007-06-20 15:18
Unless an output operand has the `&' constraint modifier, GCC may
allocate it in the same register as an unrelated input operand, on the
assumption the inputs are consumed before the outputs are produced.
This assumption may be false if the assembler code actually consists of
more than one instruction. In such a case, use `&' for each output
operand that may not overlap an input. *Note Modifiers::.
`&'
Means (in a particular alternative) that this operand is an
"earlyclobber" operand, which is modified before the instruction is
finished using the input operands. Therefore, this operand may
not lie in a register that is used as an input operand or as part
of any memory address.
`&' applies only to the alternative in which it is written. In
constraints with multiple alternatives, sometimes one alternative
requires `&' while others do not. See, for example, the `movdf'
insn of the 68000.
An input operand can be tied to an earlyclobber operand if its only
use as an input occurs before the early result is written. Adding
alternatives of this form often allows GCC to produce better code
when only some of the inputs can be affected by the earlyclobber.
See, for example, the `mulsi3' insn of the ARM.
`&' does not obviate the need to write `='.作者: flw2 時間: 2007-06-20 15:52
這個我看了,能解釋一下嗎?不明白用與不用的區(qū)別
我把一些代碼翻譯了一下,有沒有&都是一樣的,一個字的區(qū)別都沒有作者: albcamus 時間: 2007-06-20 16:03
Unless an output operand has the `&' constraint modifier, GCC may
allocate it in the same register as an unrelated input operand, on the
assumption the inputs are consumed before the outputs are produced.
This assumption may be false if the assembler code actually consists of
more than one instruction. In such a case, use `&' for each output
operand that may not overlap an input.
__________________