mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Grab a subtarget off of a MipsTargetMachine rather than a
bare target machine in preparation for the TargetMachine bare getSubtarget/getSubtargetImpl calls going away. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232877 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include "MipsTargetObjectFile.h"
|
#include "MipsTargetObjectFile.h"
|
||||||
#include "MipsSubtarget.h"
|
#include "MipsSubtarget.h"
|
||||||
|
#include "MipsTargetMachine.h"
|
||||||
#include "llvm/IR/DataLayout.h"
|
#include "llvm/IR/DataLayout.h"
|
||||||
#include "llvm/IR/DerivedTypes.h"
|
#include "llvm/IR/DerivedTypes.h"
|
||||||
#include "llvm/IR/GlobalVariable.h"
|
#include "llvm/IR/GlobalVariable.h"
|
||||||
@@ -44,7 +45,7 @@ void MipsTargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &TM){
|
|||||||
|
|
||||||
SmallBSSSection = getContext().getELFSection(".sbss", ELF::SHT_NOBITS,
|
SmallBSSSection = getContext().getELFSection(".sbss", ELF::SHT_NOBITS,
|
||||||
ELF::SHF_WRITE | ELF::SHF_ALLOC);
|
ELF::SHF_WRITE | ELF::SHF_ALLOC);
|
||||||
this->TM = &TM;
|
this->TM = &static_cast<const MipsTargetMachine &>(TM);
|
||||||
}
|
}
|
||||||
|
|
||||||
// A address must be loaded from a small section if its size is less than the
|
// A address must be loaded from a small section if its size is less than the
|
||||||
@@ -84,7 +85,8 @@ IsGlobalInSmallSection(const GlobalValue *GV, const TargetMachine &TM,
|
|||||||
bool MipsTargetObjectFile::
|
bool MipsTargetObjectFile::
|
||||||
IsGlobalInSmallSectionImpl(const GlobalValue *GV,
|
IsGlobalInSmallSectionImpl(const GlobalValue *GV,
|
||||||
const TargetMachine &TM) const {
|
const TargetMachine &TM) const {
|
||||||
const MipsSubtarget &Subtarget = TM.getSubtarget<MipsSubtarget>();
|
const MipsSubtarget &Subtarget =
|
||||||
|
*static_cast<const MipsTargetMachine &>(TM).getSubtargetImpl();
|
||||||
|
|
||||||
// Return if small section is not available.
|
// Return if small section is not available.
|
||||||
if (!Subtarget.useSmallSection())
|
if (!Subtarget.useSmallSection())
|
||||||
@@ -127,9 +129,11 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
|||||||
/// Return true if this constant should be placed into small data section.
|
/// Return true if this constant should be placed into small data section.
|
||||||
bool MipsTargetObjectFile::
|
bool MipsTargetObjectFile::
|
||||||
IsConstantInSmallSection(const Constant *CN, const TargetMachine &TM) const {
|
IsConstantInSmallSection(const Constant *CN, const TargetMachine &TM) const {
|
||||||
return (
|
return (static_cast<const MipsTargetMachine &>(TM)
|
||||||
TM.getSubtarget<MipsSubtarget>().useSmallSection() && LocalSData &&
|
.getSubtargetImpl()
|
||||||
IsInSmallSection(TM.getDataLayout()->getTypeAllocSize(CN->getType())));
|
->useSmallSection() &&
|
||||||
|
LocalSData && IsInSmallSection(TM.getDataLayout()->getTypeAllocSize(
|
||||||
|
CN->getType())));
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *MipsTargetObjectFile::
|
const MCSection *MipsTargetObjectFile::
|
||||||
|
@@ -13,11 +13,11 @@
|
|||||||
#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
|
#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
class MipsTargetMachine;
|
||||||
class MipsTargetObjectFile : public TargetLoweringObjectFileELF {
|
class MipsTargetObjectFile : public TargetLoweringObjectFileELF {
|
||||||
const MCSection *SmallDataSection;
|
const MCSection *SmallDataSection;
|
||||||
const MCSection *SmallBSSSection;
|
const MCSection *SmallBSSSection;
|
||||||
const TargetMachine *TM;
|
const MipsTargetMachine *TM;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
|
void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
|
||||||
|
Reference in New Issue
Block a user