‘s’
An immediate integer operand whose value is not an explicit integer is allowed.
This might appear strange; if an insn allows a constant operand with a value
not known at compile time, it certainly must allow any known value. So why
use ‘s’ instead of ‘i’? Sometimes it allows better code to be generated.
For example, on the 68000 in a fullword instruction it is possible to use an
immediate operand; but if the immediate value is between −128 and 127, better
code results from loading the value into a register and using the register. This
is because the load into the register can be done with a ‘moveq’ instruction. We
arrange for this to happen by defining the letter ‘K’ to mean “any integer outside
the range −128 to 127”, and then specifying ‘Ks’ in the operand constraints.
‘I’, ‘J’, ‘K’, . . . ‘P’
Other letters in the range ‘I’ through ‘P’ may be defined in a machine-dependent
fashion to permit immediate integer operands with explicit integer values in
specified ranges. For example, on the 68000, ‘I’ is defined to stand for the
range of values 1 to 8. This is the range permitted as a shift count in the shift
instructions.
sonicling 发表于 2012-10-15 15:51
回复 23# zylthinking 这是gcc asm_operand_ok()的部分代码,"s"检查通过的条件是
!CONST_INT_P (op) && ...
/* Reference to an assembler label in the code for this function.
The operand is a CODE_LABEL found in the insn chain. */
DEF_RTL_EXPR(LABEL_REF, "label_ref", "u", RTX_CONST_OBJ)
/* Reference to a named label:
Operand 0: label name
Operand 1: flags (see SYMBOL_FLAG_* in rtl.h)
Operand 2: tree from which this symbol is derived, or null.
This is either a DECL node, or some kind of constant. */
DEF_RTL_EXPR(SYMBOL_REF, "symbol_ref", "s00", RTX_CONST_OBJ)
欢迎光临 Chinaunix (http://bbs.chinaunix.net/) | Powered by Discuz! X3.2 |