>Number: 9702 >Category: optimization >Synopsis: Constant pools are not shared among functions >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: pessimizes-code >Submitter-Id: net >Arrival-Date: Fri Feb 14 09:36:01 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Árpád Beszédes >Release: gcc version 3.3 20030210 (prerelease) >Organization: >Environment: BUILD & HOST: Linux 2.4.20 i686 unknown TARGET: arm-unknown-elf >Description: Currently all functions have their own constant pool even if they use the same constants. Gcc should merge appropriate constant pools and place this common pool to a location accessible from all appropriate functions. >How-To-Repeat: Use the command line below to compile the specified source code: arm-elf-gcc -S -g0 -Os -o 02.s ./02.c Attached is the original assembly output where constant pools labeled by .L2 and .L5 could be merged together as shown in the manually edited assembly file. // 02.c: # 1 "02.c" # 1 "" # 1 "" # 1 "02.c" unsigned int a; int f1() { return a+2; } int f3() { a=12; } int main () { f3(); return f1(); } >Fix: If unit-at-a-time compilation is implemented in gcc, this issue could be solved within gcc more easily. >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/x-gzip; name="cp-sharing.tar.gz" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="cp-sharing.tar.gz" H4sIABuwTD4AA+2Y32/TMBDH+5pK/R+OFqRNJMGxk1TaGELaw3iY4AHxhNDkJk5kkdiVk2yMaf87 tpuGFe2HxGiByZ+qsnN3tuNvemelCId8tGVQhFCaohFCKJonsWlRFK9aA06TEZqnGM/TBMfIxMcJ GgHa9o0ZuqalCmBUMtXK+u44WrFsF/ezY2YQwRThMJtOxrb/etHxqg24eDNYMlnXVORQccEGaz+m Ew0vBcuBixbo4WRs2iLa25+MryZjAMXaTgmgL7H2XfduMrjpUXTDUVMuYPCZsMMbc5hZV7F/W7Qn hH6MzdbXuD//ozmK+/yPE5ys8j91+b8TvLDgFfPW6eyFLfvWmpZWOq89bLplJRe08orI+i+XTHd9 eFF0Imu5FJNxER1o11ugqmzgCJAPS52zTJcMe1EoWjPTtUH26kwwlrPe3zWsOaNCistadrrXz2Kj dc35qgtAyZuWKWjoOQNW8ZoL2rI81CFVrjxFfAhP8fpKT/nZmGboizbRPLcm853h1aQK+vULqfS9 ykqWHdOuWp57y8zXAZNxeEoONoTQK1jDhVS5R02v4d9XWoTBSpxbRCM/RSObopF/QbSk37XCWp3o AXmaVtnAG+puKpb+qlhyq2LEKkZuV8wcAoNm5mJDNWP4fd2i+3QzW+FLH5ql3Wpd5F6zfObDVaGN xlEpvVZ2bbzdwltbZ7E2LPonXeU1o9ZlRzV2lBmx6NPHCrDaVRist2oOWI/6EPtArBQ8Z6L1pifH xwewd/L+0z6QkABGiCAcIdjTO1asYrRh+9PHHYcIn9Uy5wXXP4xtHQQP1f80IUP9J0mq4zEh2NX/ XfCE6n/yZ+v/+uPKvCvz/32ZvxPFqN7LVqYeeOj9H6Xz9fs/JjHW8foASFz93wXv5AW0UleRJaOt zrjnOuHqgFVFUGYZBB8hKBEEHxoIJJh3RQhfoR38ZeRwOBwOh8PhcDgcDofD4XA4HI5H8gOrvl1I ACgAAA==