[jit] Merger of trunk *r216746* into jit branch

2014-10-27 Thread David Malcolm
On Mon, 2014-10-27 at 13:50 -0400, David Malcolm wrote: > I've merged svn trunk into the git dmalcolm/jit branch, specifically > from trunk r216746 aka fddbd0194b01f44c5b5f16379fd5405dcf6d71c0 > (2014-10-27) bringing in all changes since r216524 aka > d14cac46135326115f0dc589b0b3d

[gimple-classes, committed 00/92] Initial slew of commits

2014-10-27 Thread David Malcolm
TURN Dave [1] https://github.com/davidmalcolm/gcc-refactoring-scripts/blob/master/refactor_gimple_patches.py and https://github.com/davidmalcolm/gcc-refactoring-scripts/blob/master/gimple_approvals.py David Malcolm (92): Introduce gimple_switch and use it in various places Introduce gimple_bi

[gimple-classes, committed 09/92] Update ssa_prop_visit_phi_fn callbacks to take a gimple_phi

2014-10-27 Thread David Malcolm
22 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes index 33a4f87..bd635c6 100644 --- a/gcc/ChangeLog.gimple-classes +++ b/gcc/ChangeLog.gimple-classes @@ -1,5 +1,21 @@ 2014-10-24 David Malcolm + Update ssa_prop_visit_phi_fn callbacks to tak

[gimple-classes, committed 02/92] Introduce gimple_bind and use it for accessors.

