diff options
author | rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-01-23 08:24:38 +0000 |
---|---|---|
committer | rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-01-23 08:24:38 +0000 |
commit | 431cd7a81d9d958b0e7d7bd57138467d22224efc (patch) | |
tree | bf94a0c87d742a1c445f545a8cbf5dfc3bbab8cf /gcc/recog.c | |
parent | 2a18cf5504e1903f06ecb23bfafbd836f6199fce (diff) | |
download | gcc-431cd7a81d9d958b0e7d7bd57138467d22224efc.tar.gz |
gcc/
PR target/52125
* rtl.h (get_referenced_operands): Declare.
* recog.c (get_referenced_operands): New function.
* config/mips/mips.c (mips_reorg_process_insns): Check which asm
operands have been referenced when recording LO_SUM references.
gcc/testsuite/
PR target/52125
* gcc.dg/pr48774.c: Remove skip for mips_rel.
* gcc.target/mips/pr52125.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206955 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/recog.c')
-rw-r--r-- | gcc/recog.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/gcc/recog.c b/gcc/recog.c index b81214cf41c..e2caf9859d8 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -1620,6 +1620,50 @@ decode_asm_operands (rtx body, rtx *operands, rtx **operand_locs, return ASM_OPERANDS_TEMPLATE (asmop); } +/* Parse inline assembly string STRING and determine which operands are + referenced by % markers. For the first NOPERANDS operands, set USED[I] + to true if operand I is referenced. + + This is intended to distinguish barrier-like asms such as: + + asm ("" : "=m" (...)); + + from real references such as: + + asm ("sw\t$0, %0" : "=m" (...)); */ + +void +get_referenced_operands (const char *string, bool *used, + unsigned int noperands) +{ + memset (used, 0, sizeof (bool) * noperands); + const char *p = string; + while (*p) + switch (*p) + { + case '%': + p += 1; + /* A letter followed by a digit indicates an operand number. */ + if (ISALPHA (p[0]) && ISDIGIT (p[1])) + p += 1; + if (ISDIGIT (*p)) + { + char *endptr; + unsigned long opnum = strtoul (p, &endptr, 10); + if (endptr != p && opnum < noperands) + used[opnum] = true; + p = endptr; + } + else + p += 1; + break; + + default: + p++; + break; + } +} + /* Check if an asm_operand matches its constraints. Return > 0 if ok, = 0 if bad, < 0 if inconclusive. */ |