[MCJIT] Significantly refactor the RuntimeDyldMachO class.
authorLang Hames <lhames@gmail.com>
Thu, 17 Jul 2014 18:54:50 +0000 (18:54 +0000)
committerLang Hames <lhames@gmail.com>
Thu, 17 Jul 2014 18:54:50 +0000 (18:54 +0000)
commitbe406de2251080a4a4c12c5bdec2eb1b92d44347
treeb42e18d0010aabc98973ffff51e3c26e07bf8904
parent30ea42931afa3d9cad3c00ea5df1b41a703555cb
[MCJIT] Significantly refactor the RuntimeDyldMachO class.

The previous implementation of RuntimeDyldMachO mixed logic for all targets
within a single class, creating problems for readability, maintainability, and
performance. To address these issues, this patch strips the RuntimeDyldMachO
class down to just target-independent functionality, and moves all
target-specific functionality into target-specific subclasses RuntimeDyldMachO.

The new class hierarchy is as follows:

class RuntimeDyldMachO
Implemented in RuntimeDyldMachO.{h,cpp}
Contains logic that is completely independent of the target. This consists
mostly of MachO helper utilities which the derived classes use to get their
work done.

template <typename Impl>
class RuntimeDyldMachOCRTPBase<Impl> : public RuntimeDyldMachO
Implemented in RuntimeDyldMachO.h
Contains generic MachO algorithms/data structures that defer to the Impl class
for target-specific behaviors.

RuntimeDyldMachOARM : public RuntimeDyldMachOCRTPBase<RuntimeDyldMachOARM>
RuntimeDyldMachOARM64 : public RuntimeDyldMachOCRTPBase<RuntimeDyldMachOARM64>
RuntimeDyldMachOI386 : public RuntimeDyldMachOCRTPBase<RuntimeDyldMachOI386>
RuntimeDyldMachOX86_64 : public RuntimeDyldMachOCRTPBase<RuntimeDyldMachOX86_64>
Implemented in their respective *.h files in lib/ExecutionEngine/RuntimeDyld/MachOTargets
Each of these contains the relocation logic specific to their target architecture.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213293 91177308-0d34-0410-b5e6-96231b3b80d8
lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h
lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h [new file with mode: 0644]
lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOARM.h [new file with mode: 0644]
lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOI386.h [new file with mode: 0644]
lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOX86_64.h [new file with mode: 0644]