summaryrefslogtreecommitdiffstats
path: root/lld/unittests/DriverTests/InputGraphTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Re-commit r225766, r225767, r225769, r225814, r225816, r225829, and r225832.Rui Ueyama2015-01-151-122/+0
| | | | | | | These changes depended on r225674 and had been rolled back in r225859. Because r225674 has been re-submitted, it's safe to re-submit them. llvm-svn: 226132
* Revert "Convert other drivers to use WrapperNode" and subsequent commits.Rui Ueyama2015-01-141-0/+122
| | | | | | | r225764 broke a basic functionality on Mac OS. This change reverts r225764, r225766, r225767, r225769, r225814, r225816, r225829, and r225832. llvm-svn: 225859
* Remove InputGraph::getNextFile().Rui Ueyama2015-01-131-83/+0
| | | | | | | | | | | | getNextFile used to have a complex logic to determine which file should be processed by the Resolver on next iteration. Now, it is just a sequential accessor to the internal array and provides no sensible feature. This patch also removes InputGraph::getGroupSize and InputGraph:: skipGroup to simplify the code. llvm-svn: 225832
* Remove dead code.Rui Ueyama2015-01-131-24/+0
| | | | | | | Now every InputElement has exactly one File in it, so "expand" method is now no-op. llvm-svn: 225769
* Remove InputGraph::registerObserver.Rui Ueyama2015-01-131-15/+0
| | | | | | | | | | | | PECOFF was the only user of the API, and the reason why we created the API is because, although the driver creates a list of input files, it has no knowledge on what files are being created. It was because everything was hidden behind the InputGraph abstraction. Now the driver knows what that's doing. We no longer need this indirection to get the file list being processed. llvm-svn: 225767
* Simplify InputGraph API.Rui Ueyama2014-12-141-5/+5
| | | | | | | | | These member functions returns either no_more_files error or a File object. We could simply return a nullptr instead of a no_more_files. This function will be removed soon as a part of InputGraph cleanup. I had to do that step by step. llvm-svn: 224208
* Remove dead code.Rui Ueyama2014-12-141-8/+2
| | | | llvm-svn: 224207
* Re-commit r223330: Rewrite InputGraph's GroupRui Ueyama2014-12-101-86/+7
| | | | llvm-svn: 223867
* Revert "Rewrite InputGraph's Group"Rui Ueyama2014-12-041-7/+86
| | | | | | | | This reverts commit r223330 because it broke Darwin and ELF linkers in a way that we couldn't have caught with the existing test cases. llvm-svn: 223373
* Rewrite InputGraph's GroupRui Ueyama2014-12-041-86/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The aim of this patch is to reduce the excessive abstraction from the InputGraph. We found that even a simple thing, such as sorting input files (Mach-O) or adding a new file to the input file list (PE/COFF), is nearly impossible with the InputGraph abstraction, because it hides too much information behind it. As a result, we invented complex interactions between components (e.g. notifyProgress() mechanism) and tricky code to work around that limitation. There were many occasions that we needed to write awkward code. This patch is a first step to make it cleaner. As a first step, this removes Group class from the InputGraph. The grouping feature is now directly handled by the Resolver. notifyProgress is removed since we no longer need that. I could have cleaned it up even more, but in order to keep the patch minimum, I focused on Group. SimpleFileNode class, a container of File objects, is now limited to have only one File. We shold have done this earlier. We used to allow putting multiple File objects to FileNode. Although SimpleFileNode usually has only one file, the Driver class actually used that capability. I modified the Driver class a bit, so that one FileNode is created for each input File. We should now probably remove SimpleFileNode and directly store File objects to the InputGraph in some way, because a container that can contain only one object is useless. This is a TODO. Mach-O input files are now sorted before they are passe to the Resolver. DarwinInputGraph class is no longer needed, so removed. PECOFF still has hacky code to add a new file to the input file list. This will be cleaned up in another patch. llvm-svn: 223330
* Sort include files according to convention.Shankar Easwaran2014-10-181-1/+0
| | | | llvm-svn: 220131
* Fix test build on windows.Rafael Espindola2014-06-111-1/+1
| | | | llvm-svn: 210714
* Move Simple.h and Alias.h to include/Core.Rui Ueyama2014-06-111-1/+1
| | | | | | | | Because the files in Core actually depend on these files. Differential Revision: http://reviews.llvm.org/D4000 llvm-svn: 210710
* Add observers to Input GraphRui Ueyama2014-05-141-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | Make it possible to add observers to an Input Graph, so that files returned from an Input Graph can be examined before they are passed to Resolver. To implement some PE/COFF features we need to know all the symbols that *can* be solved, including ones in archive files that are not yet to be read. Currently, Resolver only maintains a set of symbols that are already read. It has no knowledge on symbols in skipped files in an archive file. There are many ways to implement that. I chose to apply the observer pattern here because it seems most non-intrusive. We don't want to mess up Resolver with architecture specific features. Even in PE/COFF, the feature that needs this mechanism is minor. So I chose not to modify Resolver, but add a hook to Input Graph. Differential Revision: http://reviews.llvm.org/D3735 llvm-svn: 208753
* Expand nested input elements.Rui Ueyama2014-05-061-6/+13
| | | | | | | | Previously only the toplevel elements were expanded by expandElements(). Now we recursively call getReplacements() to expand input elements even if they are in, say, in a group. llvm-svn: 208144
* Add a test for notifyProgress().Rui Ueyama2014-05-061-0/+8
| | | | llvm-svn: 208123
* Remove unused variable.Rui Ueyama2014-05-061-1/+0
| | | | llvm-svn: 208121
* Fix copypaste error.Rui Ueyama2014-05-061-1/+1
| | | | llvm-svn: 208120
* s/My/Test/ as these classes are for tests.Rui Ueyama2014-05-061-11/+13
| | | | llvm-svn: 208119
* Make the test even more readable.Rui Ueyama2014-05-061-202/+80
| | | | llvm-svn: 208118
* Simplify unit test code.Rui Ueyama2014-05-061-20/+6
| | | | llvm-svn: 208116
* Remove meaningless return value in test.Rui Ueyama2014-05-061-2/+1
| | | | llvm-svn: 208112
* Replace copypasta with function calls to make tests intelligible.Rui Ueyama2014-05-061-95/+30
| | | | llvm-svn: 208111
* Don't return value rather than always returning true.Rui Ueyama2014-05-061-9/+9
| | | | | | | addInputElement() never fails, and no one checks its return value except tests. Let's simplify the signature. llvm-svn: 208109
* Remove a method that no one is using.Rui Ueyama2014-05-061-12/+0
| | | | llvm-svn: 208101
* Rename getInputGraph() and getNextFile().Rui Ueyama2014-04-041-27/+27
| | | | | | | | | Seems getSomething() is more common naming scheme than just a noun to get something, so renaming these members. Differential Revision: http://llvm-reviews.chandlerc.com/D3285 llvm-svn: 205589
* Fix comments.Rui Ueyama2014-04-031-1/+1
| | | | llvm-svn: 205568
* Remove ordinals from Input Graph elements.Rui Ueyama2014-04-031-39/+34
| | | | | | | | | | | | | An ordinal is set to each child of Input Graph, but no one actually uses it. The only piece of code that gets ordinaly values is sortInputElements in InputGraph.cpp, but it does not actually do anything -- we assign ordinals in increasing order just before calling sort, so when sort is called it's already sorted. It's no-op. We can simply remove it. No functionality change. Differential Revision: http://llvm-reviews.chandlerc.com/D3270 llvm-svn: 205501
* Remove unused fields/member functions from unit test.Rui Ueyama2014-04-021-13/+4
| | | | llvm-svn: 205469
* Remove unused include.Rui Ueyama2014-04-021-2/+0
| | | | llvm-svn: 205466
* Simplify communication between Resolver and Input Graph.Rui Ueyama2014-04-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Resolver is sending too much information to Input Graph than Input Graph actually needs. In order to collect the detailed information, which wouldn't be consumed by anyone, we have a good amount of code in Resolver, Input Graph and Input Elements. This patch is to simplify it. No functionality change. Specifically, this patch replaces ResolverState enum with a boolean value. The enum defines many bits to notify the progress about linking to Input Graph using bit masks, however, what Input Graph actually does is to compare a given value with 0. The details of the bit mask is simply being ignored, so the efforts to collect such data is wasted. This patch also changes the name of the notification interface from setResolverState to notifyProgress, to make it sounds more like message passing style. It's not a setter but something to notify of an update, so the new name should be more appropriate than before. Differential Revision: http://llvm-reviews.chandlerc.com/D3267 llvm-svn: 205463
* s/llvm::dyn_cast/dyn_cast/Rui Ueyama2014-04-021-10/+10
| | | | llvm-svn: 205404
* Merge ELFGroup with Group.Rui Ueyama2014-04-011-11/+2
| | | | | | | | Group class is designed for GNU LD's --start-group and --end-group. There's no obvious need to have two classes for it -- one as an abstract base class and the other as a concrete class. llvm-svn: 205375
* Remove duplicate code in unit tests carried in from main code.Rui Ueyama2014-04-011-23/+5
| | | | llvm-svn: 205371
* Simplify InputGraphTest.Rui Ueyama2014-04-011-8/+4
| | | | llvm-svn: 205369
* Greatly simplify InputGraph.Rui Ueyama2014-04-011-237/+52
| | | | | | | | | | | | | | | | | | | | | InputGraph has too many knobs and controls that are not being used. This patch is to remove dead code, unused features and a class. There are two things that worth noting, besides simple dead code removal: 1. ControlNode class is removed. We had it as the base class of Group class, but it provides no functionality particularly meaningful. We now have shallower class hierarchy that is easier to understand. 2. InputGraph provides a feature to replace a node with its internal data. It is being used to "expand" some type of node, such as a Linker Script node, with its actual files. We used to have two options when replacing it -- ExpandOnly or ExpandAndReplace. ExpandOnly was to expand it but not remove the node from the tree. There is no use of that option in the code, so it was a dead feature. Differential Revision: http://llvm-reviews.chandlerc.com/D3252 llvm-svn: 205363
* Make anonymous namespace as small as possible.Rui Ueyama2014-03-271-2/+2
| | | | llvm-svn: 204982
* Add "override" and remove "virtual" where appropriate.Rui Ueyama2014-03-061-16/+16
| | | | | | | For the record, I used clang-modernize to add "override" and perl to remove "virtual". llvm-svn: 203164
* Use getError instead of the error_code operator.Rafael Espindola2014-01-081-46/+46
| | | | llvm-svn: 198797
* Run clang-format on r197727.Rui Ueyama2013-12-201-2/+1
| | | | llvm-svn: 197788
* [lld] Introduce registry and Reference kind tupleNick Kledzik2013-12-191-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main changes are in: include/lld/Core/Reference.h include/lld/ReaderWriter/Reader.h Everything else is details to support the main change. 1) Registration based Readers Previously, lld had a tangled interdependency with all the Readers. It would have been impossible to make a streamlined linker (say for a JIT) which just supported one file format and one architecture (no yaml, no archives, etc). The old model also required a LinkingContext to read an object file, which would have made .o inspection tools awkward. The new model is that there is a global Registry object. You programmatically register the Readers you want with the registry object. Whenever you need to read/parse a file, you ask the registry to do it, and the registry tries each registered reader. For ease of use with the existing lld code base, there is one Registry object inside the LinkingContext object. 2) Changing kind value to be a tuple Beside Readers, the registry also keeps track of the mapping for Reference Kind values to and from strings. Along with that, this patch also fixes an ambiguity with the previous Reference::Kind values. The problem was that we wanted to reuse existing relocation type values as Reference::Kind values. But then how can the YAML write know how to convert a value to a string? The fix is to change the 32-bit Reference::Kind into a tuple with an 8-bit namespace (e.g. ELF, COFFF, etc), an 8-bit architecture (e.g. x86_64, PowerPC, etc), and a 16-bit value. This tuple system allows conversion to and from strings with no ambiguities. llvm-svn: 197727
* [InputGraph] Add capability to process Hidden nodes.Shankar Easwaran2013-11-221-2/+82
| | | | | | | | | | Hidden nodes could be a result of expansion, where a flavor might decide to keep the node that we want to expand but discard it from being processed by the resolver. Verifies with unittests. llvm-svn: 195516
* [InputGraph] Expand InputGraph nodes.Shankar Easwaran2013-11-221-0/+188
| | | | | | | | | | | Flavors may like to expand InputGraph nodes, when a filenode after parsing results in more elements. One such example is while parsing GNU linker scripts. The linker scripts after parsing would result in a lot of filenodes and probably controlnodes too. Adds unittests to verify functionality. llvm-svn: 195515
* [test] Add InputGraph testsShankar Easwaran2013-11-211-0/+365
llvm-svn: 195388
OpenPOWER on IntegriCloud