13 #define DEBUG_TYPE "hexagonmcelfstreamer" 44 cl::desc(
"Global Pointer Addressing Size. The default size is 8."),
50 std::unique_ptr<MCObjectWriter> OW, std::unique_ptr<MCCodeEmitter> Emitter)
55 MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
56 std::unique_ptr<MCObjectWriter> OW, std::unique_ptr<MCCodeEmitter> Emitter,
90 unsigned AccessSize) {
92 StringRef sbss[4] = {
".sbss.1",
".sbss.2",
".sbss.4",
".sbss.8"};
94 auto ELFSymbol = cast<MCSymbolELF>(
Symbol);
95 if (!ELFSymbol->isBindingSet()) {
97 ELFSymbol->setExternal(
true);
104 ((AccessSize == 0) || (Size == 0) || (Size >
GPSize))
112 if (ELFSymbol->isUndefined()) {
119 if (
Align(ByteAlignment) > Section.getAlignment())
120 Section.setAlignment(
Align(ByteAlignment));
124 if (ELFSymbol->declareCommon(Size, ByteAlignment))
126 " redeclared as different type");
127 if ((AccessSize) && (Size <=
GPSize)) {
128 uint64_t SectionIndex =
132 ELFSymbol->setIndex(SectionIndex);
142 unsigned AccessSize) {
144 auto ELFSymbol = cast<MCSymbolELF>(
Symbol);
146 ELFSymbol->setExternal(
false);
153 std::unique_ptr<MCAsmBackend> MAB,
154 std::unique_ptr<MCObjectWriter> OW,
155 std::unique_ptr<MCCodeEmitter> CE) {
void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override
Emit the given Instruction into the current section.
Instances of this class represent a uniqued identifier for a section in the current translation unit...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
void registerSymbol(const MCSymbol &Symbol, bool *Created=nullptr)
MCContext & getContext() const
MCContext & getContext() const
static cl::opt< unsigned > GPSize("gpsize", cl::NotHidden, cl::desc("Global Pointer Addressing Size. The default size is 8."), cl::Prefix, cl::init(8))
iterator_range< Hexagon::PacketIterator > bundleInstructions(MCInstrInfo const &MCII, MCInst const &MCI)
void EmitValueToAlignment(unsigned, int64_t, unsigned, unsigned) override
Emit some number of copies of Value until the byte alignment ByteAlignment is reached.
Context object for machine code objects.
MCInstrInfo * createHexagonMCInstrInfo()
const MCExpr * getExpr() const
Instances of this class represent a single low-level machine instruction.
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false)
initializer< Ty > init(const Ty &Val)
void EmitZeros(uint64_t NumBytes)
Emit NumBytes worth of zeros.
Streaming machine code generation interface.
virtual void SwitchSection(MCSection *Section, const MCExpr *Subsection=nullptr)
Set the current section where code is being emitted to Section.
MCAssembler & getAssembler()
unsigned getNumOperands() const
This struct is a compact representation of a valid (non-zero power of two) alignment.
Triple - Helper class for working with autoconf configuration names.
void HexagonMCEmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment, unsigned AccessSize)
MCSectionSubPair getCurrentSection() const
Return the current section that the streamer is emitting code to.
std::pair< MCSection *, const MCExpr * > MCSectionSubPair
void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override
Emit the given Instruction into the current section.
HexagonMCELFStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > TAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter)
const MCOperand & getOperand(unsigned i) const
void EmitSymbol(const MCInst &Inst)
void visitUsedExpr(const MCExpr &Expr)
Generic base class for all target subtargets.
size_t bundleSize(MCInst const &MCI)
void EmitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
StringRef getName() const
getName - Get the symbol name.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
MCStreamer * createHexagonELFStreamer(Triple const &TT, MCContext &Context, std::unique_ptr< MCAsmBackend > MAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > CE)
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
#define HEXAGON_PACKET_SIZE
StringRef - Represent a constant reference to a string, i.e.
unsigned getOpcode() const
unsigned Log2_64(uint64_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
void HexagonMCEmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment, unsigned AccessSize)