#include "MipsTargetObjectFile.h"
#include "MipsSubtarget.h"
#include "MipsTargetMachine.h"
#include "MCTargetDesc/MipsMCExpr.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Target/TargetMachine.h"
usingnamespacellvm;
static cl::opt<unsigned>
SSThreshold("mips-ssection-threshold", cl::Hidden,
cl::desc("Small data and bss section threshold size (default=8)"),
cl::init(8));
static cl::opt<bool>
LocalSData("mlocal-sdata", cl::Hidden,
cl::desc("MIPS: Use gp_rel for object-local data."),
cl::init(true));
static cl::opt<bool>
ExternSData("mextern-sdata", cl::Hidden,
cl::desc("MIPS: Use gp_rel for data that is not defined by the "
"current object."),
cl::init(true));
static cl::opt<bool>
EmbeddedData("membedded-data", cl::Hidden,
cl::desc("MIPS: Try to allocate variables in the following"
" sections if possible: .rodata, .sdata, .data ."),
cl::init(false));
void MipsTargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &TM){ … }
static bool IsInSmallSection(uint64_t Size) { … }
bool MipsTargetObjectFile::IsGlobalInSmallSection(
const GlobalObject *GO, const TargetMachine &TM) const { … }
bool MipsTargetObjectFile::
IsGlobalInSmallSection(const GlobalObject *GO, const TargetMachine &TM,
SectionKind Kind) const { … }
bool MipsTargetObjectFile::
IsGlobalInSmallSectionImpl(const GlobalObject *GO,
const TargetMachine &TM) const { … }
MCSection *MipsTargetObjectFile::SelectSectionForGlobal(
const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const { … }
bool MipsTargetObjectFile::IsConstantInSmallSection(
const DataLayout &DL, const Constant *CN, const TargetMachine &TM) const { … }
MCSection *MipsTargetObjectFile::getSectionForConstant(const DataLayout &DL,
SectionKind Kind,
const Constant *C,
Align &Alignment) const { … }
const MCExpr *
MipsTargetObjectFile::getDebugThreadLocalSymbol(const MCSymbol *Sym) const { … }