diff options
| author | Mehdi Amini <mehdi.amini@apple.com> | 2015-03-12 00:07:24 +0000 | 
|---|---|---|
| committer | Mehdi Amini <mehdi.amini@apple.com> | 2015-03-12 00:07:24 +0000 | 
| commit | 93e1ea167ef5bb703bb02a47c6412057a58af63a (patch) | |
| tree | b89fd138fb5fec1c005b68ecf7aa560077934f37 /llvm/lib/Target/ARM | |
| parent | 27173288c296638e7e3c9e6c1653e305e3482a63 (diff) | |
| download | bcm5719-llvm-93e1ea167ef5bb703bb02a47c6412057a58af63a.tar.gz bcm5719-llvm-93e1ea167ef5bb703bb02a47c6412057a58af63a.zip  | |
Move the DataLayout to the generic TargetMachine, making it mandatory.
Summary:
I don't know why every singled backend had to redeclare its own DataLayout.
There was a virtual getDataLayout() on the common base TargetMachine, the
default implementation returned nullptr. It was not clear from this that
we could assume at call site that a DataLayout will be available with
each Target.
Now getDataLayout() is no longer virtual and return a pointer to the
DataLayout member of the common base TargetMachine. I plan to turn it into
a reference in a future patch.
The only backend that didn't have a DataLayout previsouly was the CPPBackend.
It now initializes the default DataLayout. This commit is NFC for all the
other backends.
Test Plan: clang+llvm ninja check-all
Reviewers: echristo
Subscribers: jfb, jholewinski, llvm-commits
Differential Revision: http://reviews.llvm.org/D8243
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 231987
Diffstat (limited to 'llvm/lib/Target/ARM')
| -rw-r--r-- | llvm/lib/Target/ARM/ARMTargetMachine.cpp | 14 | ||||
| -rw-r--r-- | llvm/lib/Target/ARM/ARMTargetMachine.h | 2 | 
2 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/Target/ARM/ARMTargetMachine.cpp b/llvm/lib/Target/ARM/ARMTargetMachine.cpp index e3e6228206e..4586a9f45bf 100644 --- a/llvm/lib/Target/ARM/ARMTargetMachine.cpp +++ b/llvm/lib/Target/ARM/ARMTargetMachine.cpp @@ -105,9 +105,11 @@ computeTargetABI(const Triple &TT, StringRef CPU,    return TargetABI;  } -static std::string computeDataLayout(const Triple &TT, -                                     ARMBaseTargetMachine::ARMABI ABI, +static std::string computeDataLayout(StringRef TT, StringRef CPU, +                                     const TargetOptions &Options,                                       bool isLittle) { +  const Triple Triple(TT); +  auto ABI = computeTargetABI(Triple, CPU, Options);    std::string Ret = "";    if (isLittle) @@ -117,7 +119,7 @@ static std::string computeDataLayout(const Triple &TT,      // Big endian.      Ret += "E"; -  Ret += DataLayout::getManglingComponent(TT); +  Ret += DataLayout::getManglingComponent(Triple);    // Pointers are 32 bits and aligned to 32 bits.    Ret += "-p:32:32"; @@ -147,7 +149,7 @@ static std::string computeDataLayout(const Triple &TT,    // The stack is 128 bit aligned on NaCl, 64 bit aligned on AAPCS and 32 bit    // aligned everywhere else. -  if (TT.isOSNaCl()) +  if (Triple.isOSNaCl())      Ret += "-S128";    else if (ABI == ARMBaseTargetMachine::ARM_ABI_AAPCS)      Ret += "-S64"; @@ -164,9 +166,9 @@ ARMBaseTargetMachine::ARMBaseTargetMachine(const Target &T, StringRef TT,                                             const TargetOptions &Options,                                             Reloc::Model RM, CodeModel::Model CM,                                             CodeGenOpt::Level OL, bool isLittle) -    : LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL), +    : LLVMTargetMachine(T, computeDataLayout(TT, CPU, Options, isLittle), TT, +                        CPU, FS, Options, RM, CM, OL),        TargetABI(computeTargetABI(Triple(TT), CPU, Options)), -      DL(computeDataLayout(Triple(TT), TargetABI, isLittle)),        TLOF(createTLOF(Triple(getTargetTriple()))),        Subtarget(TT, CPU, FS, *this, isLittle), isLittle(isLittle) { diff --git a/llvm/lib/Target/ARM/ARMTargetMachine.h b/llvm/lib/Target/ARM/ARMTargetMachine.h index 7f6a1ee2d7b..e7f67da5f96 100644 --- a/llvm/lib/Target/ARM/ARMTargetMachine.h +++ b/llvm/lib/Target/ARM/ARMTargetMachine.h @@ -30,7 +30,6 @@ public:    } TargetABI;  protected: -  const DataLayout DL;    std::unique_ptr<TargetLoweringObjectFile> TLOF;    ARMSubtarget        Subtarget;    bool isLittle; @@ -47,7 +46,6 @@ public:    const ARMSubtarget *getSubtargetImpl() const override { return &Subtarget; }    const ARMSubtarget *getSubtargetImpl(const Function &F) const override; -  const DataLayout *getDataLayout() const override { return &DL; }    bool isLittleEndian() const { return isLittle; }    /// \brief Get the TargetIRAnalysis for this target.  | 

