This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

address-of causes "`asm' operand requires impossible reload"


I'm having trouble using the address-of operator (&) in the source
operand field for asm().  The doc says it is a c-expression, so I'm
assuming I can get an address-of a variable.

The error message is:
       `asm' operand requires impossible reload
The generated assembler looks ok and it appears the error may not occur
if by some chance the &-value is already in a register and lives
beyond the asm instruction.

Any ideas?

-Ed Swarthout
swarthou@ibmoto.com
Somerset Design Center

--------------------------------------------------------------------
/home/swarthou/t/lib/gcc-lib/rs6000-ibm-aix4.1.5.0/egcs-2.91.66/cc1 asmreload.i 
    -quiet -dumpbase asmreload.c -dr -dl -dg -g -O -version -o asmreload.s
GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release) (rs6000-ibm-aix4.1.5.0) 
asmreload.c: In function `z':
asmreload.c:6: `asm' operand requires impossible reload
gmake: *** [asmreload] Error 1
---------------------------- asmreload.c ---------------------------
unsigned long val1,val2;
z() {
  const void *ptr1=&val1;
  const void *ptr2=&val2;
  asm ("dcbf 0,%0" : : "r" ( &val1) );  /* line 5 - works if ptr1 is referenced later */
  asm ("dcbf 0,%0" : : "r" ( &val2) );  /* line 6 - fails with: requires impossible reload*/

  asm ("dcbf 0,%0" : : "r" ( ptr1 ) );  /* this line makes line 5 work */ 
  asm ("dcbf 0,%0" : : "r" ( ptr2 ) );
  { void *__zz=&val2;
  asm ("dcbf 0,%0" : : "r" (__zz));
  }
}
---------------------------- asmreload.c.lreg ---------------------------
;; Function z
84 registers.
Register 81 used 2 times across 12 insns in block 0; ...
Register 82 used 3 times across 14 insns in block 0; ...
1 basic blocks.
Basic block 0: first insn 7, last 25.
Registers live at start: 1 31
;; Register 81 in 9.
;; Register 82 in 0.
(note 1 0 2 ("asmreload.c") 2)
(note 2 1 3 "" NOTE_INSN_DELETED)
(note 3 2 4 "" NOTE_INSN_FUNCTION_BEG)
(note 4 3 5 "" NOTE_INSN_DELETED)
(note 5 4 6 ("asmreload.c") 3)
(note 6 5 7 0 NOTE_INSN_BLOCK_BEG)
;; Start of basic block 0, registers live: 1 [1] 31 [31]
(insn 7 6 8 (use (symbol_ref:SI ("val1"))) -1 (nil)
    (nil))
(insn 8 7 9 (set (reg/v:SI 81)
        (mem/u:SI (symbol_ref/u:SI ("*LC..0")))) 402 {movsi+1} (nil)
    (expr_list:REG_EQUIV (symbol_ref:SI ("val1"))
        (nil)))
(note 9 8 10 ("asmreload.c") 4)
(insn 10 9 11 (use (symbol_ref:SI ("val2"))) -1 (nil)
    (nil))
(insn 11 10 12 (set (reg/v:SI 82)
        (mem/u:SI (symbol_ref/u:SI ("*LC..1")))) 402 {movsi+1} (nil)
    (expr_list:REG_EQUIV (symbol_ref:SI ("val2"))
        (nil)))
(note 12 11 13 ("asmreload.c") 5)
(insn 13 12 14 (asm_operands/v ("dcbf 0,%0") ("") 0[ 
            (symbol_ref:SI ("val1"))
        ] 
        [ 
            (asm_input:SI ("r"))
        ]  ("asmreload.c") 5) -1 (nil)
    (nil))
(note 14 13 15 ("asmreload.c") 6)
(insn 15 14 16 (asm_operands/v ("dcbf 0,%0") ("") 0[ 
            (symbol_ref:SI ("val2"))
        ] 
        [ 
            (asm_input:SI ("r"))
        ]  ("asmreload.c") 6) -1 (nil)
    (nil))
(note 16 15 17 ("asmreload.c") 8)
(insn 17 16 18 (asm_operands/v ("dcbf 0,%0") ("") 0[ 
            (reg/v:SI 81)
        ] 
        [ 
            (asm_input:SI ("r"))
        ]  ("asmreload.c") 8) -1 (insn_list 8 (nil))
    (expr_list:REG_DEAD (reg/v:SI 81)
        (nil)))
(note 18 17 19 ("asmreload.c") 9)
(insn 19 18 20 (asm_operands/v ("dcbf 0,%0") ("") 0[ 
            (reg/v:SI 82)
        ] 
        [ 
            (asm_input:SI ("r"))
        ]  ("asmreload.c") 9) -1 (insn_list 11 (nil))
    (nil))
(note 20 19 21 ("asmreload.c") 10)
(note 21 20 22 0 NOTE_INSN_BLOCK_BEG)
(insn 22 21 23 (use (symbol_ref:SI ("val2"))) -1 (nil)
    (nil))
(note 23 22 24 "" NOTE_INSN_DELETED)
(note 24 23 25 ("asmreload.c") 11)
(insn 25 24 26 (asm_operands/v ("dcbf 0,%0") ("") 0[ 
            (reg/v:SI 82)
        ] 
        [ 
            (asm_input:SI ("r"))
        ]  ("asmreload.c") 11) -1 (nil)
    (expr_list:REG_DEAD (reg/v:SI 82)
        (nil)))
;; End of basic block 0
(note 26 25 27 ("asmreload.c") 12)
(note 27 26 28 0 NOTE_INSN_BLOCK_END)
(note 28 27 29 ("asmreload.c") 13)
(note 29 28 0 0 NOTE_INSN_BLOCK_END)
---------------------------- asmreload.s ---------------------------
...
.toc
LC..0:
	.tc val1[TC],val1
LC..1:
	.tc val2[TC],val2
...
.stabx "ptr1:r5=*-11",9,131,0
.stabx "ptr2:r5",0,131,0
	lwz 9,LC..0(2)
	.line	3
	lwz 0,LC..1(2)
	.line	4
	dcbf 0,9
	.line	5
	mr 11,0
	dcbf 0,11
	.line	7
	dcbf 0,9
	.line	8
	dcbf 0,0
	.line	9
	.bb	9
	.line	10
	dcbf 0,0
...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]