1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
llvm-mirror/test
Jake Ehrlich 07922aa56a [llvm-objcopy] Refactor llvm-objcopy to use reader and writer objects
While writing code for input and output formats in llvm-objcopy it became
apparent that there was a code health problem. This change attempts to solve
that problem by refactoring the code to use Reader and Writer objects that can
read in different objects in different formats, convert them to a single shared
internal representation, and then write them to any other representation.

New classes:
Reader: the base class used to construct instances of the internal
representation
Writer: the base class used to write out instances of the internal
representation
ELFBuilder: a helper class for ELFWriter that takes an ELFFile and converts it
to a Object
SectionVisitor: it became necessary to remove writeSection from SectionBase
because, under the new Reader/Writer scheme, it's possible to convert between
ELF Types such as ELF32LE and ELF32BE. This isn't possible with writeSection
because it (dynamically) depends on the underlying section type *and*
(statically) depends on the ELF type. Bad things would happen if the underlying
sections for ELF32LE were used for writing to ELF64BE. To avoid this code smell
(which would have compiled, run, and output some nonsesnse) I decoupled writing
of sections from a class.
SectionWriter: This is just the ELFT templated implementation of
SectionVisitor. Many classes now have this class as a friend so that the
writing methods in this class can write out private data.
ELFWriter: This is the Writer that outputs to ELF
BinaryWriter: This is the Writer that outputs to Binary
ElfType: Because the ELF Type is not a part of the Object anymore we need a way
to construct the correct default Writer based on properties of the Reader. This
enum just keeps track of the ELF type of the input so it can be used as the
default output type as well.

Object has correspondingly undergone some serious changes as well. It now has
more generic methods for building and manipulating ELF binaries. This interface
makes ELFBuilder easy enough to use and will make the BinaryReader/Builder easy
to create as well. Most changes in this diff are cosmetic and deal with the
fact that a method has been moved from one class to another or a change from a
pointer to a reference. Almost no changes should result in a functional
difference (this is after all a refactor). One minor functional change was made
and the result can be seen in remove-shstrtab-error.test. The fact that it
fails hasn't changed but the error message has changed because that failure is
detected at a later point in the code now (because WriteSectionHeaders is a
property of the ElfWriter *not* a property of the Object). I'd say roughly
80-90% of this code is cosmetically different, 10-19% is different but
functionally the same, and 1-5% is functionally different despite not causing a
change in tests.

Differential Revision: https://reviews.llvm.org/D42222

llvm-svn: 323480
2018-01-25 22:46:17 +00:00
..
Analysis [ValueTracking] add recursion depth param to matchSelectPattern 2018-01-24 15:20:37 +00:00
Assembler [Metadata] Extend 'count' field of DISubrange to take a metadata node 2018-01-24 09:56:07 +00:00
Bindings
Bitcode Add testcase accidentally left out from r323460. 2018-01-25 22:23:52 +00:00
BugPoint
CodeGen [Hexagon] SETEQ and SETNE are valid integer condition codes 2018-01-25 18:07:27 +00:00
DebugInfo [DWARFv5] Support DW_FORM_line_strp in llvm-dwarfdump. 2018-01-25 22:02:36 +00:00
Examples
ExecutionEngine
Feature
FileCheck [FileCheck] - Fix possible buffer out of bounds access when parsing --check-prefix. 2018-01-16 08:09:24 +00:00
Instrumentation Revert "asan: add kernel inline instrumentation test" 2018-01-25 18:20:19 +00:00
Integer
JitListener
Linker [IRMover] Add comment and fix test case 2018-01-25 08:35:52 +00:00
LTO Remove alignment argument from memcpy/memmove/memset in favour of alignment attributes (Step 1) 2018-01-19 17:13:12 +00:00
MC [X86] Teach Intel syntax InstPrinter to print lock prefixes that have been parsed from the asm parser. 2018-01-25 21:23:57 +00:00
Object Remove alignment argument from memcpy/memmove/memset in favour of alignment attributes (Step 1) 2018-01-19 17:13:12 +00:00
ObjectYAML [WebAssembly] Remove debug names from symbol table 2018-01-17 19:28:43 +00:00
Other Another try to commit 323321 (aggressive instruction combine). 2018-01-25 12:06:32 +00:00
SafepointIRVerifier
SymbolRewriter
TableGen [GlobalISel][TableGen] Add support for SDNodeXForm 2018-01-16 18:44:05 +00:00
ThinLTO/X86 [ThinLTO] Re-commit of dot dumper after test fix 2018-01-22 13:35:40 +00:00
tools [llvm-objcopy] Refactor llvm-objcopy to use reader and writer objects 2018-01-25 22:46:17 +00:00
Transforms [Debug] Add dbg.value intrinsics for PHIs created during LCSSA. 2018-01-25 21:37:07 +00:00
Unit
Verifier [Metadata] Extend 'count' field of DISubrange to take a metadata node 2018-01-24 09:56:07 +00:00
YAMLParser
.clang-format
CMakeLists.txt
lit.cfg.py
lit.site.cfg.py.in
TestRunner.sh