[PATCH] Convert CoreInputGraph.

Rui Ueyama ruiu at google.com
Sun Dec 14 21:13:14 PST 2014


Hi Bigcheese, kledzik, atanasyan, shankarke, Jean-Daniel,

This is a part of InputGraph cleanup to represent input files as a flat list of Files (and some meta-nodes for group etc.)

We cannot achieve that goal in one gigantic patch (well, I could, but no one wants to review such patch), so I split the task into small steps as shown below.

(But before that, recap the progress I've made so far: Currently InputGraph contains a list of InputElements. Each InputElement contain one File (that used to have multiple Files, but I eliminated that use case in r223867). Files are currently instantiated in Driver::link(), but I already made a change to separate file parsing from object instantiation (r224102), so we can safely instantiate Files when we need them, instead of instantiating them through the wrapper class (FileNode subclasses). InputGraph used to have a logic to act like a generator by interpreting groups itself, but it's now just a container of a list of InputElements (r223867). The logic has moved to the resolver.)

1. Instantiate Files in the driver and wrap them with WrapperNode. WrapperNode is a temporary class that allows us to instantiate Files in the driver while keep using the current InputGraph data structure.

This patch demonstrates how this step 1 looks like, using Core driver as an example.

2. Do the same thing for the other drivers.

When step 2 is done, an InputGraph consists of GroupEnd objects or WrapperNodes each of which contains one File. Other types of FileNode subclasses are gone.

3. Replace InputGraph with a list of InputElements. InputGraph is already just a container of InputElement list, so this step retires the wrapper.

4. Replace WrapperNode with File to remove the temporary scaffolding.

We need some code cleanup between each step, because many classes do a bit odd things (e.g. InputGraph::getGroupSize()). I'll straight things up as I need to.

After step 4, we can clean things up by removing code that was written to work-around InputGraph limitation (e.g. LinkingContext::maybeSortInputFile). But that's a future plan atm.

So, that's a plan. Please review!

http://reviews.llvm.org/D6653

Files:
  include/lld/Core/File.h
  include/lld/Core/InputGraph.h
  include/lld/Driver/CoreInputGraph.h
  include/lld/Driver/Driver.h
  include/lld/Driver/WrapperInputGraph.h
  lib/Core/InputGraph.cpp
  lib/Driver/CoreDriver.cpp
  lib/Driver/Driver.cpp
  test/core/empty.objtxt

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6653.17265.patch
Type: text/x-patch
Size: 9964 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141215/39daf271/attachment.bin>


More information about the llvm-commits mailing list