diff options
author | Quentin Colombet <qcolombet@apple.com> | 2017-08-08 22:22:30 +0000 |
---|---|---|
committer | Quentin Colombet <qcolombet@apple.com> | 2017-08-08 22:22:30 +0000 |
commit | f6b5ea76fb1561cace8c00bad6b7f5c4e69ce79c (patch) | |
tree | 6ac9f9e0714fe636f921a76340d37a956232cc46 /lib/Target/AArch64/AArch64Subtarget.cpp | |
parent | c7c257e345fbdad041a1b1f43ef7182cb4ec4f4c (diff) |
Revert "[GlobalISel] Remove the GISelAccessor API."
This reverts commit r310115.
It causes a linker failure for the one of the unittests of AArch64 on one
of the linux bot:
http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/3429
: && /home/fedora/gcc/install/gcc-7.1.0/bin/g++ -fPIC
-fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W
-Wno-unused-parameter -Wwrite-strings -Wcast-qual
-Wno-missing-field-initializers -pedantic -Wno-long-long
-Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment
-ffunction-sections -fdata-sections -O2
-L/home/fedora/gcc/install/gcc-7.1.0/lib64 -Wl,-allow-shlib-undefined
-Wl,-O3 -Wl,--gc-sections
unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/InstSizes.cpp.o -o
unittests/Target/AArch64/AArch64Tests
lib/libLLVMAArch64CodeGen.so.6.0.0svn lib/libLLVMAArch64Desc.so.6.0.0svn
lib/libLLVMAArch64Info.so.6.0.0svn lib/libLLVMCodeGen.so.6.0.0svn
lib/libLLVMCore.so.6.0.0svn lib/libLLVMMC.so.6.0.0svn
lib/libLLVMMIRParser.so.6.0.0svn lib/libLLVMSelectionDAG.so.6.0.0svn
lib/libLLVMTarget.so.6.0.0svn lib/libLLVMSupport.so.6.0.0svn -lpthread
lib/libgtest_main.so.6.0.0svn lib/libgtest.so.6.0.0svn -lpthread
-Wl,-rpath,/home/buildbots/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib
&& :
unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/InstSizes.cpp.o:(.toc+0x0):
undefined reference to `vtable for llvm::LegalizerInfo'
unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/InstSizes.cpp.o:(.toc+0x8):
undefined reference to `vtable for llvm::RegisterBankInfo'
The particularity of this bot is that it is built with
BUILD_SHARED_LIBS=ON
However, I was not able to reproduce the problem so far.
Reverting to unblock the bot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310425 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/AArch64/AArch64Subtarget.cpp')
-rw-r--r-- | lib/Target/AArch64/AArch64Subtarget.cpp | 57 |
1 files changed, 46 insertions, 11 deletions
diff --git a/lib/Target/AArch64/AArch64Subtarget.cpp b/lib/Target/AArch64/AArch64Subtarget.cpp index 5d0482918e0..4fb4991da69 100644 --- a/lib/Target/AArch64/AArch64Subtarget.cpp +++ b/lib/Target/AArch64/AArch64Subtarget.cpp @@ -21,6 +21,7 @@ #include "AArch64CallLowering.h" #include "AArch64LegalizerInfo.h" #include "AArch64RegisterBankInfo.h" +#include "llvm/CodeGen/GlobalISel/GISelAccessor.h" #include "llvm/CodeGen/GlobalISel/IRTranslator.h" #include "llvm/CodeGen/GlobalISel/InstructionSelect.h" #include "llvm/CodeGen/GlobalISel/Legalizer.h" @@ -140,42 +141,76 @@ void AArch64Subtarget::initializeProperties() { } } +namespace { + +struct AArch64GISelActualAccessor : public GISelAccessor { + std::unique_ptr<CallLowering> CallLoweringInfo; + std::unique_ptr<InstructionSelector> InstSelector; + std::unique_ptr<LegalizerInfo> Legalizer; + std::unique_ptr<RegisterBankInfo> RegBankInfo; + + const CallLowering *getCallLowering() const override { + return CallLoweringInfo.get(); + } + + const InstructionSelector *getInstructionSelector() const override { + return InstSelector.get(); + } + + const LegalizerInfo *getLegalizerInfo() const override { + return Legalizer.get(); + } + + const RegisterBankInfo *getRegBankInfo() const override { + return RegBankInfo.get(); + } +}; + +} // end anonymous namespace + AArch64Subtarget::AArch64Subtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const TargetMachine &TM, bool LittleEndian) : AArch64GenSubtargetInfo(TT, CPU, FS), - ReserveX18(TT.isOSDarwin() || TT.isOSWindows()), IsLittle(LittleEndian), - TargetTriple(TT), FrameLowering(), + ReserveX18(TT.isOSDarwin() || TT.isOSWindows()), + IsLittle(LittleEndian), TargetTriple(TT), FrameLowering(), InstrInfo(initializeSubtargetDependencies(FS, CPU)), TSInfo(), - TLInfo(TM, *this) { - CallLoweringInfo.reset(new AArch64CallLowering(*getTargetLowering())); - Legalizer.reset(new AArch64LegalizerInfo()); + TLInfo(TM, *this), GISel() { + AArch64GISelActualAccessor *AArch64GISel = new AArch64GISelActualAccessor(); + AArch64GISel->CallLoweringInfo.reset( + new AArch64CallLowering(*getTargetLowering())); + AArch64GISel->Legalizer.reset(new AArch64LegalizerInfo()); auto *RBI = new AArch64RegisterBankInfo(*getRegisterInfo()); // FIXME: At this point, we can't rely on Subtarget having RBI. // It's awkward to mix passing RBI and the Subtarget; should we pass // TII/TRI as well? - InstSelector.reset(createAArch64InstructionSelector( + AArch64GISel->InstSelector.reset(createAArch64InstructionSelector( *static_cast<const AArch64TargetMachine *>(&TM), *this, *RBI)); - RegBankInfo.reset(RBI); + AArch64GISel->RegBankInfo.reset(RBI); + setGISelAccessor(*AArch64GISel); } const CallLowering *AArch64Subtarget::getCallLowering() const { - return CallLoweringInfo.get(); + assert(GISel && "Access to GlobalISel APIs not set"); + return GISel->getCallLowering(); } const InstructionSelector *AArch64Subtarget::getInstructionSelector() const { - return InstSelector.get(); + assert(GISel && "Access to GlobalISel APIs not set"); + return GISel->getInstructionSelector(); } const LegalizerInfo *AArch64Subtarget::getLegalizerInfo() const { - return Legalizer.get(); + assert(GISel && "Access to GlobalISel APIs not set"); + return GISel->getLegalizerInfo(); } const RegisterBankInfo *AArch64Subtarget::getRegBankInfo() const { - return RegBankInfo.get(); + assert(GISel && "Access to GlobalISel APIs not set"); + return GISel->getRegBankInfo(); } /// Find the target operand flags that describe how a global value should be |