2014-04-27 05:48:05 +02:00
|
|
|
//===- MCWinCOFFStreamer.h - COFF Object File Interface ---------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 09:50:56 +01:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2014-04-27 05:48:05 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_MC_MCWINCOFFSTREAMER_H
|
|
|
|
#define LLVM_MC_MCWINCOFFSTREAMER_H
|
|
|
|
|
|
|
|
#include "llvm/MC/MCDirectives.h"
|
|
|
|
#include "llvm/MC/MCObjectStreamer.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
2017-02-08 00:02:00 +01:00
|
|
|
|
2014-04-27 05:48:05 +02:00
|
|
|
class MCAsmBackend;
|
|
|
|
class MCContext;
|
|
|
|
class MCCodeEmitter;
|
|
|
|
class MCInst;
|
|
|
|
class MCSection;
|
|
|
|
class MCSubtargetInfo;
|
|
|
|
class MCSymbol;
|
|
|
|
class StringRef;
|
2015-04-15 00:14:34 +02:00
|
|
|
class raw_pwrite_stream;
|
2014-04-27 05:48:05 +02:00
|
|
|
|
|
|
|
class MCWinCOFFStreamer : public MCObjectStreamer {
|
|
|
|
public:
|
2017-10-11 03:57:21 +02:00
|
|
|
MCWinCOFFStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> MAB,
|
2018-05-18 20:26:45 +02:00
|
|
|
std::unique_ptr<MCCodeEmitter> CE,
|
|
|
|
std::unique_ptr<MCObjectWriter> OW);
|
2014-04-27 05:48:05 +02:00
|
|
|
|
2014-09-17 11:25:36 +02:00
|
|
|
/// state management
|
|
|
|
void reset() override {
|
|
|
|
CurSymbol = nullptr;
|
|
|
|
MCObjectStreamer::reset();
|
|
|
|
}
|
|
|
|
|
2014-04-27 05:48:05 +02:00
|
|
|
/// \name MCStreamer interface
|
|
|
|
/// \{
|
|
|
|
|
2014-10-15 18:12:52 +02:00
|
|
|
void InitSections(bool NoExecStack) override;
|
2020-02-15 04:21:58 +01:00
|
|
|
void emitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override;
|
2020-02-15 03:16:24 +01:00
|
|
|
void emitAssemblerFlag(MCAssemblerFlag Flag) override;
|
|
|
|
void emitThumbFunc(MCSymbol *Func) override;
|
2020-11-02 21:32:06 +01:00
|
|
|
bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
|
2020-02-15 03:16:24 +01:00
|
|
|
void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override;
|
2014-04-27 05:48:05 +02:00
|
|
|
void BeginCOFFSymbolDef(MCSymbol const *Symbol) override;
|
|
|
|
void EmitCOFFSymbolStorageClass(int StorageClass) override;
|
|
|
|
void EmitCOFFSymbolType(int Type) override;
|
|
|
|
void EndCOFFSymbolDef() override;
|
2015-05-30 06:56:02 +02:00
|
|
|
void EmitCOFFSafeSEH(MCSymbol const *Symbol) override;
|
2018-01-10 00:49:30 +01:00
|
|
|
void EmitCOFFSymbolIndex(MCSymbol const *Symbol) override;
|
2014-04-27 05:48:05 +02:00
|
|
|
void EmitCOFFSectionIndex(MCSymbol const *Symbol) override;
|
2017-01-02 04:00:19 +01:00
|
|
|
void EmitCOFFSecRel32(MCSymbol const *Symbol, uint64_t Offset) override;
|
2018-07-26 22:11:26 +02:00
|
|
|
void EmitCOFFImgRel32(MCSymbol const *Symbol, int64_t Offset) override;
|
2020-02-15 03:16:24 +01:00
|
|
|
void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
2014-04-27 05:48:05 +02:00
|
|
|
unsigned ByteAlignment) override;
|
2020-02-15 03:16:24 +01:00
|
|
|
void emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
2014-04-27 05:48:05 +02:00
|
|
|
unsigned ByteAlignment) override;
|
2020-09-29 22:59:42 +02:00
|
|
|
void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override;
|
2020-02-15 03:16:24 +01:00
|
|
|
void emitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
|
2018-07-02 19:29:43 +02:00
|
|
|
unsigned ByteAlignment, SMLoc Loc = SMLoc()) override;
|
2020-02-15 17:52:56 +01:00
|
|
|
void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
|
2014-04-27 05:48:05 +02:00
|
|
|
unsigned ByteAlignment) override;
|
2020-02-15 17:52:56 +01:00
|
|
|
void emitIdent(StringRef IdentString) override;
|
2017-10-10 03:26:25 +02:00
|
|
|
void EmitWinEHHandlerData(SMLoc Loc) override;
|
2020-06-26 05:35:03 +02:00
|
|
|
void emitCGProfileEntry(const MCSymbolRefExpr *From,
|
|
|
|
const MCSymbolRefExpr *To, uint64_t Count) override;
|
2020-04-21 04:28:13 +02:00
|
|
|
void finishImpl() override;
|
2014-04-27 05:48:05 +02:00
|
|
|
|
|
|
|
/// \}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
const MCSymbol *CurSymbol;
|
2017-02-08 00:02:00 +01:00
|
|
|
|
2020-04-20 11:53:00 +02:00
|
|
|
void emitInstToData(const MCInst &Inst, const MCSubtargetInfo &STI) override;
|
2014-05-22 04:18:10 +02:00
|
|
|
|
2020-06-26 05:35:03 +02:00
|
|
|
void finalizeCGProfileEntry(const MCSymbolRefExpr *&S);
|
|
|
|
void finalizeCGProfile();
|
|
|
|
|
2014-05-22 04:18:10 +02:00
|
|
|
private:
|
2015-11-17 11:00:43 +01:00
|
|
|
void Error(const Twine &Msg) const;
|
2014-04-27 05:48:05 +02:00
|
|
|
};
|
|
|
|
|
2017-02-08 00:02:00 +01:00
|
|
|
} // end namespace llvm
|
2014-04-27 05:48:05 +02:00
|
|
|
|
2017-02-08 00:02:00 +01:00
|
|
|
#endif // LLVM_MC_MCWINCOFFSTREAMER_H
|