#include "ARMMCTargetDesc.h"
#include "ARMUnwindOpAsm.h"
#include "Utils/ARMBaseInfo.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCCodeEmitter.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCELFObjectWriter.h"
#include "llvm/MC/MCELFStreamer.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCFixup.h"
#include "llvm/MC/MCFragment.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstPrinter.h"
#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCSymbolELF.h"
#include "llvm/MC/SectionKind.h"
#include "llvm/Support/ARMBuildAttributes.h"
#include "llvm/Support/ARMEHABI.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstddef>
#include <cstdint>
#include <string>
usingnamespacellvm;
static std::string GetAEABIUnwindPersonalityName(unsigned Index) { … }
namespace {
class ARMELFStreamer;
class ARMTargetAsmStreamer : public ARMTargetStreamer { … };
ARMTargetAsmStreamer::ARMTargetAsmStreamer(MCStreamer &S,
formatted_raw_ostream &OS,
MCInstPrinter &InstPrinter)
: … { … }
void ARMTargetAsmStreamer::emitFnStart() { … }
void ARMTargetAsmStreamer::emitFnEnd() { … }
void ARMTargetAsmStreamer::emitCantUnwind() { … }
void ARMTargetAsmStreamer::emitPersonality(const MCSymbol *Personality) { … }
void ARMTargetAsmStreamer::emitPersonalityIndex(unsigned Index) { … }
void ARMTargetAsmStreamer::emitHandlerData() { … }
void ARMTargetAsmStreamer::emitSetFP(MCRegister FpReg, MCRegister SpReg,
int64_t Offset) { … }
void ARMTargetAsmStreamer::emitMovSP(MCRegister Reg, int64_t Offset) { … }
void ARMTargetAsmStreamer::emitPad(int64_t Offset) { … }
void ARMTargetAsmStreamer::emitRegSave(
const SmallVectorImpl<MCRegister> &RegList, bool isVector) { … }
void ARMTargetAsmStreamer::switchVendor(StringRef Vendor) { … }
void ARMTargetAsmStreamer::emitAttribute(unsigned Attribute, unsigned Value) { … }
void ARMTargetAsmStreamer::emitTextAttribute(unsigned Attribute,
StringRef String) { … }
void ARMTargetAsmStreamer::emitIntTextAttribute(unsigned Attribute,
unsigned IntValue,
StringRef StringValue) { … }
void ARMTargetAsmStreamer::emitArch(ARM::ArchKind Arch) { … }
void ARMTargetAsmStreamer::emitArchExtension(uint64_t ArchExt) { … }
void ARMTargetAsmStreamer::emitObjectArch(ARM::ArchKind Arch) { … }
void ARMTargetAsmStreamer::emitFPU(ARM::FPUKind FPU) { … }
void ARMTargetAsmStreamer::finishAttributeSection() { … }
void ARMTargetAsmStreamer::annotateTLSDescriptorSequence(
const MCSymbolRefExpr *S) { … }
void ARMTargetAsmStreamer::emitThumbSet(MCSymbol *Symbol, const MCExpr *Value) { … }
void ARMTargetAsmStreamer::emitInst(uint32_t Inst, char Suffix) { … }
void ARMTargetAsmStreamer::emitUnwindRaw(int64_t Offset,
const SmallVectorImpl<uint8_t> &Opcodes) { … }
void ARMTargetAsmStreamer::emitARMWinCFIAllocStack(unsigned Size, bool Wide) { … }
static void printRegs(formatted_raw_ostream &OS, ListSeparator &LS, int First,
int Last) { … }
void ARMTargetAsmStreamer::emitARMWinCFISaveRegMask(unsigned Mask, bool Wide) { … }
void ARMTargetAsmStreamer::emitARMWinCFISaveSP(unsigned Reg) { … }
void ARMTargetAsmStreamer::emitARMWinCFISaveFRegs(unsigned First,
unsigned Last) { … }
void ARMTargetAsmStreamer::emitARMWinCFISaveLR(unsigned Offset) { … }
void ARMTargetAsmStreamer::emitARMWinCFIPrologEnd(bool Fragment) { … }
void ARMTargetAsmStreamer::emitARMWinCFINop(bool Wide) { … }
void ARMTargetAsmStreamer::emitARMWinCFIEpilogStart(unsigned Condition) { … }
void ARMTargetAsmStreamer::emitARMWinCFIEpilogEnd() { … }
void ARMTargetAsmStreamer::emitARMWinCFICustom(unsigned Opcode) { … }
class ARMTargetELFStreamer : public ARMTargetStreamer { … };
class ARMELFStreamer : public MCELFStreamer { … };
}
ARMELFStreamer &ARMTargetELFStreamer::getStreamer() { … }
void ARMTargetELFStreamer::emitFnStart() { … }
void ARMTargetELFStreamer::emitFnEnd() { … }
void ARMTargetELFStreamer::emitCantUnwind() { … }
void ARMTargetELFStreamer::emitPersonality(const MCSymbol *Personality) { … }
void ARMTargetELFStreamer::emitPersonalityIndex(unsigned Index) { … }
void ARMTargetELFStreamer::emitHandlerData() { … }
void ARMTargetELFStreamer::emitSetFP(MCRegister FpReg, MCRegister SpReg,
int64_t Offset) { … }
void ARMTargetELFStreamer::emitMovSP(MCRegister Reg, int64_t Offset) { … }
void ARMTargetELFStreamer::emitPad(int64_t Offset) { … }
void ARMTargetELFStreamer::emitRegSave(
const SmallVectorImpl<MCRegister> &RegList, bool isVector) { … }
void ARMTargetELFStreamer::emitUnwindRaw(int64_t Offset,
const SmallVectorImpl<uint8_t> &Opcodes) { … }
void ARMTargetELFStreamer::switchVendor(StringRef Vendor) { … }
void ARMTargetELFStreamer::emitAttribute(unsigned Attribute, unsigned Value) { … }
void ARMTargetELFStreamer::emitTextAttribute(unsigned Attribute,
StringRef Value) { … }
void ARMTargetELFStreamer::emitIntTextAttribute(unsigned Attribute,
unsigned IntValue,
StringRef StringValue) { … }
void ARMTargetELFStreamer::emitArch(ARM::ArchKind Value) { … }
void ARMTargetELFStreamer::emitObjectArch(ARM::ArchKind Value) { … }
void ARMTargetELFStreamer::emitArchDefaultAttributes() { … }
void ARMTargetELFStreamer::emitFPU(ARM::FPUKind Value) { … }
void ARMTargetELFStreamer::emitFPUDefaultAttributes() { … }
void ARMTargetELFStreamer::finishAttributeSection() { … }
void ARMTargetELFStreamer::emitLabel(MCSymbol *Symbol) { … }
void ARMTargetELFStreamer::annotateTLSDescriptorSequence(
const MCSymbolRefExpr *S) { … }
void ARMTargetELFStreamer::emitThumbSet(MCSymbol *Symbol, const MCExpr *Value) { … }
void ARMTargetELFStreamer::emitInst(uint32_t Inst, char Suffix) { … }
void ARMTargetELFStreamer::reset() { … }
void ARMTargetELFStreamer::finish() { … }
void ARMELFStreamer::reset() { … }
inline void ARMELFStreamer::SwitchToEHSection(StringRef Prefix,
unsigned Type,
unsigned Flags,
SectionKind Kind,
const MCSymbol &Fn) { … }
inline void ARMELFStreamer::SwitchToExTabSection(const MCSymbol &FnStart) { … }
inline void ARMELFStreamer::SwitchToExIdxSection(const MCSymbol &FnStart) { … }
void ARMELFStreamer::EmitFixup(const MCExpr *Expr, MCFixupKind Kind) { … }
void ARMELFStreamer::EHReset() { … }
void ARMELFStreamer::emitFnStart() { … }
void ARMELFStreamer::emitFnEnd() { … }
void ARMELFStreamer::emitCantUnwind() { … }
void ARMELFStreamer::EmitPersonalityFixup(StringRef Name) { … }
void ARMELFStreamer::FlushPendingOffset() { … }
void ARMELFStreamer::FlushUnwindOpcodes(bool NoHandlerData) { … }
void ARMELFStreamer::emitHandlerData() { … }
void ARMELFStreamer::emitPersonality(const MCSymbol *Per) { … }
void ARMELFStreamer::emitPersonalityIndex(unsigned Index) { … }
void ARMELFStreamer::emitSetFP(MCRegister NewFPReg, MCRegister NewSPReg,
int64_t Offset) { … }
void ARMELFStreamer::emitMovSP(MCRegister Reg, int64_t Offset) { … }
void ARMELFStreamer::emitPad(int64_t Offset) { … }
static std::pair<unsigned, unsigned>
collectHWRegs(const MCRegisterInfo &MRI, unsigned Idx,
const SmallVectorImpl<MCRegister> &RegList, bool IsVector,
uint32_t &Mask_) { … }
void ARMELFStreamer::emitRegSave(const SmallVectorImpl<MCRegister> &RegList,
bool IsVector) { … }
void ARMELFStreamer::emitUnwindRaw(int64_t Offset,
const SmallVectorImpl<uint8_t> &Opcodes) { … }
namespace llvm {
MCTargetStreamer *createARMTargetAsmStreamer(MCStreamer &S,
formatted_raw_ostream &OS,
MCInstPrinter *InstPrint) { … }
MCTargetStreamer *createARMNullTargetStreamer(MCStreamer &S) { … }
MCTargetStreamer *createARMObjectTargetELFStreamer(MCStreamer &S) { … }
MCELFStreamer *createARMELFStreamer(MCContext &Context,
std::unique_ptr<MCAsmBackend> TAB,
std::unique_ptr<MCObjectWriter> OW,
std::unique_ptr<MCCodeEmitter> Emitter,
bool IsThumb, bool IsAndroid) { … }
}