LLVM: lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

39#include

40#include

41

42#define DEBUG_TYPE "hexagonmcelfstreamer"

43

44using namespace llvm;

45

48 cl::desc("Global Pointer Addressing Size. The default size is 8."),

51

53 MCContext &Context, std::unique_ptr TAB,

54 std::unique_ptr OW, std::unique_ptr Emitter)

57

59 MCContext &Context, std::unique_ptr TAB,

60 std::unique_ptr OW, std::unique_ptr Emitter,

64

80

87

88

89

90

93 Align ByteAlignment,

94 unsigned AccessSize) {

96 StringRef sbss[4] = {".sbss.1", ".sbss.2", ".sbss.4", ".sbss.8"};

97

98 auto ELFSymbol = static_cast<MCSymbolELF *>(Symbol);

99 if (!ELFSymbol->isBindingSet())

101

103

106 ((AccessSize == 0) || (Size == 0) || (Size > GPSize))

107 ? ".bss"

108 : sbss[(Log2_64(AccessSize))];

113

114 if (ELFSymbol->isUndefined()) {

118 }

119

120

121 Section.ensureMinAlignment(ByteAlignment);

122

124 } else {

125 if (ELFSymbol->declareCommon(Size, ByteAlignment))

127 " redeclared as different type");

128 if ((AccessSize) && (Size <= GPSize)) {

130 (AccessSize <= GPSize)

133 ELFSymbol->setIndex(SectionIndex);

134 }

135 }

136

138}

139

142 Align ByteAlignment,

143 unsigned AccessSize) {

145 auto ELFSymbol = static_cast<const MCSymbolELF *>(Symbol);

148}

149

151 switch (Feature) {

152 case Hexagon::ArchV5:

153 return 5;

154 case Hexagon::ArchV55:

155 return 55;

156 case Hexagon::ArchV60:

157 case Hexagon::ExtensionHVXV60:

158 return 60;

159 case Hexagon::ArchV62:

160 case Hexagon::ExtensionHVXV62:

161 return 62;

162 case Hexagon::ArchV65:

163 case Hexagon::ExtensionHVXV65:

164 return 65;

165 case Hexagon::ArchV66:

166 case Hexagon::ExtensionHVXV66:

167 return 66;

168 case Hexagon::ArchV67:

169 case Hexagon::ExtensionHVXV67:

170 return 67;

171 case Hexagon::ArchV68:

172 case Hexagon::ExtensionHVXV68:

173 return 68;

174 case Hexagon::ArchV69:

175 case Hexagon::ExtensionHVXV69:

176 return 69;

177 case Hexagon::ArchV71:

178 case Hexagon::ExtensionHVXV71:

179 return 71;

180 case Hexagon::ArchV73:

181 case Hexagon::ExtensionHVXV73:

182 return 73;

183 case Hexagon::ArchV75:

184 case Hexagon::ExtensionHVXV75:

185 return 75;

186 case Hexagon::ArchV79:

187 case Hexagon::ExtensionHVXV79:

188 return 79;

189 case Hexagon::ArchV81:

190 case Hexagon::ExtensionHVXV81:

191 return 81;

192 }

194 return 0;

195}

196

202 if (HVXArch)

204 if (Features.test(Hexagon::ExtensionHVXIEEEFP))

206 if (Features.test(Hexagon::ExtensionHVXQFloat))

208 if (Features.test(Hexagon::ExtensionZReg))

210 if (Features.test(Hexagon::ExtensionAudio))

212 if (Features.test(Hexagon::FeatureCabac))

214}

215

216namespace llvm {

218 std::unique_ptr MAB,

219 std::unique_ptr OW,

220 std::unique_ptr CE) {

222 std::move(CE));

223 }

224

225}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

dxil DXContainer Global Emitter

static cl::opt< unsigned > GPSize("gpsize", cl::NotHidden, cl::desc("Global Pointer Addressing Size. The default size is 8."), cl::Prefix, cl::init(8))

static unsigned featureToArchVersion(unsigned Feature)

Definition HexagonMCELFStreamer.cpp:150

#define HEXAGON_PACKET_SIZE

void HexagonMCEmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, Align ByteAlignment, unsigned AccessSize)

Definition HexagonMCELFStreamer.cpp:140

void HexagonMCEmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, Align ByteAlignment, unsigned AccessSize)

Definition HexagonMCELFStreamer.cpp:91

void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override

Emit the given Instruction into the current section.

Definition HexagonMCELFStreamer.cpp:65

void EmitSymbol(const MCInst &Inst)

Definition HexagonMCELFStreamer.cpp:81

HexagonMCELFStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > TAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter)

Definition HexagonMCELFStreamer.cpp:52

void emitTargetAttributes(const MCSubtargetInfo &STI)

Definition HexagonMCELFStreamer.cpp:197

virtual void emitAttribute(unsigned Attribute, unsigned Value)

MCContext & getContext() const

LLVM_ABI bool registerSymbol(const MCSymbol &Symbol)

static LLVM_ABI const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)

Context object for machine code objects.

MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)

void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override

Emit a label for Symbol into the current section.

MCELFStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > TAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter)

Instances of this class represent a single low-level machine instruction.

unsigned getNumOperands() const

unsigned getOpcode() const

const MCOperand & getOperand(unsigned i) const

void emitValueToAlignment(Align Alignment, int64_t Fill=0, uint8_t FillLen=1, unsigned MaxBytesToEmit=0) override

Emit some number of copies of Value until the byte alignment ByteAlignment is reached.

MCAssembler & getAssembler()

void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override

Emit the given Instruction into the current section.

const MCExpr * getExpr() const

Instances of this class represent a uniqued identifier for a section in the current translation unit.

Streaming machine code generation interface.

MCContext & getContext() const

virtual void switchSection(MCSection *Section, uint32_t Subsec=0)

Set the current section where code is being emitted to Section.

MCSectionSubPair getCurrentSection() const

Return the current section that the streamer is emitting code to.

void emitZeros(uint64_t NumBytes)

Emit NumBytes worth of zeros.

void visitUsedExpr(const MCExpr &Expr)

Generic base class for all target subtargets.

const FeatureBitset & getFeatureBits() const

void setBinding(unsigned Binding) const

MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...

StringRef - Represent a constant reference to a string, i.e.

Triple - Helper class for working with autoconf configuration names.

#define llvm_unreachable(msg)

Marks that the current location is not supposed to be reachable.

size_t bundleSize(MCInst const &MCI)

iterator_range< Hexagon::PacketIterator > bundleInstructions(MCInstrInfo const &MCII, MCInst const &MCI)

unsigned getArchVersion(const FeatureBitset &Features)

std::optional< unsigned > getHVXVersion(const FeatureBitset &Features)

initializer< Ty > init(const Ty &Val)

This is an optimization pass for GlobalISel generic memory operations.

int bit_width(T Value)

Returns the number of bits needed to represent Value if Value is nonzero.

unsigned Log2_64(uint64_t Value)

Return the floor log base 2 of the specified value, -1 if the value is zero.

LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)

MCInstrInfo * createHexagonMCInstrInfo()

OutputIt move(R &&Range, OutputIt Out)

Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.

MCStreamer * createHexagonELFStreamer(Triple const &TT, MCContext &Context, std::unique_ptr< MCAsmBackend > MAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > CE)

Definition HexagonMCELFStreamer.cpp:217

std::pair< MCSection *, uint32_t > MCSectionSubPair

Implement std::hash so that hash_code can be used in STL containers.

This struct is a compact representation of a valid (non-zero power of two) alignment.