Local optimization options
Hi, in Fortran, it would sometimes be useful to have a different optimization depending on whether we generate inlined code for intrinsics (where we know when it is OK to „go wild“) or user code, where we need to adhere (for example) to IEEE semantics unless otherwise instructed by the user. What could be a preferred way to achieve that? Could optimization options like -ffast-math be applied to blocks instead of functions? Could we set flags on the TREE codes to allow certain optinizations? Other things? Regards, Thomas
DW_OP_implict_value usage and motivation
Hello Everyone, Consider the following test case: [..] int main () { __int128 newVar = 8; newVar = ~newVar; return 0; } [..] Compiled as: $gcc foo.c -g -O1 produces DWARF for "newVar" as: [..] 0x004f: DW_TAG_variable DW_AT_name("newVar") DW_AT_decl_file ("/home/foo.c") DW_AT_decl_line (2) DW_AT_decl_column (0x0b) DW_AT_type(0x0070 "__int128") DW_AT_location(0x0004: [0x00401149, 0x00401149): DW_OP_implicit_value 0x10 0x08 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 [0x00401149, 0x0040114f): DW_OP_implicit_value 0x10 0xf7 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff) [..] I need to know, what's motivation here the for representing location with DW_OP_implicit_value form. Can't it be represented using DW_OP_consts ?? or some piece wise composition like this(works GDB is printing value correctly). [..] 0x0043: DW_TAG_variable DW_AT_location(0x: [0x002016a1, 0x002016b4): DW_OP_constu 0x75bcd15, DW_OP_stack_value, DW_OP_piece 0x8, DW_OP_lit0, DW_OP_stack_value, DW_OP_bit_piece 0x40 0x40, DW_OP_stack_value [0x002016b4, 0x002016cb): DW_OP_constu 0xeb79a2a, DW_OP_stack_value, DW_OP_piece 0x8, DW_OP_lit0, DW_OP_stack_value, DW_OP_bit_piece 0x40 0x40, DW_OP_stack_value) DW_AT_name("newVar") DW_AT_decl_file ("/home/foo.c") DW_AT_decl_line (2) DW_AT_type(0x005a "__int128") [..] If possible can somebody clarify the overall motivation behind "DW_OP_implicit_value" design/usage in GCC ? It's confusing in a sense if we use "int newVar = 8" in above program the GCC creates location expression using "DW_OP_stack_value": DW_AT_location(0x0004: [0x00401149, 0x00401149): DW_OP_lit8, DW_OP_stack_value [0x00401149, 0x0040114f): DW_OP_const1s -9, DW_OP_stack_value) While digging in, I stumbled upon this snippet(comment) from dwarf2out.c: /* Determine if DW_OP_stack_value or DW_OP_implicit_value is more compact. For DW_OP_stack_value we need: litsize + 1 (DW_OP_stack_value) and for DW_OP_implicit_value: 1 (DW_OP_implicit_value) + 1 (length) + size. */ Can somebody engaged in this feature help/clarify, all the findings here. Thanks in anticipation! Sourabh.
Re: DW_OP_implict_value usage and motivation
On Sat, Jul 04, 2020 at 04:23:58PM +, Tomar, Sourabh Singh wrote: > Consider the following test case: > [..] > int main () { > __int128 newVar = 8; > newVar = ~newVar; > return 0; > } DW_OP_implicit_value as well as DW_OP_stack_value is described in DWARF4/5, just read the description in there. And as you found, in some cases it is possible to represent the value by either of those, in which case GCC tries to use the shorter one. For __int128, to use DW_OP_stack_value one would need to use the typed DWARF stack DWARF5 features (so e.g. inappropriate in DWARF4 mode when it can be represented by DWARF4 features already). Jakub
Re: Local optimization options
On July 4, 2020 11:30:05 AM GMT+02:00, "Thomas König" wrote: >Hi, > >in Fortran, it would sometimes be useful to have a different >optimization >depending on whether we generate inlined code for intrinsics (where we >know when it is OK to „go wild“) or user code, where we need to >adhere (for example) to IEEE semantics unless otherwise instructed >by the user. > >What could be a preferred way to achieve that? Could optimization >options like -ffast-math be applied to blocks instead of functions? >Could we set flags on the TREE codes to allow certain optinizations? >Other things? The middle end can handle those things on function granularity only. Richard. >Regards, Thomas
gcc-10-20200704 is now available
Snapshot gcc-10-20200704 is now available on https://gcc.gnu.org/pub/gcc/snapshots/10-20200704/ and on various mirrors, see http://gcc.gnu.org/mirrors.html for details. This snapshot has been generated from the GCC 10 git branch with the following options: git://gcc.gnu.org/git/gcc.git branch releases/gcc-10 revision 56a34e3e1cbb7d3b2f9298c14d4d3a3a030c7755 You'll find: gcc-10-20200704.tar.xz Complete GCC SHA256=6282fd1eab63a70e831df1a3ad6ddefd2ed59310af980efab3789eb96b7bfe12 SHA1=0e40b4faad9686a80942b86afcd533f86ad686d4 Diffs from 10-20200627 are available in the diffs/ subdirectory. When a particular snapshot is ready for public consumption the LATEST-10 link is updated and a message is sent to the gcc list. Please do not use a snapshot before it has been announced that way.