#include "HexagonTargetObjectFile.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/GlobalObject.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/SectionKind.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
#define DEBUG_TYPE …
usingnamespacellvm;
static cl::opt<unsigned> SmallDataThreshold("hexagon-small-data-threshold",
cl::init(8), cl::Hidden,
cl::desc("The maximum size of an object in the sdata section"));
static cl::opt<bool> NoSmallDataSorting("mno-sort-sda", cl::init(false),
cl::Hidden, cl::desc("Disable small data sections sorting"));
static cl::opt<bool>
StaticsInSData("hexagon-statics-in-small-data", cl::Hidden,
cl::desc("Allow static variables in .sdata"));
static cl::opt<bool> TraceGVPlacement("trace-gv-placement",
cl::Hidden, cl::init(false),
cl::desc("Trace global value placement"));
static cl::opt<bool>
EmitJtInText("hexagon-emit-jt-text", cl::Hidden, cl::init(false),
cl::desc("Emit hexagon jump tables in function section"));
static cl::opt<bool>
EmitLutInText("hexagon-emit-lut-text", cl::Hidden, cl::init(false),
cl::desc("Emit hexagon lookup tables in function section"));
#define TRACE_TO(s, X) …
#ifdef NDEBUG
#define TRACE(X) …
#else
#define TRACE …
#endif
static bool isSmallDataSection(StringRef Sec) { … }
static const char *getSectionSuffixForSize(unsigned Size) { … }
void HexagonTargetObjectFile::Initialize(MCContext &Ctx,
const TargetMachine &TM) { … }
MCSection *HexagonTargetObjectFile::SelectSectionForGlobal(
const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const { … }
MCSection *HexagonTargetObjectFile::getExplicitSectionGlobal(
const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const { … }
bool HexagonTargetObjectFile::isGlobalInSmallSection(const GlobalObject *GO,
const TargetMachine &TM) const { … }
bool HexagonTargetObjectFile::isSmallDataEnabled(const TargetMachine &TM)
const { … }
unsigned HexagonTargetObjectFile::getSmallDataSize() const { … }
bool HexagonTargetObjectFile::shouldPutJumpTableInFunctionSection(
bool UsesLabelDifference, const Function &F) const { … }
unsigned HexagonTargetObjectFile::getSmallestAddressableSize(const Type *Ty,
const GlobalValue *GV, const TargetMachine &TM) const { … }
MCSection *HexagonTargetObjectFile::selectSmallSectionForGlobal(
const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const { … }
const Function *
HexagonTargetObjectFile::getLutUsedFunction(const GlobalObject *GO) const { … }
MCSection *HexagonTargetObjectFile::selectSectionForLookupTable(
const GlobalObject *GO, const TargetMachine &TM, const Function *Fn) const { … }