diff options
| author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-29 18:24:50 +0000 |
|---|---|---|
| committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-29 18:24:50 +0000 |
| commit | 6840589f3c7753220c4d315ce93014a5c7edfa01 (patch) | |
| tree | f0f32075fb72921dd130201ceba23d250949163a /gcc/expr.h | |
| parent | 8b2cf69585ed52a2922c76e6087fb5744352cbc6 (diff) | |
| download | ppe42-gcc-6840589f3c7753220c4d315ce93014a5c7edfa01.tar.gz ppe42-gcc-6840589f3c7753220c4d315ce93014a5c7edfa01.zip | |
* expr.h (store_by_pieces): Add prototype.
(can_store_by_pieces): Likewise.
* expr.c (struct store_by_pieces): Renamed from clear_by_pieces.
(can_store_by_pieces): New.
(store_by_pieces): New.
(clear_by_pieces): New.
(clear_by_pieces_1): New.
(store_by_pieces_1): Renamed from clear_by_pieces, handle storing
arbitrary compiler generated constants into memory block.
(store_by_pieces_2): Renamed from clear_by_pieces_1, likewise.
* builtins.c (c_readstr): New.
(builtin_memcpy_read_str): New.
(expand_builtin_memcpy): If src is string constant and
emit_block_move would move it by pieces, compute integer constants
from the string and store it into memory block instead.
(builtin_strncpy_read_str): New.
(expand_builtin_strncpy): If N is not constant zero and c_strlen does
not return INTEGER_CST, don't optimize.
If N is larger than strlen(src) + 1, try to copy the string
including padding with store_by_pieces.
(expand_builtin_strcmp): If both arguments have side effects, don't
optimize.
(expand_builtin_fputs): If STR has side effects, don't optimize.
* gcc.c-torture/execute/string-opt-5.c: Add some strcmp and strncpy
tests.
* gcc.c-torture/execute/string-opt-6.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37851 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expr.h')
| -rw-r--r-- | gcc/expr.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/expr.h b/gcc/expr.h index 8cb28361038..74af2d9957f 100644 --- a/gcc/expr.h +++ b/gcc/expr.h @@ -1010,6 +1010,25 @@ extern void use_group_regs PARAMS ((rtx *, rtx)); alignment. */ extern rtx clear_storage PARAMS ((rtx, rtx, unsigned int)); +/* Return non-zero if it is desirable to store LEN bytes generated by + CONSTFUN with several move instructions by store_by_pieces + function. CONSTFUNDATA is a pointer which will be passed as argument + in every CONSTFUN call. + ALIGN is maximum alignment we can assume. */ +extern int can_store_by_pieces PARAMS ((unsigned HOST_WIDE_INT, + rtx (*) (PTR, HOST_WIDE_INT, + enum machine_mode), + PTR, unsigned int)); + +/* Generate several move instructions to store LEN bytes generated by + CONSTFUN to block TO. (A MEM rtx with BLKmode). CONSTFUNDATA is a + pointer which will be passed as argument in every CONSTFUN call. + ALIGN is maximum alignment we can assume. */ +extern void store_by_pieces PARAMS ((rtx, unsigned HOST_WIDE_INT, + rtx (*) (PTR, HOST_WIDE_INT, + enum machine_mode), + PTR, unsigned int)); + /* Emit insns to set X from Y. */ extern rtx emit_move_insn PARAMS ((rtx, rtx)); |

