From bcd2c288721be84cc5eb26c6dc4e3435319afdc1 Mon Sep 17 00:00:00 2001 From: Alexei Starovoitov Date: Mon, 26 Jan 2015 20:43:15 +0000 Subject: [PATCH] bpf: fix build due to 'Move DataLayout back to the TargetMachine' commit r227113 moved DataLayout git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227133 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/BPF/BPFSubtarget.cpp | 4 ++-- lib/Target/BPF/BPFSubtarget.h | 2 -- lib/Target/BPF/BPFTargetMachine.cpp | 1 + lib/Target/BPF/BPFTargetMachine.h | 2 ++ 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/Target/BPF/BPFSubtarget.cpp b/lib/Target/BPF/BPFSubtarget.cpp index 7a237ea0e0f..49addc37ab8 100644 --- a/lib/Target/BPF/BPFSubtarget.cpp +++ b/lib/Target/BPF/BPFSubtarget.cpp @@ -27,5 +27,5 @@ void BPFSubtarget::anchor() {} BPFSubtarget::BPFSubtarget(const std::string &TT, const std::string &CPU, const std::string &FS, const TargetMachine &TM) - : BPFGenSubtargetInfo(TT, CPU, FS), DL("e-m:e-p:64:64-i64:64-n32:64-S128"), - InstrInfo(), FrameLowering(*this), TLInfo(TM), TSInfo(&DL) {} + : BPFGenSubtargetInfo(TT, CPU, FS), InstrInfo(), FrameLowering(*this), + TLInfo(TM), TSInfo(TM.getDataLayout()) {} diff --git a/lib/Target/BPF/BPFSubtarget.h b/lib/Target/BPF/BPFSubtarget.h index da118115537..347cffd82e0 100644 --- a/lib/Target/BPF/BPFSubtarget.h +++ b/lib/Target/BPF/BPFSubtarget.h @@ -30,7 +30,6 @@ class StringRef; class BPFSubtarget : public BPFGenSubtargetInfo { virtual void anchor(); - const DataLayout DL; // Calculates type size & alignment BPFInstrInfo InstrInfo; BPFFrameLowering FrameLowering; BPFTargetLowering TLInfo; @@ -59,7 +58,6 @@ public: const TargetRegisterInfo *getRegisterInfo() const override { return &InstrInfo.getRegisterInfo(); } - const DataLayout *getDataLayout() const override { return &DL; } }; } // End llvm namespace diff --git a/lib/Target/BPF/BPFTargetMachine.cpp b/lib/Target/BPF/BPFTargetMachine.cpp index 6ef2a27888d..c3feb021edb 100644 --- a/lib/Target/BPF/BPFTargetMachine.cpp +++ b/lib/Target/BPF/BPFTargetMachine.cpp @@ -37,6 +37,7 @@ BPFTargetMachine::BPFTargetMachine(const Target &T, StringRef TT, StringRef CPU, CodeGenOpt::Level OL) : LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL), TLOF(make_unique()), + DL("e-m:e-p:64:64-i64:64-n32:64-S128"), Subtarget(TT, CPU, FS, *this) { initAsmInfo(); } diff --git a/lib/Target/BPF/BPFTargetMachine.h b/lib/Target/BPF/BPFTargetMachine.h index 1bfaafc6a58..821cffc7e89 100644 --- a/lib/Target/BPF/BPFTargetMachine.h +++ b/lib/Target/BPF/BPFTargetMachine.h @@ -20,6 +20,7 @@ namespace llvm { class BPFTargetMachine : public LLVMTargetMachine { std::unique_ptr TLOF; + const DataLayout DL; BPFSubtarget Subtarget; public: @@ -27,6 +28,7 @@ public: const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL); + const DataLayout *getDataLayout() const override { return &DL; } const BPFSubtarget *getSubtargetImpl() const override { return &Subtarget; } TargetPassConfig *createPassConfig(PassManagerBase &PM) override; -- 2.34.1