Message ID | 4D022224.4000407@codesourcery.com |
---|---|
State | New |
Headers | show |
On Fri, Dec 10, 2010 at 08:50:44PM +0800, Chung-Lin Tang wrote: > On 2010/12/10 06:06, Jakub Jelinek wrote: > >The last operand of ASM_OPERANDS and ASM_INPUT is a RTL locator, > >for which we unfortunately don't guarantee uniqueness. One has > >to call locator_eq to actually compare them. > >On the testcases below, without -save-temps the locators are equal > >while without them some other location_t got a locator in between. > > Actually, I think the issue is not just about comparing locators, > but rather: why do you need locator equality for > ASM_INPUT/ASM_OPERANDS to be equivalent? The checking of the other Because then you regress in debug info quality, we emit the location with .loc before the asm. Though, for -O0 we hopefully don't perform crossjumping and similar optimizations, and for -O1+ the code quality is more important than debug info quality. If we'd want to ignore it, the right fix wouldn't be your patch, but just making that operand use 0 format instead of i and adjust print-rtl.c etc. Jakub
Jakub Jelinek wrote: >> Actually, I think the issue is not just about comparing locators, >> > but rather: why do you need locator equality for >> > ASM_INPUT/ASM_OPERANDS to be equivalent? The checking of the other > Because then you regress in debug info quality, we emit the location > with .loc before the asm. Though, for -O0 we hopefully don't perform > crossjumping and similar optimizations, and for -O1+ the code quality is > more important than debug info quality. > > If we'd want to ignore it, the right fix wouldn't be your patch, > but just making that operand use 0 format instead of i and adjust > print-rtl.c etc. I see your point. However, to adjust the equivalence criteria depending on optimization level (as you suggested), changing to '0' format does not make it easier :) I would still suggest using code to achieve that. CL
Index: rtl.c =================================================================== --- rtl.c (revision 167678) +++ rtl.c (working copy) @@ -360,6 +360,7 @@ int j; enum rtx_code code; const char *fmt; + int fmt_end; rtx nx, ny; if (x == y) @@ -419,7 +420,10 @@ fail to match, return 0 for the whole thing. */ fmt = GET_RTX_FORMAT (code); - for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) + fmt_end = (GET_RTX_LENGTH (code) + - (code == ASM_INPUT || code == ASM_OPERANDS ? 2 : 1)); + + for (i = fmt_end; i >= 0; i--) { switch (fmt[i]) { @@ -490,6 +494,7 @@ int j; enum rtx_code code; const char *fmt; + int fmt_end; if (x == y) return 1; @@ -543,7 +548,10 @@ fail to match, return 0 for the whole thing. */ fmt = GET_RTX_FORMAT (code); - for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) + fmt_end = (GET_RTX_LENGTH (code) + - (code == ASM_INPUT || code == ASM_OPERANDS ? 2 : 1)); + + for (i = fmt_end; i >= 0; i--) { switch (fmt[i]) { Index: jump.c =================================================================== --- jump.c (revision 167678) +++ jump.c (working copy) @@ -1584,6 +1584,7 @@ int i; const enum rtx_code code = GET_CODE (x); const char *fmt; + int fmt_end; if (x == y) return 1; @@ -1715,7 +1716,10 @@ fail to match, return 0 for the whole things. */ fmt = GET_RTX_FORMAT (code); - for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) + fmt_end = (GET_RTX_LENGTH (code) + - (code == ASM_INPUT || code == ASM_OPERANDS ? 2 : 1)); + + for (i = fmt_end; i >= 0; i--) { int j; switch (fmt[i])