2014-10-27 Thread David Malcolm
ngeLog.gimple-classes index 08dbf95..dc1edc86 100644 --- a/gcc/ChangeLog.gimple-classes +++ b/gcc/ChangeLog.gimple-classes @@ -1,5 +1,94 @@ 2014-10-24 David Malcolm + Introduce gimple_bind and use it for accessors. + + * coretypes.h (gimple_bind): New typedef. + (const_gimple_bin

[gimple-classes, committed 04/92] Introduce gimple_assign and use it in various places

2014-10-27 Thread David Malcolm
es +++ b/gcc/ChangeLog.gimple-classes @@ -1,5 +1,70 @@ 2014-10-24 David Malcolm + Introduce gimple_assign and use it in various places + + * coretypes.h (gimple_assign): New typedef. + (const_gimple_assign): New typedef. + + * gimple.h (struct gimp

[gimple-classes, committed 06/92] Introduce gimple_debug and use it in a few places

2014-10-27 Thread David Malcolm
-) diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes index 68eb669..ec16551 100644 --- a/gcc/ChangeLog.gimple-classes +++ b/gcc/ChangeLog.gimple-classes @@ -1,5 +1,42 @@ 2014-10-24 David Malcolm + Introduce gimple_debug and use it in a few places + +

[gimple-classes, committed 05/92] Introduce gimple_label and use it in a few places

2014-10-27 Thread David Malcolm
+1,37 @@ 2014-10-24 David Malcolm + Introduce gimple_label and use it in a few places + + * coretypes.h (gimple_label): New typedef. + (const_gimple_label): New typedef. + + * gimple.h (struct gimple_statement_label): New subclass of + gimple_statement_with_ops,

[gimple-classes, committed 14/92] tree-ssa-loop-manip.c: use gimple_phi in three places

2014-10-27 Thread David Malcolm
| 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes index 533002f..1e636be 100644 --- a/gcc/ChangeLog.gimple-classes +++ b/gcc/ChangeLog.gimple-classes @@ -1,5 +1,13 @@ 2014-10-24 David Malcolm + tree-ss

[gimple-classes, committed 01/92] Introduce gimple_switch and use it in various places

2014-10-27 Thread David Malcolm
gcc/ChangeLog.gimple-classes diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes new file mode 100644 index 000..08dbf95 --- /dev/null +++ b/gcc/ChangeLog.gimple-classes @@ -0,0 +1,100 @@ +2014-10-24 David Malcolm + + Introduce gimple_switch and use it in various places

[gimple-classes, committed 03/92] Introduce gimple_cond and use it in various places

2014-10-27 Thread David Malcolm
angeLog.gimple-classes b/gcc/ChangeLog.gimple-classes index dc1edc86..a7d756e 100644 --- a/gcc/ChangeLog.gimple-classes +++ b/gcc/ChangeLog.gimple-classes @@ -1,5 +1,71 @@ 2014-10-24 David Malcolm + Introduce gimple_cond and use it in various places + + * coretypes.h (gimple_cond

[gimple-classes, committed 19/92] Introduce gimple_return

2014-10-27 Thread David Malcolm
le-classes index ba0bde6..5508788 100644 --- a/gcc/ChangeLog.gimple-classes +++ b/gcc/ChangeLog.gimple-classes @@ -1,5 +1,48 @@ 2014-10-24 David Malcolm + Introduce gimple_return + + * coretypes.h (gimple_return): New typedef. + (const_gimple_return): New typedef. + + *

[gimple-classes, committed 25/92] Introduce gimple_eh_must_not_throw

2014-10-27 Thread David Malcolm
le-classes +++ b/gcc/ChangeLog.gimple-classes @@ -1,5 +1,32 @@ 2014-10-24 David Malcolm + Introduce gimple_eh_must_not_throw + + * coretypes.h (gimple_eh_must_not_throw): New typedef. + (const_gimple_eh_must_not_throw): New typedef. + + * gimple-pretty-print.c (dump_gimple_eh_must

[gimple-classes, committed 20/92] Introduce gimple_goto

2014-10-27 Thread David Malcolm
hangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes index 5508788..bba6c7d 100644 --- a/gcc/ChangeLog.gimple-classes +++ b/gcc/ChangeLog.gimple-classes @@ -1,5 +1,32 @@ 2014-10-24 David Malcolm + Introduce gimple_goto + + * coretypes.h (gimple_goto): New typedef. + (

[gimple-classes, committed 22/92] Introduce gimple_transaction

2014-10-27 Thread David Malcolm
insertions(+), 79 deletions(-) diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes index bd88371..b3a475e 100644 --- a/gcc/ChangeLog.gimple-classes +++ b/gcc/ChangeLog.gimple-classes @@ -1,5 +1,88 @@ 2014-10-24 David Malcolm + Introduce gimple_transact

Re: [PATCH 1/5] New Identical Code Folding IPA pass

2014-06-17 Thread David Malcolm
On Fri, 2014-06-13 at 12:24 +0200, mliska wrote: [...snip...] > Statistics about the pass: > Inkscape: 11.95 MB -> 11.44 MB (-4.27%) > Firefox: 70.12 MB -> 70.12 MB (-3.07%) FWIW, you wrote 70.12 MB here for both before and after for Firefox, but give a -3.07% change, which seems like a typo

Instructions vs Expressions in the backend (was Re: RFA: Rework FOR_BB_INSNS iterators)

2014-06-23 Thread David Malcolm
On Mon, 2014-06-09 at 20:32 +0100, Richard Sandiford wrote: > Steven Bosscher writes: > > On Sat, Jun 7, 2014 at 7:54 PM, Richard Sandiford wrote: > >> The two parts of the loop condition are really handling two different > >> kinds of block: ones like entry and exit that are completely empty > >>

Re: Instructions vs Expressions in the backend (was Re: RFA: Rework FOR_BB_INSNS iterators)

2014-06-27 Thread David Malcolm
On Wed, 2014-06-25 at 14:39 -0600, Jeff Law wrote: > On 06/25/14 03:36, Richard Sandiford wrote: > > > > I think this is an example of another problem with gcc coding style: > > that we're far too afraid of temporary variables. In David's scheme > > I think this would be: > Historical coding style

Re: Instructions vs Expressions in the backend (was Re: RFA: Rework FOR_BB_INSNS iterators)

2014-06-27 Thread David Malcolm
On Wed, 2014-06-25 at 10:36 +0100, Richard Sandiford wrote: > Oleg Endo writes: > > Personally, I'd like to see usage of standard STL-like iterator usage. > > I've proposed something for edge_iterator a while ago, but people don't > > seem very fond of it. See also > > https://gcc.gnu.org/ml/gcc-

[PATCH, committed] Unbreak the JIT after conversion of md_asm_adjust to use vec<>

2015-05-12 Thread David Malcolm
The patch: https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00600.html broke the build of the jit: In file included from ../../src/gcc/jit/jit-builtins.c:23:0: ../../src/gcc/target.h:188:60: error: expected ‘;’ at end of member declaration #define DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT) TYPE (* NA

Re: [PATCH 1/3] Implement -Wmisleading-indentation (v4)

2015-05-12 Thread David Malcolm
On Mon, 2015-05-11 at 15:23 -0600, Jeff Law wrote: > On 04/28/2015 06:02 PM, David Malcolm wrote: > > This is an updated implementation of the proposed > > -Wmisleading-indentation warning. > > > > Changes since last patch: > > > > * I've rewritten it

Re: [PATCH 1/3] Implement -Wmisleading-indentation (v4)

2015-05-12 Thread David Malcolm
On Tue, 2015-05-12 at 17:21 -0400, David Malcolm wrote: [...] > Thanks; I've removed the new warning from -Wall, making the appropriate > trivial doc changes, and committed it to trunk (r223098; attached). ...having bootstrapped®rtested it on x86_64-unknown-linux-gnu (Fedora 20).

Re: [PATCH 3/4] libcpp/input.c: Add a way to visualize the linemaps

2015-05-13 Thread David Malcolm
On Mon, 2015-05-04 at 13:19 -0600, Jeff Law wrote: > On 05/01/2015 06:56 PM, David Malcolm wrote: > > As a relative newcomer to GCC, one of the issues I had was > > becoming comfortable with the linemap API and its internal > > representation. > > > > To fami

[PATCH] Avoid unnecessary work when -Wmisleading-indentation isn't enabled

2015-05-13 Thread David Malcolm
This might qualify as "obvious". OK for trunk? (if it passes bootstrap and regrtest) gcc/c-family/ChangeLog: * c-indentation.c (warn_for_misleading_indentation): Bail out immediately if -Wmisleading-indentation isn't enabled. --- gcc/c-family/c-indentation.c | 6 ++ 1 file c

[PATCH] Introduce TV_INITIALIZE_RTL

2015-05-14 Thread David Malcolm
Before this patch, jit.dg/test-benchmark.c at optlevel 0, 100 iterations showed "rest of compilation" as taking a significant chunk of time: rest of compilation : 1.53 (64%) usr 0.06 (32%) sys 1.60 (27%) wall 1388 kB ( 6%) ggc This turned out to be almost entirely spent inside initi

[PATCH] Fix two leaks in postreload-gcse.c

2015-05-14 Thread David Malcolm
Running jit.dg/test-sum-of-squares.c under valgrind showed a couple of leaks: 608 bytes in 4 blocks are definitely lost in loss record 184 of 229 at 0x4A081D4: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x5BC88B0: xcalloc (xmalloc.c:162) by 0x524F72D: alloc_mem(

[PATCH] -Wmisleading-indentation: Increase test coverage

2015-05-20 Thread David Malcolm
Add various new tests to Wmisleading-indentation.c: * Ensure that users can use pragma to turn off -Wmisleading-indentation for a range of code. * Add functions demonstrating a variety of indentation styles seen: (a) on http://en.wikipedia.org/wiki/Indent_style (b) via t

[PATCH] PR c/66220: Fix false positive from -Wmisleading-indentation

2015-05-20 Thread David Malcolm
This patch fixes the false positive seen from -Wmisleading-indentation on this code: if (v == 2) { res = 27; } else { res = 18; } return res; ^ FALSE POSITIVE HERE along with similar code seen when I tested it with linux-4.0.3. The patch adds a reject

Statically-allocated objects with non-trivial ctors (was Re: [PATCH 33/35] Change use to type-based pool allocator in ira-color.c.)

2015-05-28 Thread David Malcolm
On Wed, 2015-05-27 at 15:56 +0200, mliska wrote: > gcc/ChangeLog: > > 2015-04-30 Martin Liska > > * ira-color.c (init_update_cost_records): Use new type-based pool > allocator. > (get_update_cost_record): Likewise. > (free_update_cost_record_list): Likewise. > (finish_

[PATCH 00/16] RFC: Embedding as and ld inside gcc driver and into libgccjit

2015-06-01 Thread David Malcolm
[Crossposting to both gcc-patches and binutils lists, since this patch kit touches both source trees]. Binutils devs: GCC 5 gained a way to build GCC as a shared library, libgccjit.so. I'm been experimenting with ways of optimizing libgccjit, and the following patch kit (touching both gcc and bin

[PATCH 05/16] gcc: driver: add g_driver singleton

2015-06-01 Thread David Malcolm
gcc/ChangeLog: * gcc.c (g_driver): New. (driver::driver): Set "g_driver". (driver::~driver): Unset "g_driver". --- gcc/gcc.c | 9 + 1 file changed, 9 insertions(+) diff --git a/gcc/gcc.c b/gcc/gcc.c index 7314317..46e750d 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -

[PATCH 09/16] libiberty.h: Provide CTIMER_PUSH/POP

2015-06-01 Thread David Malcolm
gcc provides a timing mechanism, with a C++-based API. This patch provide a C-based API so that we can call into it from binutils. include/ChangeLog: * libiberty.h (struct ctimer): New. (CTIMER_PUSH): New macro. (CTIMER_POP): New macro. --- include/libiberty.h | 32 ++

[PATCH 04/16] gcc: Don't keep reinitializing RTL

2015-06-01 Thread David Malcolm
This may be something of a hack; it appears to work for x86_64. Before: initialize rtl : 1.50 (63%) usr 0.02 (10%) sys 1.34 (23%) wall 1156 kB ( 5%) ggc rest of compilation : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.03 ( 1%) wall 232 kB ( 1%) ggc TOTAL :

[PATCH 06/16] gcc: driver: add timevars for as, collect2, ld

2015-06-01 Thread David Malcolm
gcc/ChangeLog: * gcc.c (execute): Identify certain commands, and account their time to specific timevars. * gcc.h (driver::get_timer): New accessor. * timevar.def (TV_DRIVER_EXECUTE_AS): New. (TV_DRIVER_EXECUTE_COLLECT2): New. (TV_DRIVER_EXECUTE_LD):

[PATCH 03/16] gcc: Use timevars within driver

2015-06-01 Thread David Malcolm
This patch allows a "timer" instance to be passed to the driver and adds some timevars for activities within the driver. This is for use by libgccjit when embedding the driver, though in theory we could use this to time the driver as a whole. gcc/ChangeLog: * Makefile.in (GCC_OBJS): Add t

[PATCH 01/16] gcc: Generalization of timevar API; add gcc_jit_timer interface

2015-06-01 Thread David Malcolm
e.rst diff --git a/gcc/jit/docs/topics/performance.rst b/gcc/jit/docs/topics/performance.rst new file mode 100644 index 000..b7de28e --- /dev/null +++ b/gcc/jit/docs/topics/performance.rst @@ -0,0 +1,208 @@ +.. Copyright (C) 2015 Free Software Foundation, Inc. + Originally contributed

[PATCH 02/16] gcc: Embed the driver in-process within libgccjit

2015-06-01 Thread David Malcolm
Provide a way to clean up state within the driver code, and use this from libgccjit to embed it in-process, rather that via pex. Part of this requires restoring the environment after any putenv calls, so the patch introduces an env_manager class. No effort is made to restore the environment for t

[PATCH 07/16] binutils: bfd: Implement bfd_uninit

2015-06-01 Thread David Malcolm
This patch adds a new API entrypoint to libbfd: bfd_uninit, which resets global state within the library. The patch (and subsequent ones) follow a pattern I used in gcc for cleaning up global state: for each source file e.g. foo.c to have a function: extern void foo_c_finalize (void); to explici

[PATCH 08/16] libiberty.h: Provide a CLEAR_VAR macro

2015-06-01 Thread David Malcolm
include/ChangeLog: * libiberty.h (CLEAR_VAR): New macro. --- include/libiberty.h | 4 1 file changed, 4 insertions(+) diff --git a/include/libiberty.h b/include/libiberty.h index b33dd65..93e4131 100644 --- a/include/libiberty.h +++ b/include/libiberty.h @@ -699,6 +699,10 @@ extern v

[PATCH 16/16] gcc: Hack up the arguments to the linker

2015-06-01 Thread David Malcolm
This is a nasty hack, but I noticed a lot of time spent executing the linker within jit.dg/test-benchmark, with link lines like: run_embedded_ld: 24 args argv[0]: ld argv[1]: --eh-frame-hdr argv[2]: -m argv[3]: elf_x86_64 argv[4]: -shared argv[5]: -o argv[6]: /tmp/lib

[PATCH 13/16] ld/Makefile.am: Introduce a libld.la

2015-06-01 Thread David Malcolm
Similarly to "libgas.la" before , this introduces a libld.la, moving everything from "ld" into it, with ld built from ldmainmain.c. As before with the libgas.la patch, this patch isn't ready yet, but seems to be good enough for prototyping the libgccjit.so integration. --- ld/Makefile.am | 64 +++

[PATCH 10/16] binutils: Introduce "gas_main", and state-purging with "gas" subdir

2015-06-01 Thread David Malcolm
Currently this has only been tested on x86_64, and hardcodes this cleanup: extern void config_obj_elf_c_finalize (void); extern void config_tc_i386_c_finalize (void); Clearly this would need generalizing. gas/ChangeLog: * app.c (app_c_finalize): New function. * as.c: Include ne

[PATCH 15/16] gcc: Use libgas and libld within the driver

2015-06-01 Thread David Malcolm
This patch adds the ability for gcc to be configured with: --with-embedded-as --with-embedded-ld If so, invocations of "as" and "ld" are detected in the gcc driver, and specialcased by invoking these in-process as shared libraries. This is intended for use by libgccjit, when the driver itself

[PATCH 11/16] binutils: gas/Makefile.am: Add libgas.la

2015-06-01 Thread David Malcolm
This patch introduces a libgas.la, using it for the "as" executable. I'm not convinced I've got this correct, but it seems to work well enough to prototype the embedding within libgccjit.so. --- gas/Makefile.am | 26 +- 1 file changed, 17 insertions(+), 9 deletions(-) dif

[PATCH 12/16] binutils: Introduce "ld_main" and state-purging within "ld" subdir

2015-06-01 Thread David Malcolm
As before in "gas", introduce code to ld to restore state. I've only tested this on x86_64, and there are some hacks in here that hardcode that, but hopefully this is enough to show the idea. --- ld/emultempl/elf32.em | 77 + ld/ld.h | 8

[PATCH 14/16] gcc: Add CTIMER_PUSH/POP to gcc's copy of libiberty

2015-06-01 Thread David Malcolm
include/ChangeLog: * libiberty.h (struct ctimer): New. (CTIMER_PUSH): New. (CTIMER_POP): New. --- include/libiberty.h | 32 1 file changed, 32 insertions(+) diff --git a/include/libiberty.h b/include/libiberty.h index b33dd65..a2c73ae 10064

Re: [PATCH 08/16] libiberty.h: Provide a CLEAR_VAR macro

2015-06-01 Thread David Malcolm
On Mon, 2015-06-01 at 17:47 -0400, DJ Delorie wrote: > > +/* Fill an lvalue with zero bits. */ > > +#define CLEAR_VAR(S) \ > > + do { memset (&(S), 0, sizeof (S)); } while (0) > > Hmmm... I don't see the point in this. The macro is almost as long as > a bare memset() would be, and replaces a we

[debug-early, jit] Port of jit to debug-early

2015-06-05 Thread David Malcolm
"jit" isn't part of "all" languages, and currently fails to build on the aldyh/debug-early branch: ../../src/gcc/jit/jit-playback.c: In member function ‘void gcc::jit::playback::context::write_global_decls_2()’: ../../src/gcc/jit/jit-playback.c:710:20: error: ‘const struct gcc_debug_hooks’ has n

Re: [debug-early, jit] Port of jit to debug-early

2015-06-05 Thread David Malcolm
On Fri, 2015-06-05 at 15:37 -0400, Aldy Hernandez wrote: > On 06/05/2015 03:00 PM, David Malcolm wrote: > > "jit" isn't part of "all" languages, and currently fails to build on > > the aldyh/debug-early branch: > > The debug-early work is now in m

Re: [debug-early, jit] Port of jit to debug-early

2015-06-05 Thread David Malcolm
On Fri, 2015-06-05 at 16:18 -0400, David Malcolm wrote: > On Fri, 2015-06-05 at 15:37 -0400, Aldy Hernandez wrote: > > On 06/05/2015 03:00 PM, David Malcolm wrote: > > > "jit" isn't part of "all" languages, and currently fails to build on > > &

[RFC stage 1] Proposed new warning: -Wmisleading-indentation

2015-04-16 Thread David Malcolm
/gcc/testsuite/c-c++-common/Wmisleading-indentation-8.c @@ -0,0 +1,6 @@ +/* { dg-options "-Wmisleading-indentation" } */ +int foo (int a, int b, int c) +{ + /* This should *not* be flagged as misleading indentation. */ + if (a) return b; else return c; +} diff --git a/gcc/testsuite/c-c++-co

Re: [PATCH, stage1] Better error recovery for merge-conflict markers

2015-04-17 Thread David Malcolm
On Fri, 2015-03-20 at 17:50 +, Joseph Myers wrote: > On Fri, 20 Mar 2015, David Malcolm wrote: > > > I believe that the presense of these markers in source code is almost > > always a bug (are there any GCC frontends in which the markers are > > parsable as som

Re: [RFC stage 1] Proposed new warning: -Wmisleading-indentation

2015-04-21 Thread David Malcolm
On Thu, 2015-04-16 at 10:26 -0700, Mike Stump wrote: > On Apr 16, 2015, at 8:01 AM, David Malcolm wrote: > > Attached is a work-in-progress patch for a new > > -Wmisleading-indentation > > warning I've been experimenting with, for GCC 6. > > Seems like a nice id

Re: Re: [RFC stage 1] Proposed new warning: -Wmisleading-indentation

2015-04-21 Thread David Malcolm
On Tue, 2015-04-21 at 20:14 +0200, Manuel López-Ibáñez wrote: > On 21/04/15 18:07, David Malcolm wrote: > > > > I have the patch working now for the C++ frontend. Am attaching the > > work-in-progress (sans ChangeLog). This one (v2) bootstrapped and > > regrtested

Re: [PATCH 00/12] Reduce conditional compilation

2015-04-22 Thread David Malcolm
On Tue, 2015-04-21 at 11:29 -0400, Trevor Saunders wrote: > On Tue, Apr 21, 2015 at 07:57:19AM -0600, Jeff Law wrote: > > On 04/21/2015 07:24 AM, tbsaunde+...@tbsaunde.org wrote: > > >From: Trevor Saunders > > > > > >Hi, > > > > > >This is a first round of patches to reduce the amount of code with

[PATCH 1/3] Implement -Wmisleading-indentation (v4)

2015-04-28 Thread David Malcolm
This is an updated implementation of the proposed -Wmisleading-indentation warning. Changes since last patch: * I've rewritten it to use Manuel's approach from https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01225.html I took Manuel's proposed patch for the C frontend and generalized it to

[PATCH 2/3] Fix spurious semicolons

2015-04-28 Thread David Malcolm
An earlier version of the -Wmisleading-indentation patch issued warnings for spurious trailing semicolons guarded by a conditional. Although the latest version of -Wmisleading-indentation no longer warns about these, I fixed the ones that were reported, thusly. gcc/ChangeLog: * builtins.c

[PATCH 3/3] Fix indentation issues seen by -Wmisleading-indentation

2015-04-28 Thread David Malcolm
This patch fixes the places in our tree where -Wmisleading-indentation correctly identifies code that's misleadingly indented. In particular, a couple of places in gcc/cp/parser.c:cp_parser_asm_definition appeared to be missing braces, both of the form: if (complicated_multiline_condition ())

[PATCH 1/4] libcpp: Improvements to comments in line-map.h/c

2015-05-01 Thread David Malcolm
This patch updates and expands some comments in libcpp, adding a big table to try to clarify what an individual source_location value can mean. libcpp/ChangeLog: * include/line-map.h: Fix comment at the top of the file. (source_location): Rewrite and expand the comment for this

[PATCH 0/4] libcpp patches

2015-05-01 Thread David Malcolm
look? (for trunk) I've successfully bootstrapped®rtested the cumulative effect of the patches on x86_64-unknown-linux-gnu (Fedora 20). I would verify the bootstrap®rtest of each patch before applying them. I didn't do any performance testing; what would be appropriate? David Malcolm (4)

[PATCH 3/4] libcpp/input.c: Add a way to visualize the linemaps

2015-05-01 Thread David Malcolm
As a relative newcomer to GCC, one of the issues I had was becoming comfortable with the linemap API and its internal representation. To familiarize myself with it, I wrote a dumping routine to try to visualize how the source_location space is carved up between line maps, and what each number can

[PATCH 2/4] libcpp: Replace macro usage with C++ constructs

2015-05-01 Thread David Malcolm
libcpp makes extensive use of the C preprocessor. Whilst this has a pleasingly self-referential quality, I find the code hard-to-read; implementing source location support in my JIT branch was much harder than I felt it should have been. In an attempt at making the code easier to follow, and to b

[PATCH 4/4] Replace line_map union with C++ class hierarchy

2015-05-01 Thread David Malcolm
This patch eliminates the union in struct line_map in favor of a simple class hierarchy, making struct line_map a base class, with line_map_ordinary and line_map_macro subclasses. The patch eliminates all usage of linemap_check_ordinary and linemap_check_macro from line-map.h, updating return type

[PATCH 2/4 v2] libcpp: Replace macro usage with C++ constructs)

2015-05-05 Thread David Malcolm
On Mon, 2015-05-04 at 13:15 -0600, Jeff Law wrote: On 05/01/2015 06:56 PM, David Malcolm wrote: > > libcpp makes extensive use of the C preprocessor. Whilst this has a > > pleasingly self-referential quality, I find the code hard-to-read; > > implementing source location suppor

[PATCH 2/4 v2: part 1] Move linemap_assert higher up within the file

2015-05-05 Thread David Malcolm
--- libcpp/include/line-map.h | 71 --- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h index e1681ea..7001552 100644 --- a/libcpp/include/line-map.h +++ b/libcpp/include/line-map.h @@

[PATCH 2/4 v2: part 2] libcpp: Replace macro usage with C++ constructs

2015-05-05 Thread David Malcolm
libcpp/ChangeLog: * include/line-map.h (MAX_SOURCE_LOCATION): Convert from a macro to a const source_location. (RESERVED_LOCATION_COUNT): Likewise. (linemap_check_ordinary): Convert from a macro to a pair of inline functions, for const/non-const arguments.

[PATCH 5/4] libcpp: Eliminate most of the non-const/reference-returning inline fns

2015-05-05 Thread David Malcolm
gcc/java/ChangeLog: * jcf-parse.c (set_source_filename): Replace write through ORDINARY_MAP_FILE_NAME with direct access to "to_file". libcpp/ChangeLog: * include/line-map.h (MAP_START_LOCATION): Eliminate the non-const variant, and tweak comment for the const varia

Re: [PATCH 3/3] Fix indentation issues seen by -Wmisleading-indentation

2015-05-05 Thread David Malcolm
On Wed, 2015-04-29 at 14:10 +0200, Mikael Morin wrote: > Hello, > > Le 29/04/2015 02:02, David Malcolm a écrit : > > diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c > > index 2c7c554..30e4eab 100644 > > --- a/gcc/fortran/parse.c > > +++ b/gcc/fortr

[PATCH, committed] jit: add test-benchmark.c

2015-05-06 Thread David Malcolm
Add a simple benchmark to the jit testsuite: measuring the wallclock time of: * building a simple function (sum of squares from 0..n-1) * compiling it in-memory * running it (with n=100) doing this combined test 100 times, at each optimization level. On this machine I get this output: PASSED

Re: [patch 0/10] debug-early merge

2015-05-08 Thread David Malcolm
On Thu, 2015-05-07 at 17:30 -0700, Aldy Hernandez wrote: > Hi folks. > > I have divided the patches into 10 pieces. The patches are > interdependent and cannot be applied independently. I am merely > dividing them up to aid the relevant reviewers. > > As I've mentioned elsewhere, the patchset

[PATCH] Move global state in timevar.c to a new "timer" class

2015-05-08 Thread David Malcolm
I want to make the timevar infrastructure be more flexible, to better serve some JIT use-cases. The following is a "removal of global state" patch which gathers together the state within timevar.c into a new "timer" class. Within the classic cc1/cc1plus/etc use-case, this timer class is a singlet

Re: [PATCH] Add a way to mark regions of code which assume that the GC won't run

2014-11-13 Thread David Malcolm
On Thu, 2014-11-13 at 11:22 +0100, Richard Biener wrote: > On Wed, Nov 12, 2014 at 11:04 PM, David Malcolm wrote: > > On Wed, 2014-11-12 at 13:16 -0500, David Malcolm wrote: > >> We make assumptions in the codebase about when the GC can run, and when > >> it can

[PATCH] Add gimple-compat.h (was Re: [gimple-classes, committed 4/6] tree-ssa-tail-merge.c: Use gassign)

2014-11-14 Thread David Malcolm
On Thu, 2014-11-13 at 11:45 +0100, Richard Biener wrote: > On Thu, Nov 13, 2014 at 2:41 AM, David Malcolm wrote: > > On Tue, 2014-11-11 at 11:43 +0100, Richard Biener wrote: > >> On Tue, Nov 11, 2014 at 8:26 AM, Jakub Jelinek wrote: > >> > On Mon, Nov 10, 2014 at 0

Re: [gimple-classes, committed 4/6] tree-ssa-tail-merge.c: Use gassign

2014-11-15 Thread David Malcolm
On Thu, 2014-11-13 at 11:45 +0100, Richard Biener wrote: > On Thu, Nov 13, 2014 at 2:41 AM, David Malcolm wrote: > > On Tue, 2014-11-11 at 11:43 +0100, Richard Biener wrote: > >> On Tue, Nov 11, 2014 at 8:26 AM, Jakub Jelinek wrote: > >> > On Mon, Nov 10, 2014 at 0

Re: [gimple-classes, committed 4/6] tree-ssa-tail-merge.c: Use gassign

2014-11-17 Thread David Malcolm
On Mon, 2014-11-17 at 11:06 +0100, Richard Biener wrote: > On Sat, Nov 15, 2014 at 12:00 PM, David Malcolm wrote: > > On Thu, 2014-11-13 at 11:45 +0100, Richard Biener wrote: > >> On Thu, Nov 13, 2014 at 2:41 AM, David Malcolm wrote: > >> > On Tue, 2014-11-11 at 11:

Re: [gimple-classes, committed 4/6] tree-ssa-tail-merge.c: Use gassign

2014-11-18 Thread David Malcolm
On Tue, 2014-11-18 at 10:53 +0100, Richard Biener wrote: > On Tue, Nov 18, 2014 at 2:59 AM, David Malcolm wrote: > > On Mon, 2014-11-17 at 11:06 +0100, Richard Biener wrote: > >> On Sat, Nov 15, 2014 at 12:00 PM, David Malcolm > >> wrote: > >> > On Thu, 20

[PATCH 01/21] PR jit/63854: Fix memory leak within gcc_options

2014-11-19 Thread David Malcolm
Valgrind shows this fixes ~1 KB of leak per iteration (on x86_64) by plugging these leaks allocated at opts.c lines 286 and 289: ==57820== 2,752 bytes in 4 blocks are definitely lost in loss record 875 of 917 ==57820==at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux

[PATCH 02/21] PR jit/63854: Fix memory leak of reginfo.c: valid_mode_changes_obstack

2014-11-19 Thread David Malcolm
Valgrind shows this fixes ~4 KB of leak per iteration (on x86_64) by plugging this leak allocated at reginfo.c:1327: gcc_obstack_init (&valid_mode_changes_obstack); ==57820== 16,256 bytes in 4 blocks are definitely lost in loss record 906 of 917 ==57820==at 0x4A0645D: malloc (in /usr/lib64/

[PATCH 06/21] PR jit/63854: Fix leak of opts_obstack

2014-11-19 Thread David Malcolm
This was leaking about 4KB per iteration: 16,256 bytes in 4 blocks are definitely lost in loss record 233 of 239 at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x5D75C17: xmalloc (xmalloc.c:147) by 0x30958842DB: _obstack_begin (obstack.c:184) by 0x5

[PATCH 03/21] PR jit/63854: Fix memory leaks within context/pass_manager/dump_manager

2014-11-19 Thread David Malcolm
We weren't cleaning up the context, pass_manager or dump_manager. An earlier version of the context and pass_manager classes had them allocated in the GC-heap, but they were moved to the system heap before that patch was committed; they were never cleaned up, so e.g. all passes leak on each in-pro

[PATCH 00/21] PR 63854: Fix various memory leaks

2014-11-19 Thread David Malcolm
such testing?). Successfully bootstrapped®rtested the cumulative effect of the patches on x86_64-unknown-linux-gnu (Fedora 20). Are the non-JIT parts OK for trunk? (Presumably I can give myself approval for the JIT parts) David Malcolm (21): PR jit/63854: Fix memory leak within gcc_options P

[PATCH 10/21] PR jit/63854: Fix leak of worklist within jit-recording.c

2014-11-19 Thread David Malcolm
Fix this leak: 160 bytes in 5 blocks are definitely lost in loss record 154 of 228 at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x5D75D4F: xrealloc (xmalloc.c:177) by 0x4DE1710: void va_heap::reserve(vec*&, unsigned int, bool) (vec.h:310) by 0x4D

[PATCH 08/21] PR jit/63854: Add ira_costs_c_finalize

2014-11-19 Thread David Malcolm
this_target_ira_int->free_ira_costs () is called by ira_init_costs, but this isn't called after the compile, causing noise when running under valgrind. This patch adds a ira_costs_c_finalize function to clean this up, and calls it from toplev::finalize (and hence this isn't called by cc1/cc1plus/e

[PATCH 07/21] PR jit/63854: Fix leak of optimization_summary_obstack

2014-11-19 Thread David Malcolm
This was leaking ~4KB per iteration: 16,256 bytes in 4 blocks are definitely lost in loss record 234 of 239 at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x5D75C17: xmalloc (xmalloc.c:147) by 0x30958842DB: _obstack_begin (obstack.c:184) by 0x4DFECD

[PATCH 11/21] PR jit/63854: Fix leak of "avail" within tree-ssa-pre.c

2014-11-19 Thread David Malcolm
Fix this leak: 120 bytes in 5 blocks are definitely lost in loss record 141 of 227 at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x5D75D8F: xrealloc (xmalloc.c:177) by 0x550DEBA: void va_heap::reserve(vec*&, unsigned int, bool) (vec.h:310) by 0x550

[PATCH 12/21] PR jit/63854: Add a valgrind suppresion file

2014-11-19 Thread David Malcolm
Valgrind complains about uninitialized data within sparseset_bit_p. Provide a suppression file to silence these warnings. Valgrind requires suppression files for C++ code to use the mangled names, so we do that here. contrib/ChangeLog: PR jit/63854 * valgrind.supp: New. --- contr

[PATCH 13/21] PR jit/63854: Add support for running "make check-jit" under valgrind

2014-11-19 Thread David Malcolm
This commit updates jit.exp so that if RUN_UNDER_VALGRIND is present in the environment, all of the built client code using libgccjit.so is run under valgrind, with --leak-check=full. Hence: RUN_UNDER_VALGRIND= make check-jit will run all jit testcases under valgrind (taking 27 mins on my machin

[PATCH 15/21] PR jit/63854: lra.c: Fix leak of point_freq_vec's buffer when calling lra_inheritance

2014-11-19 Thread David Malcolm
Valgrind showed a leak of 1640 bytes per iteration of one of the jit testcases (I think this is per-function in a compile): 8,200 bytes in 5 blocks are definitely lost in loss record 214 of 223 at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x5D75D1F: xre

[PATCH 04/21] PR jit/63854: Fix memory leak within bb-reorder.c

2014-11-19 Thread David Malcolm
Valgrind showed this leaking 200 bytes per iteration in one of my testcases: 1,000 bytes in 5 blocks are definitely lost in loss record 200 of 241 at 0x4A083AA: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x5D75C5C: xrealloc (xmalloc.c:179) by 0x4E10734: void va

[PATCH 17/21] PR jit/63854: Fix leaking vec in jit

2014-11-19 Thread David Malcolm
This fixes various leaks of vec buffers seen via valgrind within jit (both recording and playback). Various vec<> within jit::recording are converted to auto_vec<>. Various playback::wrapper subclasses containing vec<> gain a finalizer so they can release the vec when they are collected. gcc/jit

[PATCH 16/21] PR jit/63854: Add all_late_ipa_passes to GCC_PASS_LISTS

2014-11-19 Thread David Malcolm
Valgrind showed a per-iteration leak of pass_ipa_pta (and presumably pass_omp_simd_clone): 704 (352 direct, 352 indirect) bytes in 4 blocks are definitely lost in loss record 198 of 241 at 0x4A06965: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by

[PATCH 20/21] PR jit/63854: Fix leak in ipa-icf.c

2014-11-19 Thread David Malcolm
ipa-icf.c was leaking 16 bytes per iteration in the jit testcases here: 80 bytes in 5 blocks are definitely lost in loss record 94 of 199 at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x5D764B7: xmalloc (xmalloc.c:147) by 0x5C962FF: ipa_icf::sem_item_

[PATCH 19/21] PR jit/63854: Fix leak of ipa hooks

2014-11-19 Thread David Malcolm
This fixes three leaks in IPA seen in jit testcases with valgrind: This one: 96 bytes in 4 blocks are definitely lost in loss record 102 of 205 at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x5D76447: xmalloc (xmalloc.c:147) by 0x4E35C23: symbol_table

[PATCH 09/21] PR jit/63854: Don't leak producer_string in dwarf2out.c

2014-11-19 Thread David Malcolm
Fix this small per-iteration leak with debuginfo: 424 bytes in 4 blocks are definitely lost in loss record 185 of 230 at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x5D75CA7: xmalloc (xmalloc.c:147) by 0x4ECE9E4: gen_producer_string() (dwarf2out.c:194

[PATCH 05/21] PR jit/63854: Fix memory leak of save_decoded_options

2014-11-19 Thread David Malcolm
This commit fixes this leak from opts-common.c, about 4KB per iteration. ==57820== 18,816 (2,560 direct, 16,256 indirect) bytes in 4 blocks are definitely lost in loss record 907 of 917 ==57820==at 0x4A083AA: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==57820==by

[PATCH 18/21] PR jit/63854: Add "long-term" allocator to gcc::context

2014-11-19 Thread David Malcolm
Some places in the startup code use char * values that can sometimes be string literals, and can sometimes be dynamically built using xstrdup or concat. This isn't a problem for cc1 etc since this is only called once, but for libgccjit they are small per-invocation leaks. There's no clean way to

[PATCH 14/21] PR jit/63854: Fix leak of paths within jump threading

2014-11-19 Thread David Malcolm
Paths are allocated as: vec *path = new vec (); i.e. the vec itself is on the heap, so a mere: path->release (); is merely releasing the buffer the vec holds, not the vec itself. This patch updates the two sites that release paths to also delete them, fixing leaks like this seen by valgri

[PATCH 21/21] PR jit/63854: Fix leaks in test-fuzzer.c

2014-11-19 Thread David Malcolm
gcc/testsuite/ChangeLog: PR jit/63854 * jit.dg/test-fuzzer.c (fuzzer_init): Free malloced buffers. (make_random_function): Free ff->locals. --- gcc/testsuite/jit.dg/test-fuzzer.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/gcc/testsuite/jit.dg/test-fuzzer.c b

Re: [PATCH 13/21] PR jit/63854: Add support for running "make check-jit" under valgrind

2014-11-19 Thread David Malcolm
On Wed, 2014-11-19 at 09:57 -0700, Jeff Law wrote: > On 11/19/14 03:46, David Malcolm wrote: > > This commit updates jit.exp so that if RUN_UNDER_VALGRIND is present > > in the environment, all of the built client code using libgccjit.so is > > run under valgrind, w

Re: [PATCH 12/21] PR jit/63854: Add a valgrind suppresion file

2014-11-19 Thread David Malcolm
On Wed, 2014-11-19 at 10:09 -0700, Jeff Law wrote: > On 11/19/14 04:47, Richard Biener wrote: > > On Wed, Nov 19, 2014 at 11:46 AM, David Malcolm wrote: > >> Valgrind complains about uninitialized data within sparseset_bit_p. > >> Provide a suppression fil

"gimple-classes-v2-option-3" git branch committed to svn trunk as r217787

2014-11-19 Thread David Malcolm
I've committed the cut-down version of the gimple statement subclasses work to svn trunk [specifically the gimple-classes-v2-option-3 git branch, having bootstrapped®rested it on x86_64-unknown-linux-gnu (Fedora 20)]. This is the the 89-patch kit from https://gcc.gnu.org/ml/gcc-patches/2014-04/

<    15   16   17   18   19   20   21   22   23   24   >