1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

[MC] De-capitalize some MCStreamer::Emit* functions

This commit is contained in:
Fangrui Song 2020-02-14 18:16:24 -08:00
parent 2c0f20cf6c
commit 343c2a2b44
74 changed files with 470 additions and 470 deletions

View File

@ -29,9 +29,9 @@ namespace codeview {
class CodeViewRecordStreamer { class CodeViewRecordStreamer {
public: public:
virtual void EmitBytes(StringRef Data) = 0; virtual void emitBytes(StringRef Data) = 0;
virtual void EmitIntValue(uint64_t Value, unsigned Size) = 0; virtual void EmitIntValue(uint64_t Value, unsigned Size) = 0;
virtual void EmitBinaryData(StringRef Data) = 0; virtual void emitBinaryData(StringRef Data) = 0;
virtual void AddComment(const Twine &T) = 0; virtual void AddComment(const Twine &T) = 0;
virtual void AddRawComment(const Twine &T) = 0; virtual void AddRawComment(const Twine &T) = 0;
virtual bool isVerboseAsm() = 0; virtual bool isVerboseAsm() = 0;
@ -81,7 +81,7 @@ public:
if (isStreaming()) { if (isStreaming()) {
StringRef BytesSR = StringRef BytesSR =
StringRef((reinterpret_cast<const char *>(&Value)), sizeof(Value)); StringRef((reinterpret_cast<const char *>(&Value)), sizeof(Value));
Streamer->EmitBytes(BytesSR); Streamer->emitBytes(BytesSR);
incrStreamedLen(sizeof(T)); incrStreamedLen(sizeof(T));
return Error::success(); return Error::success();
} }

View File

@ -43,22 +43,22 @@ public:
void EmitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override; void EmitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override;
void emitLabelAtPos(MCSymbol *Symbol, SMLoc Loc, MCFragment *F, void emitLabelAtPos(MCSymbol *Symbol, SMLoc Loc, MCFragment *F,
uint64_t Offset) override; uint64_t Offset) override;
void EmitAssemblerFlag(MCAssemblerFlag Flag) override; void emitAssemblerFlag(MCAssemblerFlag Flag) override;
void EmitThumbFunc(MCSymbol *Func) override; void emitThumbFunc(MCSymbol *Func) override;
void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override; void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override;
bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override; bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override; void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override;
void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override; unsigned ByteAlignment) override;
void emitELFSize(MCSymbol *Symbol, const MCExpr *Value) override; void emitELFSize(MCSymbol *Symbol, const MCExpr *Value) override;
void emitELFSymverDirective(StringRef AliasName, void emitELFSymverDirective(StringRef AliasName,
const MCSymbol *Aliasee) override; const MCSymbol *Aliasee) override;
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, void emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override; unsigned ByteAlignment) override;
void EmitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr, void emitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
uint64_t Size = 0, unsigned ByteAlignment = 0, uint64_t Size = 0, unsigned ByteAlignment = 0,
SMLoc L = SMLoc()) override; SMLoc L = SMLoc()) override;
void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size, void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,

View File

@ -116,12 +116,12 @@ public:
void EmitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override; void EmitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override;
virtual void emitLabelAtPos(MCSymbol *Symbol, SMLoc Loc, MCFragment *F, virtual void emitLabelAtPos(MCSymbol *Symbol, SMLoc Loc, MCFragment *F,
uint64_t Offset); uint64_t Offset);
void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) override; void emitAssignment(MCSymbol *Symbol, const MCExpr *Value) override;
void EmitValueImpl(const MCExpr *Value, unsigned Size, void EmitValueImpl(const MCExpr *Value, unsigned Size,
SMLoc Loc = SMLoc()) override; SMLoc Loc = SMLoc()) override;
void emitULEB128Value(const MCExpr *Value) override; void emitULEB128Value(const MCExpr *Value) override;
void emitSLEB128Value(const MCExpr *Value) override; void emitSLEB128Value(const MCExpr *Value) override;
void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override; void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override;
void ChangeSection(MCSection *Section, const MCExpr *Subsection) override; void ChangeSection(MCSection *Section, const MCExpr *Subsection) override;
void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override; void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override;
@ -132,7 +132,7 @@ public:
void EmitBundleAlignMode(unsigned AlignPow2) override; void EmitBundleAlignMode(unsigned AlignPow2) override;
void EmitBundleLock(bool AlignToEnd) override; void EmitBundleLock(bool AlignToEnd) override;
void EmitBundleUnlock() override; void EmitBundleUnlock() override;
void EmitBytes(StringRef Data) override; void emitBytes(StringRef Data) override;
void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0, void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
unsigned ValueSize = 1, unsigned ValueSize = 1,
unsigned MaxBytesToEmit = 0) override; unsigned MaxBytesToEmit = 0) override;

View File

@ -455,35 +455,35 @@ public:
// add the section we're emitting it to later. // add the section we're emitting it to later.
virtual void EmitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()); virtual void EmitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc());
virtual void EmitEHSymAttributes(const MCSymbol *Symbol, MCSymbol *EHSymbol); virtual void emitEHSymAttributes(const MCSymbol *Symbol, MCSymbol *EHSymbol);
/// Note in the output the specified \p Flag. /// Note in the output the specified \p Flag.
virtual void EmitAssemblerFlag(MCAssemblerFlag Flag); virtual void emitAssemblerFlag(MCAssemblerFlag Flag);
/// Emit the given list \p Options of strings as linker /// Emit the given list \p Options of strings as linker
/// options into the output. /// options into the output.
virtual void EmitLinkerOptions(ArrayRef<std::string> Kind) {} virtual void emitLinkerOptions(ArrayRef<std::string> Kind) {}
/// Note in the output the specified region \p Kind. /// Note in the output the specified region \p Kind.
virtual void EmitDataRegion(MCDataRegionType Kind) {} virtual void emitDataRegion(MCDataRegionType Kind) {}
/// Specify the Mach-O minimum deployment target version. /// Specify the Mach-O minimum deployment target version.
virtual void EmitVersionMin(MCVersionMinType Type, unsigned Major, virtual void emitVersionMin(MCVersionMinType Type, unsigned Major,
unsigned Minor, unsigned Update, unsigned Minor, unsigned Update,
VersionTuple SDKVersion) {} VersionTuple SDKVersion) {}
/// Emit/Specify Mach-O build version command. /// Emit/Specify Mach-O build version command.
/// \p Platform should be one of MachO::PlatformType. /// \p Platform should be one of MachO::PlatformType.
virtual void EmitBuildVersion(unsigned Platform, unsigned Major, virtual void emitBuildVersion(unsigned Platform, unsigned Major,
unsigned Minor, unsigned Update, unsigned Minor, unsigned Update,
VersionTuple SDKVersion) {} VersionTuple SDKVersion) {}
void EmitVersionForTarget(const Triple &Target, void emitVersionForTarget(const Triple &Target,
const VersionTuple &SDKVersion); const VersionTuple &SDKVersion);
/// Note in the output that the specified \p Func is a Thumb mode /// Note in the output that the specified \p Func is a Thumb mode
/// function (ARM target only). /// function (ARM target only).
virtual void EmitThumbFunc(MCSymbol *Func); virtual void emitThumbFunc(MCSymbol *Func);
/// Emit an assignment of \p Value to \p Symbol. /// Emit an assignment of \p Value to \p Symbol.
/// ///
@ -496,7 +496,7 @@ public:
/// ///
/// \param Symbol - The symbol being assigned to. /// \param Symbol - The symbol being assigned to.
/// \param Value - The value for the symbol. /// \param Value - The value for the symbol.
virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value); virtual void emitAssignment(MCSymbol *Symbol, const MCExpr *Value);
/// Emit an weak reference from \p Alias to \p Symbol. /// Emit an weak reference from \p Alias to \p Symbol.
/// ///
@ -505,17 +505,17 @@ public:
/// ///
/// \param Alias - The alias that is being created. /// \param Alias - The alias that is being created.
/// \param Symbol - The symbol being aliased. /// \param Symbol - The symbol being aliased.
virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol); virtual void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol);
/// Add the given \p Attribute to \p Symbol. /// Add the given \p Attribute to \p Symbol.
virtual bool EmitSymbolAttribute(MCSymbol *Symbol, virtual bool emitSymbolAttribute(MCSymbol *Symbol,
MCSymbolAttr Attribute) = 0; MCSymbolAttr Attribute) = 0;
/// Set the \p DescValue for the \p Symbol. /// Set the \p DescValue for the \p Symbol.
/// ///
/// \param Symbol - The symbol to have its n_desc field set. /// \param Symbol - The symbol to have its n_desc field set.
/// \param DescValue - The value to set into the n_desc field. /// \param DescValue - The value to set into the n_desc field.
virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue); virtual void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue);
/// Start emitting COFF symbol definition /// Start emitting COFF symbol definition
/// ///
@ -583,7 +583,7 @@ public:
/// Emit a Linker Optimization Hint (LOH) directive. /// Emit a Linker Optimization Hint (LOH) directive.
/// \param Args - Arguments of the LOH. /// \param Args - Arguments of the LOH.
virtual void EmitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) {} virtual void emitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) {}
/// Emit a common symbol. /// Emit a common symbol.
/// ///
@ -591,7 +591,7 @@ public:
/// \param Size - The size of the common symbol. /// \param Size - The size of the common symbol.
/// \param ByteAlignment - The alignment of the symbol if /// \param ByteAlignment - The alignment of the symbol if
/// non-zero. This must be a power of 2. /// non-zero. This must be a power of 2.
virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, virtual void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) = 0; unsigned ByteAlignment) = 0;
/// Emit a local common (.lcomm) symbol. /// Emit a local common (.lcomm) symbol.
@ -599,7 +599,7 @@ public:
/// \param Symbol - The common symbol to emit. /// \param Symbol - The common symbol to emit.
/// \param Size - The size of the common symbol. /// \param Size - The size of the common symbol.
/// \param ByteAlignment - The alignment of the common symbol in bytes. /// \param ByteAlignment - The alignment of the common symbol in bytes.
virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, virtual void emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment); unsigned ByteAlignment);
/// Emit the zerofill section and an optional symbol. /// Emit the zerofill section and an optional symbol.
@ -609,7 +609,7 @@ public:
/// \param Size - The size of the zerofill symbol. /// \param Size - The size of the zerofill symbol.
/// \param ByteAlignment - The alignment of the zerofill symbol if /// \param ByteAlignment - The alignment of the zerofill symbol if
/// non-zero. This must be a power of 2 on some targets. /// non-zero. This must be a power of 2 on some targets.
virtual void EmitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr, virtual void emitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
uint64_t Size = 0, unsigned ByteAlignment = 0, uint64_t Size = 0, unsigned ByteAlignment = 0,
SMLoc Loc = SMLoc()) = 0; SMLoc Loc = SMLoc()) = 0;
@ -631,11 +631,11 @@ public:
/// ///
/// This is used to implement assembler directives such as .byte, .ascii, /// This is used to implement assembler directives such as .byte, .ascii,
/// etc. /// etc.
virtual void EmitBytes(StringRef Data); virtual void emitBytes(StringRef Data);
/// Functionally identical to EmitBytes. When emitting textual assembly, this /// Functionally identical to EmitBytes. When emitting textual assembly, this
/// method uses .byte directives instead of .ascii or .asciz for readability. /// method uses .byte directives instead of .ascii or .asciz for readability.
virtual void EmitBinaryData(StringRef Data); virtual void emitBinaryData(StringRef Data);
/// Emit the expression \p Value into the output as a native /// Emit the expression \p Value into the output as a native
/// integer of the given \p Size bytes. /// integer of the given \p Size bytes.

View File

@ -45,20 +45,20 @@ public:
/// @{ /// @{
void ChangeSection(MCSection *Section, const MCExpr *Subsection) override; void ChangeSection(MCSection *Section, const MCExpr *Subsection) override;
void EmitAssemblerFlag(MCAssemblerFlag Flag) override; void emitAssemblerFlag(MCAssemblerFlag Flag) override;
void EmitThumbFunc(MCSymbol *Func) override; void emitThumbFunc(MCSymbol *Func) override;
void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override; void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override;
bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override; bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override; void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override;
void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override; unsigned ByteAlignment) override;
void emitELFSize(MCSymbol *Symbol, const MCExpr *Value) override; void emitELFSize(MCSymbol *Symbol, const MCExpr *Value) override;
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, void emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override; unsigned ByteAlignment) override;
void EmitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr, void emitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
uint64_t Size = 0, unsigned ByteAlignment = 0, uint64_t Size = 0, unsigned ByteAlignment = 0,
SMLoc Loc = SMLoc()) override; SMLoc Loc = SMLoc()) override;
void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size, void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,

View File

@ -41,10 +41,10 @@ public:
void InitSections(bool NoExecStack) override; void InitSections(bool NoExecStack) override;
void EmitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override; void EmitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override;
void EmitAssemblerFlag(MCAssemblerFlag Flag) override; void emitAssemblerFlag(MCAssemblerFlag Flag) override;
void EmitThumbFunc(MCSymbol *Func) override; void emitThumbFunc(MCSymbol *Func) override;
bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override; bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override; void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override;
void BeginCOFFSymbolDef(MCSymbol const *Symbol) override; void BeginCOFFSymbolDef(MCSymbol const *Symbol) override;
void EmitCOFFSymbolStorageClass(int StorageClass) override; void EmitCOFFSymbolStorageClass(int StorageClass) override;
void EmitCOFFSymbolType(int Type) override; void EmitCOFFSymbolType(int Type) override;
@ -54,11 +54,11 @@ public:
void EmitCOFFSectionIndex(MCSymbol const *Symbol) override; void EmitCOFFSectionIndex(MCSymbol const *Symbol) override;
void EmitCOFFSecRel32(MCSymbol const *Symbol, uint64_t Offset) override; void EmitCOFFSecRel32(MCSymbol const *Symbol, uint64_t Offset) override;
void EmitCOFFImgRel32(MCSymbol const *Symbol, int64_t Offset) override; void EmitCOFFImgRel32(MCSymbol const *Symbol, int64_t Offset) override;
void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override; unsigned ByteAlignment) override;
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, void emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override; unsigned ByteAlignment) override;
void EmitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size, void emitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment, SMLoc Loc = SMLoc()) override; unsigned ByteAlignment, SMLoc Loc = SMLoc()) override;
void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size, void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override; unsigned ByteAlignment) override;

View File

@ -19,10 +19,10 @@ public:
std::unique_ptr<MCObjectWriter> OW, std::unique_ptr<MCObjectWriter> OW,
std::unique_ptr<MCCodeEmitter> Emitter); std::unique_ptr<MCCodeEmitter> Emitter);
bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override; bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override; unsigned ByteAlignment) override;
void EmitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr, void emitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
uint64_t Size = 0, unsigned ByteAlignment = 0, uint64_t Size = 0, unsigned ByteAlignment = 0,
SMLoc Loc = SMLoc()) override; SMLoc Loc = SMLoc()) override;
void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo &) override; void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo &) override;

View File

@ -75,7 +75,7 @@ void ARMException::endFunction(const MachineFunction *MF) {
// Emit references to personality. // Emit references to personality.
if (Per) { if (Per) {
MCSymbol *PerSym = Asm->getSymbol(Per); MCSymbol *PerSym = Asm->getSymbol(Per);
Asm->OutStreamer->EmitSymbolAttribute(PerSym, MCSA_Global); Asm->OutStreamer->emitSymbolAttribute(PerSym, MCSA_Global);
ATS.emitPersonality(PerSym); ATS.emitPersonality(PerSym);
} }

View File

@ -391,7 +391,7 @@ void Dwarf5AccelTableWriter<DataT>::Header::emit(
assert(AugmentationStringSize % 4 == 0); assert(AugmentationStringSize % 4 == 0);
Asm->emitInt32(AugmentationStringSize); Asm->emitInt32(AugmentationStringSize);
Asm->OutStreamer->AddComment("Header: augmentation string"); Asm->OutStreamer->AddComment("Header: augmentation string");
Asm->OutStreamer->EmitBytes({AugmentationString, AugmentationStringSize}); Asm->OutStreamer->emitBytes({AugmentationString, AugmentationStringSize});
} }
template <typename DataT> template <typename DataT>

View File

@ -277,7 +277,7 @@ bool AsmPrinter::doInitialization(Module &M) {
// use the directive, where it would need the same conditionalization // use the directive, where it would need the same conditionalization
// anyway. // anyway.
const Triple &Target = TM.getTargetTriple(); const Triple &Target = TM.getTargetTriple();
OutStreamer->EmitVersionForTarget(Target, M.getSDKVersion()); OutStreamer->emitVersionForTarget(Target, M.getSDKVersion());
// Allow the target to emit any magic that it wants at the start of the file. // Allow the target to emit any magic that it wants at the start of the file.
emitStartOfAsmFile(M); emitStartOfAsmFile(M);
@ -407,31 +407,31 @@ void AsmPrinter::emitLinkage(const GlobalValue *GV, MCSymbol *GVSym) const {
case GlobalValue::WeakODRLinkage: case GlobalValue::WeakODRLinkage:
if (MAI->hasWeakDefDirective()) { if (MAI->hasWeakDefDirective()) {
// .globl _foo // .globl _foo
OutStreamer->EmitSymbolAttribute(GVSym, MCSA_Global); OutStreamer->emitSymbolAttribute(GVSym, MCSA_Global);
if (!canBeHidden(GV, *MAI)) if (!canBeHidden(GV, *MAI))
// .weak_definition _foo // .weak_definition _foo
OutStreamer->EmitSymbolAttribute(GVSym, MCSA_WeakDefinition); OutStreamer->emitSymbolAttribute(GVSym, MCSA_WeakDefinition);
else else
OutStreamer->EmitSymbolAttribute(GVSym, MCSA_WeakDefAutoPrivate); OutStreamer->emitSymbolAttribute(GVSym, MCSA_WeakDefAutoPrivate);
} else if (MAI->hasLinkOnceDirective()) { } else if (MAI->hasLinkOnceDirective()) {
// .globl _foo // .globl _foo
OutStreamer->EmitSymbolAttribute(GVSym, MCSA_Global); OutStreamer->emitSymbolAttribute(GVSym, MCSA_Global);
//NOTE: linkonce is handled by the section the symbol was assigned to. //NOTE: linkonce is handled by the section the symbol was assigned to.
} else { } else {
// .weak _foo // .weak _foo
OutStreamer->EmitSymbolAttribute(GVSym, MCSA_Weak); OutStreamer->emitSymbolAttribute(GVSym, MCSA_Weak);
} }
return; return;
case GlobalValue::ExternalLinkage: case GlobalValue::ExternalLinkage:
// If external, declare as a global symbol: .globl _foo // If external, declare as a global symbol: .globl _foo
OutStreamer->EmitSymbolAttribute(GVSym, MCSA_Global); OutStreamer->emitSymbolAttribute(GVSym, MCSA_Global);
return; return;
case GlobalValue::PrivateLinkage: case GlobalValue::PrivateLinkage:
return; return;
case GlobalValue::InternalLinkage: case GlobalValue::InternalLinkage:
if (MAI->hasDotLGloblDirective()) if (MAI->hasDotLGloblDirective())
OutStreamer->EmitSymbolAttribute(GVSym, MCSA_LGlobal); OutStreamer->emitSymbolAttribute(GVSym, MCSA_LGlobal);
return; return;
case GlobalValue::AppendingLinkage: case GlobalValue::AppendingLinkage:
case GlobalValue::AvailableExternallyLinkage: case GlobalValue::AvailableExternallyLinkage:
@ -512,7 +512,7 @@ void AsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
"' is already defined"); "' is already defined");
if (MAI->hasDotTypeDotSizeDirective()) if (MAI->hasDotTypeDotSizeDirective())
OutStreamer->EmitSymbolAttribute(EmittedSym, MCSA_ELF_TypeObject); OutStreamer->emitSymbolAttribute(EmittedSym, MCSA_ELF_TypeObject);
SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GV, TM); SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GV, TM);
@ -537,7 +537,7 @@ void AsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
// .comm _foo, 42, 4 // .comm _foo, 42, 4
const bool SupportsAlignment = const bool SupportsAlignment =
getObjFileLowering().getCommDirectiveSupportsAlignment(); getObjFileLowering().getCommDirectiveSupportsAlignment();
OutStreamer->EmitCommonSymbol(GVSym, Size, OutStreamer->emitCommonSymbol(GVSym, Size,
SupportsAlignment ? Alignment.value() : 0); SupportsAlignment ? Alignment.value() : 0);
return; return;
} }
@ -553,7 +553,7 @@ void AsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
Size = 1; // zerofill of 0 bytes is undefined. Size = 1; // zerofill of 0 bytes is undefined.
emitLinkage(GV, GVSym); emitLinkage(GV, GVSym);
// .zerofill __DATA, __bss, _foo, 400, 5 // .zerofill __DATA, __bss, _foo, 400, 5
OutStreamer->EmitZerofill(TheSection, GVSym, Size, Alignment.value()); OutStreamer->emitZerofill(TheSection, GVSym, Size, Alignment.value());
return; return;
} }
@ -572,16 +572,16 @@ void AsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
// Prefer to simply fall back to .local / .comm in this case. // Prefer to simply fall back to .local / .comm in this case.
if (MAI->getLCOMMDirectiveAlignmentType() != LCOMM::NoAlignment) { if (MAI->getLCOMMDirectiveAlignmentType() != LCOMM::NoAlignment) {
// .lcomm _foo, 42 // .lcomm _foo, 42
OutStreamer->EmitLocalCommonSymbol(GVSym, Size, Alignment.value()); OutStreamer->emitLocalCommonSymbol(GVSym, Size, Alignment.value());
return; return;
} }
// .local _foo // .local _foo
OutStreamer->EmitSymbolAttribute(GVSym, MCSA_Local); OutStreamer->emitSymbolAttribute(GVSym, MCSA_Local);
// .comm _foo, 42, 4 // .comm _foo, 42, 4
const bool SupportsAlignment = const bool SupportsAlignment =
getObjFileLowering().getCommDirectiveSupportsAlignment(); getObjFileLowering().getCommDirectiveSupportsAlignment();
OutStreamer->EmitCommonSymbol(GVSym, Size, OutStreamer->emitCommonSymbol(GVSym, Size,
SupportsAlignment ? Alignment.value() : 0); SupportsAlignment ? Alignment.value() : 0);
return; return;
} }
@ -694,10 +694,10 @@ void AsmPrinter::emitFunctionHeader() {
emitAlignment(MF->getAlignment(), &F); emitAlignment(MF->getAlignment(), &F);
if (MAI->hasDotTypeDotSizeDirective()) if (MAI->hasDotTypeDotSizeDirective())
OutStreamer->EmitSymbolAttribute(CurrentFnSym, MCSA_ELF_TypeFunction); OutStreamer->emitSymbolAttribute(CurrentFnSym, MCSA_ELF_TypeFunction);
if (F.hasFnAttribute(Attribute::Cold)) if (F.hasFnAttribute(Attribute::Cold))
OutStreamer->EmitSymbolAttribute(CurrentFnSym, MCSA_Cold); OutStreamer->emitSymbolAttribute(CurrentFnSym, MCSA_Cold);
if (isVerbose()) { if (isVerbose()) {
F.printAsOperand(OutStreamer->GetCommentOS(), F.printAsOperand(OutStreamer->GetCommentOS(),
@ -718,7 +718,7 @@ void AsmPrinter::emitFunctionHeader() {
emitGlobalConstant(F.getParent()->getDataLayout(), F.getPrefixData()); emitGlobalConstant(F.getParent()->getDataLayout(), F.getPrefixData());
// Emit an .alt_entry directive for the actual function symbol. // Emit an .alt_entry directive for the actual function symbol.
OutStreamer->EmitSymbolAttribute(CurrentFnSym, MCSA_AltEntry); OutStreamer->emitSymbolAttribute(CurrentFnSym, MCSA_AltEntry);
} else { } else {
emitGlobalConstant(F.getParent()->getDataLayout(), F.getPrefixData()); emitGlobalConstant(F.getParent()->getDataLayout(), F.getPrefixData());
} }
@ -760,7 +760,7 @@ void AsmPrinter::emitFunctionHeader() {
if (MAI->useAssignmentForEHBegin()) { if (MAI->useAssignmentForEHBegin()) {
MCSymbol *CurPos = OutContext.createTempSymbol(); MCSymbol *CurPos = OutContext.createTempSymbol();
OutStreamer->EmitLabel(CurPos); OutStreamer->EmitLabel(CurPos);
OutStreamer->EmitAssignment(CurrentFnBegin, OutStreamer->emitAssignment(CurrentFnBegin,
MCSymbolRefExpr::create(CurPos, OutContext)); MCSymbolRefExpr::create(CurPos, OutContext));
} else { } else {
OutStreamer->EmitLabel(CurrentFnBegin); OutStreamer->EmitLabel(CurrentFnBegin);
@ -1022,7 +1022,7 @@ void AsmPrinter::emitFrameAlloc(const MachineInstr &MI) {
int FrameOffset = MI.getOperand(1).getImm(); int FrameOffset = MI.getOperand(1).getImm();
// Emit a symbol assignment. // Emit a symbol assignment.
OutStreamer->EmitAssignment(FrameAllocSym, OutStreamer->emitAssignment(FrameAllocSym,
MCConstantExpr::create(FrameOffset, OutContext)); MCConstantExpr::create(FrameOffset, OutContext));
} }
@ -1351,9 +1351,9 @@ void AsmPrinter::emitGlobalIndirectSymbol(Module &M,
MCSymbol *Name = getSymbol(&GIS); MCSymbol *Name = getSymbol(&GIS);
if (GIS.hasExternalLinkage() || !MAI->getWeakRefDirective()) if (GIS.hasExternalLinkage() || !MAI->getWeakRefDirective())
OutStreamer->EmitSymbolAttribute(Name, MCSA_Global); OutStreamer->emitSymbolAttribute(Name, MCSA_Global);
else if (GIS.hasWeakLinkage() || GIS.hasLinkOnceLinkage()) else if (GIS.hasWeakLinkage() || GIS.hasLinkOnceLinkage())
OutStreamer->EmitSymbolAttribute(Name, MCSA_WeakReference); OutStreamer->emitSymbolAttribute(Name, MCSA_WeakReference);
else else
assert(GIS.hasLocalLinkage() && "Invalid alias or ifunc linkage"); assert(GIS.hasLocalLinkage() && "Invalid alias or ifunc linkage");
@ -1370,7 +1370,7 @@ void AsmPrinter::emitGlobalIndirectSymbol(Module &M,
// Set the symbol type to function if the alias has a function type. // Set the symbol type to function if the alias has a function type.
// This affects codegen when the aliasee is not a function. // This affects codegen when the aliasee is not a function.
if (IsFunction) if (IsFunction)
OutStreamer->EmitSymbolAttribute(Name, isa<GlobalIFunc>(GIS) OutStreamer->emitSymbolAttribute(Name, isa<GlobalIFunc>(GIS)
? MCSA_ELF_TypeIndFunction ? MCSA_ELF_TypeIndFunction
: MCSA_ELF_TypeFunction); : MCSA_ELF_TypeFunction);
@ -1379,13 +1379,13 @@ void AsmPrinter::emitGlobalIndirectSymbol(Module &M,
const MCExpr *Expr = lowerConstant(GIS.getIndirectSymbol()); const MCExpr *Expr = lowerConstant(GIS.getIndirectSymbol());
if (isa<GlobalAlias>(&GIS) && MAI->hasAltEntry() && isa<MCBinaryExpr>(Expr)) if (isa<GlobalAlias>(&GIS) && MAI->hasAltEntry() && isa<MCBinaryExpr>(Expr))
OutStreamer->EmitSymbolAttribute(Name, MCSA_AltEntry); OutStreamer->emitSymbolAttribute(Name, MCSA_AltEntry);
// Emit the directives as assignments aka .set: // Emit the directives as assignments aka .set:
OutStreamer->EmitAssignment(Name, Expr); OutStreamer->emitAssignment(Name, Expr);
MCSymbol *LocalAlias = getSymbolPreferLocal(GIS); MCSymbol *LocalAlias = getSymbolPreferLocal(GIS);
if (LocalAlias != Name) if (LocalAlias != Name)
OutStreamer->EmitAssignment(LocalAlias, Expr); OutStreamer->emitAssignment(LocalAlias, Expr);
if (auto *GA = dyn_cast<GlobalAlias>(&GIS)) { if (auto *GA = dyn_cast<GlobalAlias>(&GIS)) {
// If the aliasee does not correspond to a symbol in the output, i.e. the // If the aliasee does not correspond to a symbol in the output, i.e. the
@ -1428,7 +1428,7 @@ void AsmPrinter::emitRemarksSection(remarks::RemarkStreamer &RS) {
OutContext.getObjectFileInfo()->getRemarksSection(); OutContext.getObjectFileInfo()->getRemarksSection();
OutStreamer->SwitchSection(RemarksSection); OutStreamer->SwitchSection(RemarksSection);
OutStreamer->EmitBinaryData(OS.str()); OutStreamer->emitBinaryData(OS.str());
} }
bool AsmPrinter::doFinalization(Module &M) { bool AsmPrinter::doFinalization(Module &M) {
@ -1509,7 +1509,7 @@ bool AsmPrinter::doFinalization(Module &M) {
SectionKind::getReadOnly(), Stub.first->getName(), SectionKind::getReadOnly(), Stub.first->getName(),
COFF::IMAGE_COMDAT_SELECT_ANY)); COFF::IMAGE_COMDAT_SELECT_ANY));
emitAlignment(Align(DL.getPointerSize())); emitAlignment(Align(DL.getPointerSize()));
OutStreamer->EmitSymbolAttribute(Stub.first, MCSA_Global); OutStreamer->emitSymbolAttribute(Stub.first, MCSA_Global);
OutStreamer->EmitLabel(Stub.first); OutStreamer->EmitLabel(Stub.first);
OutStreamer->EmitSymbolValue(Stub.second.getPointer(), OutStreamer->EmitSymbolValue(Stub.second.getPointer(),
DL.getPointerSize()); DL.getPointerSize());
@ -1537,7 +1537,7 @@ bool AsmPrinter::doFinalization(Module &M) {
for (const auto &GO : M.global_objects()) { for (const auto &GO : M.global_objects()) {
if (!GO.hasExternalWeakLinkage()) if (!GO.hasExternalWeakLinkage())
continue; continue;
OutStreamer->EmitSymbolAttribute(getSymbol(&GO), MCSA_WeakReference); OutStreamer->emitSymbolAttribute(getSymbol(&GO), MCSA_WeakReference);
} }
} }
@ -1618,7 +1618,7 @@ bool AsmPrinter::doFinalization(Module &M) {
OS.flush(); OS.flush();
if (!Flags.empty()) { if (!Flags.empty()) {
OutStreamer->SwitchSection(TLOF.getDrectveSection()); OutStreamer->SwitchSection(TLOF.getDrectveSection());
OutStreamer->EmitBytes(Flags); OutStreamer->emitBytes(Flags);
} }
Flags.clear(); Flags.clear();
} }
@ -1644,7 +1644,7 @@ bool AsmPrinter::doFinalization(Module &M) {
if (!Flags.empty()) { if (!Flags.empty()) {
OutStreamer->SwitchSection(TLOF.getDrectveSection()); OutStreamer->SwitchSection(TLOF.getDrectveSection());
OutStreamer->EmitBytes(Flags); OutStreamer->emitBytes(Flags);
} }
Flags.clear(); Flags.clear();
} }
@ -1672,7 +1672,7 @@ bool AsmPrinter::doFinalization(Module &M) {
OutStreamer->SwitchSection(OutContext.getELFSection( OutStreamer->SwitchSection(OutContext.getELFSection(
".llvm_sympart", ELF::SHT_LLVM_SYMPART, 0, 0, "", ++UniqueID)); ".llvm_sympart", ELF::SHT_LLVM_SYMPART, 0, 0, "", ++UniqueID));
OutStreamer->EmitBytes(GV.getPartition()); OutStreamer->emitBytes(GV.getPartition());
OutStreamer->EmitZeros(1); OutStreamer->EmitZeros(1);
OutStreamer->EmitValue( OutStreamer->EmitValue(
MCSymbolRefExpr::create(getSymbol(&GV), OutContext), MCSymbolRefExpr::create(getSymbol(&GV), OutContext),
@ -1875,7 +1875,7 @@ void AsmPrinter::emitJumpTableInfo() {
// Jump tables in code sections are marked with a data_region directive // Jump tables in code sections are marked with a data_region directive
// where that's supported. // where that's supported.
if (!JTInDiffSection) if (!JTInDiffSection)
OutStreamer->EmitDataRegion(MCDR_DataRegionJT32); OutStreamer->emitDataRegion(MCDR_DataRegionJT32);
for (unsigned JTI = 0, e = JT.size(); JTI != e; ++JTI) { for (unsigned JTI = 0, e = JT.size(); JTI != e; ++JTI) {
const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs; const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
@ -1898,7 +1898,7 @@ void AsmPrinter::emitJumpTableInfo() {
// .set LJTSet, LBB32-base // .set LJTSet, LBB32-base
const MCExpr *LHS = const MCExpr *LHS =
MCSymbolRefExpr::create(MBB->getSymbol(), OutContext); MCSymbolRefExpr::create(MBB->getSymbol(), OutContext);
OutStreamer->EmitAssignment(GetJTSetSymbol(JTI, MBB->getNumber()), OutStreamer->emitAssignment(GetJTSetSymbol(JTI, MBB->getNumber()),
MCBinaryExpr::createSub(LHS, Base, MCBinaryExpr::createSub(LHS, Base,
OutContext)); OutContext));
} }
@ -1925,7 +1925,7 @@ void AsmPrinter::emitJumpTableInfo() {
emitJumpTableEntry(MJTI, JTBBs[ii], JTI); emitJumpTableEntry(MJTI, JTBBs[ii], JTI);
} }
if (!JTInDiffSection) if (!JTInDiffSection)
OutStreamer->EmitDataRegion(MCDR_DataRegionEnd); OutStreamer->emitDataRegion(MCDR_DataRegionEnd);
} }
/// EmitJumpTableEntry - Emit a jump table entry for the specified MBB to the /// EmitJumpTableEntry - Emit a jump table entry for the specified MBB to the
@ -2036,7 +2036,7 @@ void AsmPrinter::emitLLVMUsedList(const ConstantArray *InitList) {
const GlobalValue *GV = const GlobalValue *GV =
dyn_cast<GlobalValue>(InitList->getOperand(i)->stripPointerCasts()); dyn_cast<GlobalValue>(InitList->getOperand(i)->stripPointerCasts());
if (GV) if (GV)
OutStreamer->EmitSymbolAttribute(getSymbol(GV), MCSA_NoDeadStrip); OutStreamer->emitSymbolAttribute(getSymbol(GV), MCSA_NoDeadStrip);
} }
} }
@ -2149,7 +2149,7 @@ void AsmPrinter::emitModuleCommandLines(Module &M) {
assert(N->getNumOperands() == 1 && assert(N->getNumOperands() == 1 &&
"llvm.commandline metadata entry can have only one operand"); "llvm.commandline metadata entry can have only one operand");
const MDString *S = cast<MDString>(N->getOperand(0)); const MDString *S = cast<MDString>(N->getOperand(0));
OutStreamer->EmitBytes(S->getString()); OutStreamer->emitBytes(S->getString());
OutStreamer->EmitZeros(1); OutStreamer->EmitZeros(1);
} }
OutStreamer->PopSection(); OutStreamer->PopSection();
@ -2456,7 +2456,7 @@ static void emitGlobalConstantDataSequential(const DataLayout &DL,
// If this can be emitted with .ascii/.asciz, emit it as such. // If this can be emitted with .ascii/.asciz, emit it as such.
if (CDS->isString()) if (CDS->isString())
return AP.OutStreamer->EmitBytes(CDS->getAsString()); return AP.OutStreamer->emitBytes(CDS->getAsString());
// Otherwise, emit the values in successive locations. // Otherwise, emit the values in successive locations.
unsigned ElementByteSize = CDS->getElementByteSize(); unsigned ElementByteSize = CDS->getElementByteSize();
@ -2877,7 +2877,7 @@ MCSymbol *AsmPrinter::GetCPISymbol(unsigned CPID) const {
getObjFileLowering().getSectionForConstant(DL, Kind, C, Align))) { getObjFileLowering().getSectionForConstant(DL, Kind, C, Align))) {
if (MCSymbol *Sym = S->getCOMDATSymbol()) { if (MCSymbol *Sym = S->getCOMDATSymbol()) {
if (Sym->isUndefined()) if (Sym->isUndefined())
OutStreamer->EmitSymbolAttribute(Sym, MCSA_Global); OutStreamer->emitSymbolAttribute(Sym, MCSA_Global);
return Sym; return Sym;
} }
} }
@ -3062,7 +3062,7 @@ void AsmPrinter::emitVisibility(MCSymbol *Sym, unsigned Visibility,
} }
if (Attr != MCSA_Invalid) if (Attr != MCSA_Invalid)
OutStreamer->EmitSymbolAttribute(Sym, Attr); OutStreamer->emitSymbolAttribute(Sym, Attr);
} }
/// isBlockOnlyReachableByFallthough - Return true if the basic block has /// isBlockOnlyReachableByFallthough - Return true if the basic block has
@ -3166,10 +3166,10 @@ void AsmPrinter::XRayFunctionEntry::emit(int Bytes, MCStreamer *Out,
Out->EmitSymbolValue(Sled, Bytes); Out->EmitSymbolValue(Sled, Bytes);
Out->EmitSymbolValue(CurrentFnSym, Bytes); Out->EmitSymbolValue(CurrentFnSym, Bytes);
auto Kind8 = static_cast<uint8_t>(Kind); auto Kind8 = static_cast<uint8_t>(Kind);
Out->EmitBinaryData(StringRef(reinterpret_cast<const char *>(&Kind8), 1)); Out->emitBinaryData(StringRef(reinterpret_cast<const char *>(&Kind8), 1));
Out->EmitBinaryData( Out->emitBinaryData(
StringRef(reinterpret_cast<const char *>(&AlwaysInstrument), 1)); StringRef(reinterpret_cast<const char *>(&AlwaysInstrument), 1));
Out->EmitBinaryData(StringRef(reinterpret_cast<const char *>(&Version), 1)); Out->emitBinaryData(StringRef(reinterpret_cast<const char *>(&Version), 1));
auto Padding = (4 * Bytes) - ((2 * Bytes) + 3); auto Padding = (4 * Bytes) - ((2 * Bytes) + 3);
assert(Padding >= 0 && "Instrumentation map entry > 4 * Word Size"); assert(Padding >= 0 && "Instrumentation map entry > 4 * Word Size");
Out->EmitZeros(Padding); Out->EmitZeros(Padding);

View File

@ -101,13 +101,13 @@ public:
CVMCAdapter(MCStreamer &OS, TypeCollection &TypeTable) CVMCAdapter(MCStreamer &OS, TypeCollection &TypeTable)
: OS(&OS), TypeTable(TypeTable) {} : OS(&OS), TypeTable(TypeTable) {}
void EmitBytes(StringRef Data) { OS->EmitBytes(Data); } void emitBytes(StringRef Data) { OS->emitBytes(Data); }
void EmitIntValue(uint64_t Value, unsigned Size) { void EmitIntValue(uint64_t Value, unsigned Size) {
OS->EmitIntValueInHex(Value, Size); OS->EmitIntValueInHex(Value, Size);
} }
void EmitBinaryData(StringRef Data) { OS->EmitBinaryData(Data); } void emitBinaryData(StringRef Data) { OS->emitBinaryData(Data); }
void AddComment(const Twine &T) { OS->AddComment(T); } void AddComment(const Twine &T) { OS->AddComment(T); }
@ -631,7 +631,7 @@ emitNullTerminatedSymbolName(MCStreamer &OS, StringRef S,
SmallString<32> NullTerminatedString( SmallString<32> NullTerminatedString(
S.take_front(MaxRecordLength - MaxFixedRecordLength - 1)); S.take_front(MaxRecordLength - MaxFixedRecordLength - 1));
NullTerminatedString.push_back('\0'); NullTerminatedString.push_back('\0');
OS.EmitBytes(NullTerminatedString); OS.emitBytes(NullTerminatedString);
} }
void CodeViewDebug::emitTypeInformation() { void CodeViewDebug::emitTypeInformation() {
@ -696,7 +696,7 @@ void CodeViewDebug::emitTypeGlobalHashes() {
assert(GHR.Hash.size() == 8); assert(GHR.Hash.size() == 8);
StringRef S(reinterpret_cast<const char *>(GHR.Hash.data()), StringRef S(reinterpret_cast<const char *>(GHR.Hash.data()),
GHR.Hash.size()); GHR.Hash.size());
OS.EmitBinaryData(S); OS.emitBinaryData(S);
} }
} }
@ -1095,7 +1095,7 @@ void CodeViewDebug::emitDebugInfoForFunction(const Function *GV,
// nice .asciz directive. // nice .asciz directive.
StringRef Str = cast<MDString>(MD)->getString(); StringRef Str = cast<MDString>(MD)->getString();
assert(Str.data()[Str.size()] == '\0' && "non-nullterminated MDString"); assert(Str.data()[Str.size()] == '\0' && "non-nullterminated MDString");
OS.EmitBytes(StringRef(Str.data(), Str.size() + 1)); OS.emitBytes(StringRef(Str.data(), Str.size() + 1));
} }
endSymbolRecord(AnnotEnd); endSymbolRecord(AnnotEnd);
} }
@ -3116,7 +3116,7 @@ void CodeViewDebug::emitDebugInfoForGlobal(const CVGlobalVariable &CVGV) {
CodeViewRecordIO IO(Writer); CodeViewRecordIO IO(Writer);
cantFail(IO.mapEncodedInteger(Val)); cantFail(IO.mapEncodedInteger(Val));
StringRef SRef((char *)data, Writer.getOffset()); StringRef SRef((char *)data, Writer.getOffset());
OS.EmitBinaryData(SRef); OS.emitBinaryData(SRef);
OS.AddComment("Name"); OS.AddComment("Name");
const DIScope *Scope = DIGV->getScope(); const DIScope *Scope = DIGV->getScope();

View File

@ -606,7 +606,7 @@ void DIEString::print(raw_ostream &O) const {
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
void DIEInlineString::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const { void DIEInlineString::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
if (Form == dwarf::DW_FORM_string) { if (Form == dwarf::DW_FORM_string) {
AP->OutStreamer->EmitBytes(S); AP->OutStreamer->emitBytes(S);
AP->emitInt8(0); AP->emitInt8(0);
return; return;
} }

View File

@ -2200,7 +2200,7 @@ void DwarfDebug::emitDebugPubSection(bool GnuStyle, StringRef Name,
} }
Asm->OutStreamer->AddComment("External Name"); Asm->OutStreamer->AddComment("External Name");
Asm->OutStreamer->EmitBytes(StringRef(Name, GI.getKeyLength() + 1)); Asm->OutStreamer->emitBytes(StringRef(Name, GI.getKeyLength() + 1));
} }
Asm->OutStreamer->AddComment("End Mark"); Asm->OutStreamer->AddComment("End Mark");
@ -2811,11 +2811,11 @@ void DwarfDebug::emitMacro(DIMacro &M) {
Asm->emitULEB128(M.getLine()); Asm->emitULEB128(M.getLine());
StringRef Name = M.getName(); StringRef Name = M.getName();
StringRef Value = M.getValue(); StringRef Value = M.getValue();
Asm->OutStreamer->EmitBytes(Name); Asm->OutStreamer->emitBytes(Name);
if (!Value.empty()) { if (!Value.empty()) {
// There should be one space between macro name and macro value. // There should be one space between macro name and macro value.
Asm->emitInt8(' '); Asm->emitInt8(' ');
Asm->OutStreamer->EmitBytes(Value); Asm->OutStreamer->emitBytes(Value);
} }
Asm->emitInt8('\0'); Asm->emitInt8('\0');
} }

View File

@ -105,7 +105,7 @@ void DwarfStringPool::emit(AsmPrinter &Asm, MCSection *StrSection,
// Emit the string itself with a terminating null byte. // Emit the string itself with a terminating null byte.
Asm.OutStreamer->AddComment("string offset=" + Asm.OutStreamer->AddComment("string offset=" +
Twine(Entry->getValue().Offset)); Twine(Entry->getValue().Offset));
Asm.OutStreamer->EmitBytes( Asm.OutStreamer->emitBytes(
StringRef(Entry->getKeyData(), Entry->getKeyLength() + 1)); StringRef(Entry->getKeyData(), Entry->getKeyLength() + 1));
} }

View File

@ -66,7 +66,7 @@ static void EmitCamlGlobal(const Module &M, AsmPrinter &AP, const char *Id) {
MCSymbol *Sym = AP.OutContext.getOrCreateSymbol(TmpStr); MCSymbol *Sym = AP.OutContext.getOrCreateSymbol(TmpStr);
AP.OutStreamer->EmitSymbolAttribute(Sym, MCSA_Global); AP.OutStreamer->emitSymbolAttribute(Sym, MCSA_Global);
AP.OutStreamer->EmitLabel(Sym); AP.OutStreamer->EmitLabel(Sym);
} }

View File

@ -566,7 +566,7 @@ void WinException::emitCSpecificHandlerTable(const MachineFunction *MF) {
Ctx.getOrCreateParentFrameOffsetSymbol(FLinkageName); Ctx.getOrCreateParentFrameOffsetSymbol(FLinkageName);
const MCExpr *MCOffset = const MCExpr *MCOffset =
MCConstantExpr::create(FuncInfo.SEHSetFrameOffset, Ctx); MCConstantExpr::create(FuncInfo.SEHSetFrameOffset, Ctx);
Asm->OutStreamer->EmitAssignment(ParentFrameOffset, MCOffset); Asm->OutStreamer->emitAssignment(ParentFrameOffset, MCOffset);
} }
// Use the assembler to compute the number of table entries through label // Use the assembler to compute the number of table entries through label
@ -956,7 +956,7 @@ void WinException::emitEHRegistrationOffsetLabel(const WinEHFuncInfo &FuncInfo,
MCContext &Ctx = Asm->OutContext; MCContext &Ctx = Asm->OutContext;
MCSymbol *ParentFrameOffset = MCSymbol *ParentFrameOffset =
Ctx.getOrCreateParentFrameOffsetSymbol(FLinkageName); Ctx.getOrCreateParentFrameOffsetSymbol(FLinkageName);
Asm->OutStreamer->EmitAssignment(ParentFrameOffset, Asm->OutStreamer->emitAssignment(ParentFrameOffset,
MCConstantExpr::create(Offset, Ctx)); MCConstantExpr::create(Offset, Ctx));
} }

View File

@ -277,7 +277,7 @@ void TargetLoweringObjectFileELF::emitModuleMetadata(MCStreamer &Streamer,
if (cast<MDNode>(Operand)->getNumOperands() != 2) if (cast<MDNode>(Operand)->getNumOperands() != 2)
report_fatal_error("invalid llvm.linker.options"); report_fatal_error("invalid llvm.linker.options");
for (const auto &Option : cast<MDNode>(Operand)->operands()) { for (const auto &Option : cast<MDNode>(Operand)->operands()) {
Streamer.EmitBytes(cast<MDString>(Option)->getString()); Streamer.emitBytes(cast<MDString>(Option)->getString());
Streamer.EmitIntValue(0, 1); Streamer.EmitIntValue(0, 1);
} }
} }
@ -290,7 +290,7 @@ void TargetLoweringObjectFileELF::emitModuleMetadata(MCStreamer &Streamer,
Streamer.SwitchSection(S); Streamer.SwitchSection(S);
for (const auto *Operand : DependentLibraries->operands()) { for (const auto *Operand : DependentLibraries->operands()) {
Streamer.EmitBytes( Streamer.emitBytes(
cast<MDString>(cast<MDNode>(Operand)->getOperand(0))->getString()); cast<MDString>(cast<MDNode>(Operand)->getOperand(0))->getString());
Streamer.EmitIntValue(0, 1); Streamer.EmitIntValue(0, 1);
} }
@ -370,15 +370,15 @@ void TargetLoweringObjectFileELF::emitPersonalityValue(
NameData += Sym->getName(); NameData += Sym->getName();
MCSymbolELF *Label = MCSymbolELF *Label =
cast<MCSymbolELF>(getContext().getOrCreateSymbol(NameData)); cast<MCSymbolELF>(getContext().getOrCreateSymbol(NameData));
Streamer.EmitSymbolAttribute(Label, MCSA_Hidden); Streamer.emitSymbolAttribute(Label, MCSA_Hidden);
Streamer.EmitSymbolAttribute(Label, MCSA_Weak); Streamer.emitSymbolAttribute(Label, MCSA_Weak);
unsigned Flags = ELF::SHF_ALLOC | ELF::SHF_WRITE | ELF::SHF_GROUP; unsigned Flags = ELF::SHF_ALLOC | ELF::SHF_WRITE | ELF::SHF_GROUP;
MCSection *Sec = getContext().getELFNamedSection(".data", Label->getName(), MCSection *Sec = getContext().getELFNamedSection(".data", Label->getName(),
ELF::SHT_PROGBITS, Flags, 0); ELF::SHT_PROGBITS, Flags, 0);
unsigned Size = DL.getPointerSize(); unsigned Size = DL.getPointerSize();
Streamer.SwitchSection(Sec); Streamer.SwitchSection(Sec);
Streamer.EmitValueToAlignment(DL.getPointerABIAlignment(0).value()); Streamer.EmitValueToAlignment(DL.getPointerABIAlignment(0).value());
Streamer.EmitSymbolAttribute(Label, MCSA_ELF_TypeObject); Streamer.emitSymbolAttribute(Label, MCSA_ELF_TypeObject);
const MCExpr *E = MCConstantExpr::create(Size, getContext()); const MCExpr *E = MCConstantExpr::create(Size, getContext());
Streamer.emitELFSize(Label, E); Streamer.emitELFSize(Label, E);
Streamer.EmitLabel(Label); Streamer.EmitLabel(Label);
@ -889,7 +889,7 @@ void TargetLoweringObjectFileMachO::emitModuleMetadata(MCStreamer &Streamer,
SmallVector<std::string, 4> StrOptions; SmallVector<std::string, 4> StrOptions;
for (const auto &Piece : cast<MDNode>(Option)->operands()) for (const auto &Piece : cast<MDNode>(Option)->operands())
StrOptions.push_back(std::string(cast<MDString>(Piece)->getString())); StrOptions.push_back(std::string(cast<MDString>(Piece)->getString()));
Streamer.EmitLinkerOptions(StrOptions); Streamer.emitLinkerOptions(StrOptions);
} }
} }
@ -1454,7 +1454,7 @@ void TargetLoweringObjectFileCOFF::emitModuleMetadata(MCStreamer &Streamer,
// Lead with a space for consistency with our dllexport implementation. // Lead with a space for consistency with our dllexport implementation.
std::string Directive(" "); std::string Directive(" ");
Directive.append(std::string(cast<MDString>(Piece)->getString())); Directive.append(std::string(cast<MDString>(Piece)->getString()));
Streamer.EmitBytes(Directive); Streamer.emitBytes(Directive);
} }
} }
} }

View File

@ -46,7 +46,7 @@ Error CodeViewRecordIO::endRecord() {
while (PaddingBytes > 0) { while (PaddingBytes > 0) {
char Pad = static_cast<uint8_t>(LF_PAD0 + PaddingBytes); char Pad = static_cast<uint8_t>(LF_PAD0 + PaddingBytes);
StringRef BytesSR = StringRef(&Pad, sizeof(Pad)); StringRef BytesSR = StringRef(&Pad, sizeof(Pad));
Streamer->EmitBytes(BytesSR); Streamer->emitBytes(BytesSR);
--PaddingBytes; --PaddingBytes;
} }
resetStreamedLen(); resetStreamedLen();
@ -101,7 +101,7 @@ Error CodeViewRecordIO::mapByteVectorTail(ArrayRef<uint8_t> &Bytes,
const Twine &Comment) { const Twine &Comment) {
if (isStreaming()) { if (isStreaming()) {
emitComment(Comment); emitComment(Comment);
Streamer->EmitBinaryData(toStringRef(Bytes)); Streamer->emitBinaryData(toStringRef(Bytes));
incrStreamedLen(Bytes.size()); incrStreamedLen(Bytes.size());
} else if (isWriting()) { } else if (isWriting()) {
if (auto EC = Writer->writeBytes(Bytes)) if (auto EC = Writer->writeBytes(Bytes))
@ -205,7 +205,7 @@ Error CodeViewRecordIO::mapStringZ(StringRef &Value, const Twine &Comment) {
if (isStreaming()) { if (isStreaming()) {
auto NullTerminatedString = StringRef(Value.data(), Value.size() + 1); auto NullTerminatedString = StringRef(Value.data(), Value.size() + 1);
emitComment(Comment); emitComment(Comment);
Streamer->EmitBytes(NullTerminatedString); Streamer->emitBytes(NullTerminatedString);
incrStreamedLen(NullTerminatedString.size()); incrStreamedLen(NullTerminatedString.size());
} else if (isWriting()) { } else if (isWriting()) {
// Truncate if we attempt to write too much. // Truncate if we attempt to write too much.
@ -226,7 +226,7 @@ Error CodeViewRecordIO::mapGuid(GUID &Guid, const Twine &Comment) {
StringRef GuidSR = StringRef GuidSR =
StringRef((reinterpret_cast<const char *>(&Guid)), GuidSize); StringRef((reinterpret_cast<const char *>(&Guid)), GuidSize);
emitComment(Comment); emitComment(Comment);
Streamer->EmitBytes(GuidSR); Streamer->emitBytes(GuidSR);
incrStreamedLen(GuidSize); incrStreamedLen(GuidSize);
return Error::success(); return Error::success();
} }

View File

@ -26,13 +26,13 @@ using namespace llvm;
void ConstantPool::emitEntries(MCStreamer &Streamer) { void ConstantPool::emitEntries(MCStreamer &Streamer) {
if (Entries.empty()) if (Entries.empty())
return; return;
Streamer.EmitDataRegion(MCDR_DataRegion); Streamer.emitDataRegion(MCDR_DataRegion);
for (const ConstantPoolEntry &Entry : Entries) { for (const ConstantPoolEntry &Entry : Entries) {
Streamer.EmitCodeAlignment(Entry.Size); // align naturally Streamer.EmitCodeAlignment(Entry.Size); // align naturally
Streamer.EmitLabel(Entry.Label); Streamer.EmitLabel(Entry.Label);
Streamer.EmitValue(Entry.Value, Entry.Size, Entry.Loc); Streamer.EmitValue(Entry.Value, Entry.Size, Entry.Loc);
} }
Streamer.EmitDataRegion(MCDR_DataRegionEnd); Streamer.emitDataRegion(MCDR_DataRegionEnd);
Entries.clear(); Entries.clear();
} }

View File

@ -140,23 +140,23 @@ public:
void emitELFSymverDirective(StringRef AliasName, void emitELFSymverDirective(StringRef AliasName,
const MCSymbol *Aliasee) override; const MCSymbol *Aliasee) override;
void EmitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) override; void emitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) override;
void EmitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override; void EmitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override;
void EmitAssemblerFlag(MCAssemblerFlag Flag) override; void emitAssemblerFlag(MCAssemblerFlag Flag) override;
void EmitLinkerOptions(ArrayRef<std::string> Options) override; void emitLinkerOptions(ArrayRef<std::string> Options) override;
void EmitDataRegion(MCDataRegionType Kind) override; void emitDataRegion(MCDataRegionType Kind) override;
void EmitVersionMin(MCVersionMinType Kind, unsigned Major, unsigned Minor, void emitVersionMin(MCVersionMinType Kind, unsigned Major, unsigned Minor,
unsigned Update, VersionTuple SDKVersion) override; unsigned Update, VersionTuple SDKVersion) override;
void EmitBuildVersion(unsigned Platform, unsigned Major, unsigned Minor, void emitBuildVersion(unsigned Platform, unsigned Major, unsigned Minor,
unsigned Update, VersionTuple SDKVersion) override; unsigned Update, VersionTuple SDKVersion) override;
void EmitThumbFunc(MCSymbol *Func) override; void emitThumbFunc(MCSymbol *Func) override;
void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) override; void emitAssignment(MCSymbol *Symbol, const MCExpr *Value) override;
void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override; void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override;
bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override; bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override; void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override;
void BeginCOFFSymbolDef(const MCSymbol *Symbol) override; void BeginCOFFSymbolDef(const MCSymbol *Symbol) override;
void EmitCOFFSymbolStorageClass(int StorageClass) override; void EmitCOFFSymbolStorageClass(int StorageClass) override;
void EmitCOFFSymbolType(int Type) override; void EmitCOFFSymbolType(int Type) override;
@ -170,7 +170,7 @@ public:
MCSymbol *CsectSym, MCSymbol *CsectSym,
unsigned ByteAlign) override; unsigned ByteAlign) override;
void emitELFSize(MCSymbol *Symbol, const MCExpr *Value) override; void emitELFSize(MCSymbol *Symbol, const MCExpr *Value) override;
void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override; unsigned ByteAlignment) override;
/// Emit a local common (.lcomm) symbol. /// Emit a local common (.lcomm) symbol.
@ -178,19 +178,19 @@ public:
/// @param Symbol - The common symbol to emit. /// @param Symbol - The common symbol to emit.
/// @param Size - The size of the common symbol. /// @param Size - The size of the common symbol.
/// @param ByteAlignment - The alignment of the common symbol in bytes. /// @param ByteAlignment - The alignment of the common symbol in bytes.
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, void emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override; unsigned ByteAlignment) override;
void EmitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr, void emitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
uint64_t Size = 0, unsigned ByteAlignment = 0, uint64_t Size = 0, unsigned ByteAlignment = 0,
SMLoc Loc = SMLoc()) override; SMLoc Loc = SMLoc()) override;
void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size, void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment = 0) override; unsigned ByteAlignment = 0) override;
void EmitBinaryData(StringRef Data) override; void emitBinaryData(StringRef Data) override;
void EmitBytes(StringRef Data) override; void emitBytes(StringRef Data) override;
void EmitValueImpl(const MCExpr *Value, unsigned Size, void EmitValueImpl(const MCExpr *Value, unsigned Size,
SMLoc Loc = SMLoc()) override; SMLoc Loc = SMLoc()) override;
@ -473,7 +473,7 @@ void MCAsmStreamer::EmitLabel(MCSymbol *Symbol, SMLoc Loc) {
EmitEOL(); EmitEOL();
} }
void MCAsmStreamer::EmitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) { void MCAsmStreamer::emitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) {
StringRef str = MCLOHIdToName(Kind); StringRef str = MCLOHIdToName(Kind);
#ifndef NDEBUG #ifndef NDEBUG
@ -493,7 +493,7 @@ void MCAsmStreamer::EmitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) {
EmitEOL(); EmitEOL();
} }
void MCAsmStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) { void MCAsmStreamer::emitAssemblerFlag(MCAssemblerFlag Flag) {
switch (Flag) { switch (Flag) {
case MCAF_SyntaxUnified: OS << "\t.syntax unified"; break; case MCAF_SyntaxUnified: OS << "\t.syntax unified"; break;
case MCAF_SubsectionsViaSymbols: OS << ".subsections_via_symbols"; break; case MCAF_SubsectionsViaSymbols: OS << ".subsections_via_symbols"; break;
@ -504,7 +504,7 @@ void MCAsmStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
EmitEOL(); EmitEOL();
} }
void MCAsmStreamer::EmitLinkerOptions(ArrayRef<std::string> Options) { void MCAsmStreamer::emitLinkerOptions(ArrayRef<std::string> Options) {
assert(!Options.empty() && "At least one option is required!"); assert(!Options.empty() && "At least one option is required!");
OS << "\t.linker_option \"" << Options[0] << '"'; OS << "\t.linker_option \"" << Options[0] << '"';
for (ArrayRef<std::string>::iterator it = Options.begin() + 1, for (ArrayRef<std::string>::iterator it = Options.begin() + 1,
@ -514,7 +514,7 @@ void MCAsmStreamer::EmitLinkerOptions(ArrayRef<std::string> Options) {
EmitEOL(); EmitEOL();
} }
void MCAsmStreamer::EmitDataRegion(MCDataRegionType Kind) { void MCAsmStreamer::emitDataRegion(MCDataRegionType Kind) {
if (!MAI->doesSupportDataRegionDirectives()) if (!MAI->doesSupportDataRegionDirectives())
return; return;
switch (Kind) { switch (Kind) {
@ -550,7 +550,7 @@ static void EmitSDKVersionSuffix(raw_ostream &OS,
} }
} }
void MCAsmStreamer::EmitVersionMin(MCVersionMinType Type, unsigned Major, void MCAsmStreamer::emitVersionMin(MCVersionMinType Type, unsigned Major,
unsigned Minor, unsigned Update, unsigned Minor, unsigned Update,
VersionTuple SDKVersion) { VersionTuple SDKVersion) {
OS << '\t' << getVersionMinDirective(Type) << ' ' << Major << ", " << Minor; OS << '\t' << getVersionMinDirective(Type) << ' ' << Major << ", " << Minor;
@ -575,7 +575,7 @@ static const char *getPlatformName(MachO::PlatformType Type) {
llvm_unreachable("Invalid Mach-O platform type"); llvm_unreachable("Invalid Mach-O platform type");
} }
void MCAsmStreamer::EmitBuildVersion(unsigned Platform, unsigned Major, void MCAsmStreamer::emitBuildVersion(unsigned Platform, unsigned Major,
unsigned Minor, unsigned Update, unsigned Minor, unsigned Update,
VersionTuple SDKVersion) { VersionTuple SDKVersion) {
const char *PlatformName = getPlatformName((MachO::PlatformType)Platform); const char *PlatformName = getPlatformName((MachO::PlatformType)Platform);
@ -586,7 +586,7 @@ void MCAsmStreamer::EmitBuildVersion(unsigned Platform, unsigned Major,
EmitEOL(); EmitEOL();
} }
void MCAsmStreamer::EmitThumbFunc(MCSymbol *Func) { void MCAsmStreamer::emitThumbFunc(MCSymbol *Func) {
// This needs to emit to a temporary string to get properly quoted // This needs to emit to a temporary string to get properly quoted
// MCSymbols when they have spaces in them. // MCSymbols when they have spaces in them.
OS << "\t.thumb_func"; OS << "\t.thumb_func";
@ -598,7 +598,7 @@ void MCAsmStreamer::EmitThumbFunc(MCSymbol *Func) {
EmitEOL(); EmitEOL();
} }
void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) { void MCAsmStreamer::emitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
// Do not emit a .set on inlined target assignments. // Do not emit a .set on inlined target assignments.
bool EmitSet = true; bool EmitSet = true;
if (auto *E = dyn_cast<MCTargetExpr>(Value)) if (auto *E = dyn_cast<MCTargetExpr>(Value))
@ -613,10 +613,10 @@ void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
EmitEOL(); EmitEOL();
} }
MCStreamer::EmitAssignment(Symbol, Value); MCStreamer::emitAssignment(Symbol, Value);
} }
void MCAsmStreamer::EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) { void MCAsmStreamer::emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) {
OS << ".weakref "; OS << ".weakref ";
Alias->print(OS, MAI); Alias->print(OS, MAI);
OS << ", "; OS << ", ";
@ -624,7 +624,7 @@ void MCAsmStreamer::EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) {
EmitEOL(); EmitEOL();
} }
bool MCAsmStreamer::EmitSymbolAttribute(MCSymbol *Symbol, bool MCAsmStreamer::emitSymbolAttribute(MCSymbol *Symbol,
MCSymbolAttr Attribute) { MCSymbolAttr Attribute) {
switch (Attribute) { switch (Attribute) {
case MCSA_Invalid: llvm_unreachable("Invalid symbol attribute"); case MCSA_Invalid: llvm_unreachable("Invalid symbol attribute");
@ -691,7 +691,7 @@ bool MCAsmStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
return true; return true;
} }
void MCAsmStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) { void MCAsmStreamer::emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {
OS << ".desc" << ' '; OS << ".desc" << ' ';
Symbol->print(OS, MAI); Symbol->print(OS, MAI);
OS << ',' << DescValue; OS << ',' << DescValue;
@ -795,7 +795,7 @@ void MCAsmStreamer::emitELFSize(MCSymbol *Symbol, const MCExpr *Value) {
EmitEOL(); EmitEOL();
} }
void MCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, void MCAsmStreamer::emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) { unsigned ByteAlignment) {
OS << "\t.comm\t"; OS << "\t.comm\t";
Symbol->print(OS, MAI); Symbol->print(OS, MAI);
@ -810,7 +810,7 @@ void MCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
EmitEOL(); EmitEOL();
} }
void MCAsmStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, void MCAsmStreamer::emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlign) { unsigned ByteAlign) {
OS << "\t.lcomm\t"; OS << "\t.lcomm\t";
Symbol->print(OS, MAI); Symbol->print(OS, MAI);
@ -832,7 +832,7 @@ void MCAsmStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
EmitEOL(); EmitEOL();
} }
void MCAsmStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol, void MCAsmStreamer::emitZerofill(MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment, uint64_t Size, unsigned ByteAlignment,
SMLoc Loc) { SMLoc Loc) {
if (Symbol) if (Symbol)
@ -918,7 +918,7 @@ static void PrintQuotedString(StringRef Data, raw_ostream &OS) {
OS << '"'; OS << '"';
} }
void MCAsmStreamer::EmitBytes(StringRef Data) { void MCAsmStreamer::emitBytes(StringRef Data) {
assert(getCurrentSectionOnly() && assert(getCurrentSectionOnly() &&
"Cannot emit contents before setting section!"); "Cannot emit contents before setting section!");
if (Data.empty()) return; if (Data.empty()) return;
@ -952,7 +952,7 @@ void MCAsmStreamer::EmitBytes(StringRef Data) {
EmitEOL(); EmitEOL();
} }
void MCAsmStreamer::EmitBinaryData(StringRef Data) { void MCAsmStreamer::emitBinaryData(StringRef Data) {
// This is binary data. Print it in a grid of hex bytes for readability. // This is binary data. Print it in a grid of hex bytes for readability.
const size_t Cols = 4; const size_t Cols = 4;
for (size_t I = 0, EI = alignTo(Data.size(), Cols); I < EI; I += Cols) { for (size_t I = 0, EI = alignTo(Data.size(), Cols); I < EI; I += Cols) {

View File

@ -209,7 +209,7 @@ void CodeViewContext::emitFileChecksums(MCObjectStreamer &OS) {
// user-provided file number. Each entry may be a variable number of bytes // user-provided file number. Each entry may be a variable number of bytes
// determined by the checksum kind and size. // determined by the checksum kind and size.
for (auto File : Files) { for (auto File : Files) {
OS.EmitAssignment(File.ChecksumTableOffset, OS.emitAssignment(File.ChecksumTableOffset,
MCConstantExpr::create(CurrentOffset, Ctx)); MCConstantExpr::create(CurrentOffset, Ctx));
CurrentOffset += 4; // String table offset. CurrentOffset += 4; // String table offset.
if (!File.ChecksumKind) { if (!File.ChecksumKind) {
@ -231,7 +231,7 @@ void CodeViewContext::emitFileChecksums(MCObjectStreamer &OS) {
} }
OS.EmitIntValue(static_cast<uint8_t>(File.Checksum.size()), 1); OS.EmitIntValue(static_cast<uint8_t>(File.Checksum.size()), 1);
OS.EmitIntValue(File.ChecksumKind, 1); OS.EmitIntValue(File.ChecksumKind, 1);
OS.EmitBytes(toStringRef(File.Checksum)); OS.emitBytes(toStringRef(File.Checksum));
OS.EmitValueToAlignment(4); OS.EmitValueToAlignment(4);
} }

View File

@ -272,7 +272,7 @@ void MCContext::setSymbolValue(MCStreamer &Streamer,
StringRef Sym, StringRef Sym,
uint64_t Val) { uint64_t Val) {
auto Symbol = getOrCreateSymbol(Sym); auto Symbol = getOrCreateSymbol(Sym);
Streamer.EmitAssignment(Symbol, MCConstantExpr::create(Val, *this)); Streamer.emitAssignment(Symbol, MCConstantExpr::create(Val, *this));
} }
void MCContext::registerInlineAsmLabel(MCSymbol *Sym) { void MCContext::registerInlineAsmLabel(MCSymbol *Sym) {

View File

@ -298,7 +298,7 @@ static const MCExpr *forceExpAbs(MCStreamer &OS, const MCExpr* Expr) {
return Expr; return Expr;
MCSymbol *ABS = Context.createTempSymbol(); MCSymbol *ABS = Context.createTempSymbol();
OS.EmitAssignment(ABS, Expr); OS.emitAssignment(ABS, Expr);
return MCSymbolRefExpr::create(ABS, Context); return MCSymbolRefExpr::create(ABS, Context);
} }
@ -316,7 +316,7 @@ void MCDwarfLineStr::emitSection(MCStreamer *MCOS) {
SmallString<0> Data; SmallString<0> Data;
Data.resize(LineStrings.getSize()); Data.resize(LineStrings.getSize());
LineStrings.write((uint8_t *)Data.data()); LineStrings.write((uint8_t *)Data.data());
MCOS->EmitBinaryData(Data.str()); MCOS->emitBinaryData(Data.str());
} }
void MCDwarfLineStr::emitRef(MCStreamer *MCOS, StringRef Path) { void MCDwarfLineStr::emitRef(MCStreamer *MCOS, StringRef Path) {
@ -332,16 +332,16 @@ void MCDwarfLineStr::emitRef(MCStreamer *MCOS, StringRef Path) {
void MCDwarfLineTableHeader::emitV2FileDirTables(MCStreamer *MCOS) const { void MCDwarfLineTableHeader::emitV2FileDirTables(MCStreamer *MCOS) const {
// First the directory table. // First the directory table.
for (auto &Dir : MCDwarfDirs) { for (auto &Dir : MCDwarfDirs) {
MCOS->EmitBytes(Dir); // The DirectoryName, and... MCOS->emitBytes(Dir); // The DirectoryName, and...
MCOS->EmitBytes(StringRef("\0", 1)); // its null terminator. MCOS->emitBytes(StringRef("\0", 1)); // its null terminator.
} }
MCOS->EmitIntValue(0, 1); // Terminate the directory list. MCOS->EmitIntValue(0, 1); // Terminate the directory list.
// Second the file table. // Second the file table.
for (unsigned i = 1; i < MCDwarfFiles.size(); i++) { for (unsigned i = 1; i < MCDwarfFiles.size(); i++) {
assert(!MCDwarfFiles[i].Name.empty()); assert(!MCDwarfFiles[i].Name.empty());
MCOS->EmitBytes(MCDwarfFiles[i].Name); // FileName and... MCOS->emitBytes(MCDwarfFiles[i].Name); // FileName and...
MCOS->EmitBytes(StringRef("\0", 1)); // its null terminator. MCOS->emitBytes(StringRef("\0", 1)); // its null terminator.
MCOS->emitULEB128IntValue(MCDwarfFiles[i].DirIndex); // Directory number. MCOS->emitULEB128IntValue(MCDwarfFiles[i].DirIndex); // Directory number.
MCOS->EmitIntValue(0, 1); // Last modification timestamp (always 0). MCOS->EmitIntValue(0, 1); // Last modification timestamp (always 0).
MCOS->EmitIntValue(0, 1); // File size (always 0). MCOS->EmitIntValue(0, 1); // File size (always 0).
@ -356,13 +356,13 @@ static void emitOneV5FileEntry(MCStreamer *MCOS, const MCDwarfFile &DwarfFile,
if (LineStr) if (LineStr)
LineStr->emitRef(MCOS, DwarfFile.Name); LineStr->emitRef(MCOS, DwarfFile.Name);
else { else {
MCOS->EmitBytes(DwarfFile.Name); // FileName and... MCOS->emitBytes(DwarfFile.Name); // FileName and...
MCOS->EmitBytes(StringRef("\0", 1)); // its null terminator. MCOS->emitBytes(StringRef("\0", 1)); // its null terminator.
} }
MCOS->emitULEB128IntValue(DwarfFile.DirIndex); // Directory number. MCOS->emitULEB128IntValue(DwarfFile.DirIndex); // Directory number.
if (EmitMD5) { if (EmitMD5) {
const MD5::MD5Result &Cksum = *DwarfFile.Checksum; const MD5::MD5Result &Cksum = *DwarfFile.Checksum;
MCOS->EmitBinaryData( MCOS->emitBinaryData(
StringRef(reinterpret_cast<const char *>(Cksum.Bytes.data()), StringRef(reinterpret_cast<const char *>(Cksum.Bytes.data()),
Cksum.Bytes.size())); Cksum.Bytes.size()));
} }
@ -370,9 +370,9 @@ static void emitOneV5FileEntry(MCStreamer *MCOS, const MCDwarfFile &DwarfFile,
if (LineStr) if (LineStr)
LineStr->emitRef(MCOS, DwarfFile.Source.getValueOr(StringRef())); LineStr->emitRef(MCOS, DwarfFile.Source.getValueOr(StringRef()));
else { else {
MCOS->EmitBytes( MCOS->emitBytes(
DwarfFile.Source.getValueOr(StringRef())); // Source and... DwarfFile.Source.getValueOr(StringRef())); // Source and...
MCOS->EmitBytes(StringRef("\0", 1)); // its null terminator. MCOS->emitBytes(StringRef("\0", 1)); // its null terminator.
} }
} }
} }
@ -398,11 +398,11 @@ void MCDwarfLineTableHeader::emitV5FileDirTables(
LineStr->emitRef(MCOS, Dir); LineStr->emitRef(MCOS, Dir);
} else { } else {
// The list of directory paths. Compilation directory comes first. // The list of directory paths. Compilation directory comes first.
MCOS->EmitBytes(CompDir); MCOS->emitBytes(CompDir);
MCOS->EmitBytes(StringRef("\0", 1)); MCOS->emitBytes(StringRef("\0", 1));
for (const auto &Dir : MCDwarfDirs) { for (const auto &Dir : MCDwarfDirs) {
MCOS->EmitBytes(Dir); // The DirectoryName, and... MCOS->emitBytes(Dir); // The DirectoryName, and...
MCOS->EmitBytes(StringRef("\0", 1)); // its null terminator. MCOS->emitBytes(StringRef("\0", 1)); // its null terminator.
} }
} }
@ -647,7 +647,7 @@ void MCDwarfLineAddr::Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
SmallString<256> Tmp; SmallString<256> Tmp;
raw_svector_ostream OS(Tmp); raw_svector_ostream OS(Tmp);
MCDwarfLineAddr::Encode(Context, Params, LineDelta, AddrDelta, OS); MCDwarfLineAddr::Encode(Context, Params, LineDelta, AddrDelta, OS);
MCOS->EmitBytes(OS.str()); MCOS->emitBytes(OS.str());
} }
/// Given a special op, return the address skip amount (in units of /// Given a special op, return the address skip amount (in units of
@ -1013,8 +1013,8 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
// and file table entries. // and file table entries.
const SmallVectorImpl<std::string> &MCDwarfDirs = context.getMCDwarfDirs(); const SmallVectorImpl<std::string> &MCDwarfDirs = context.getMCDwarfDirs();
if (MCDwarfDirs.size() > 0) { if (MCDwarfDirs.size() > 0) {
MCOS->EmitBytes(MCDwarfDirs[0]); MCOS->emitBytes(MCDwarfDirs[0]);
MCOS->EmitBytes(sys::path::get_separator()); MCOS->emitBytes(sys::path::get_separator());
} }
const SmallVectorImpl<MCDwarfFile> &MCDwarfFiles = context.getMCDwarfFiles(); const SmallVectorImpl<MCDwarfFile> &MCDwarfFiles = context.getMCDwarfFiles();
// MCDwarfFiles might be empty if we have an empty source file. // MCDwarfFiles might be empty if we have an empty source file.
@ -1024,28 +1024,28 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
MCDwarfFiles.empty() MCDwarfFiles.empty()
? context.getMCDwarfLineTable(/*CUID=*/0).getRootFile() ? context.getMCDwarfLineTable(/*CUID=*/0).getRootFile()
: MCDwarfFiles[1]; : MCDwarfFiles[1];
MCOS->EmitBytes(RootFile.Name); MCOS->emitBytes(RootFile.Name);
MCOS->EmitIntValue(0, 1); // NULL byte to terminate the string. MCOS->EmitIntValue(0, 1); // NULL byte to terminate the string.
// AT_comp_dir, the working directory the assembly was done in. // AT_comp_dir, the working directory the assembly was done in.
if (!context.getCompilationDir().empty()) { if (!context.getCompilationDir().empty()) {
MCOS->EmitBytes(context.getCompilationDir()); MCOS->emitBytes(context.getCompilationDir());
MCOS->EmitIntValue(0, 1); // NULL byte to terminate the string. MCOS->EmitIntValue(0, 1); // NULL byte to terminate the string.
} }
// AT_APPLE_flags, the command line arguments of the assembler tool. // AT_APPLE_flags, the command line arguments of the assembler tool.
StringRef DwarfDebugFlags = context.getDwarfDebugFlags(); StringRef DwarfDebugFlags = context.getDwarfDebugFlags();
if (!DwarfDebugFlags.empty()){ if (!DwarfDebugFlags.empty()){
MCOS->EmitBytes(DwarfDebugFlags); MCOS->emitBytes(DwarfDebugFlags);
MCOS->EmitIntValue(0, 1); // NULL byte to terminate the string. MCOS->EmitIntValue(0, 1); // NULL byte to terminate the string.
} }
// AT_producer, the version of the assembler tool. // AT_producer, the version of the assembler tool.
StringRef DwarfDebugProducer = context.getDwarfDebugProducer(); StringRef DwarfDebugProducer = context.getDwarfDebugProducer();
if (!DwarfDebugProducer.empty()) if (!DwarfDebugProducer.empty())
MCOS->EmitBytes(DwarfDebugProducer); MCOS->emitBytes(DwarfDebugProducer);
else else
MCOS->EmitBytes(StringRef("llvm-mc (based on LLVM " PACKAGE_VERSION ")")); MCOS->emitBytes(StringRef("llvm-mc (based on LLVM " PACKAGE_VERSION ")"));
MCOS->EmitIntValue(0, 1); // NULL byte to terminate the string. MCOS->EmitIntValue(0, 1); // NULL byte to terminate the string.
// AT_language, a 4 byte value. We use DW_LANG_Mips_Assembler as the dwarf2 // AT_language, a 4 byte value. We use DW_LANG_Mips_Assembler as the dwarf2
@ -1062,7 +1062,7 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
MCOS->emitULEB128IntValue(2); MCOS->emitULEB128IntValue(2);
// AT_name, of the label without any leading underbar. // AT_name, of the label without any leading underbar.
MCOS->EmitBytes(Entry.getName()); MCOS->emitBytes(Entry.getName());
MCOS->EmitIntValue(0, 1); // NULL byte to terminate the string. MCOS->EmitIntValue(0, 1); // NULL byte to terminate the string.
// AT_decl_file, index into the file table. // AT_decl_file, index into the file table.
@ -1451,7 +1451,7 @@ void FrameEmitterImpl::emitCFIInstruction(const MCCFIInstruction &Instr) {
return; return;
case MCCFIInstruction::OpEscape: case MCCFIInstruction::OpEscape:
Streamer.EmitBytes(Instr.getValues()); Streamer.emitBytes(Instr.getValues());
return; return;
} }
llvm_unreachable("Unhandled case in switch"); llvm_unreachable("Unhandled case in switch");
@ -1592,7 +1592,7 @@ const MCSymbol &FrameEmitterImpl::EmitCIE(const MCDwarfFrameInfo &Frame) {
Augmentation += "S"; Augmentation += "S";
if (Frame.IsBKeyFrame) if (Frame.IsBKeyFrame)
Augmentation += "B"; Augmentation += "B";
Streamer.EmitBytes(Augmentation); Streamer.emitBytes(Augmentation);
} }
Streamer.EmitIntValue(0, 1); Streamer.EmitIntValue(0, 1);
@ -1894,7 +1894,7 @@ void MCDwarfFrameEmitter::EmitAdvanceLoc(MCObjectStreamer &Streamer,
SmallString<256> Tmp; SmallString<256> Tmp;
raw_svector_ostream OS(Tmp); raw_svector_ostream OS(Tmp);
MCDwarfFrameEmitter::EncodeAdvanceLoc(Context, AddrDelta, OS); MCDwarfFrameEmitter::EncodeAdvanceLoc(Context, AddrDelta, OS);
Streamer.EmitBytes(OS.str()); Streamer.emitBytes(OS.str());
} }
void MCDwarfFrameEmitter::EncodeAdvanceLoc(MCContext &Context, void MCDwarfFrameEmitter::EncodeAdvanceLoc(MCContext &Context,

View File

@ -117,7 +117,7 @@ void MCELFStreamer::emitLabelAtPos(MCSymbol *S, SMLoc Loc, MCFragment *F,
Symbol->setType(ELF::STT_TLS); Symbol->setType(ELF::STT_TLS);
} }
void MCELFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) { void MCELFStreamer::emitAssemblerFlag(MCAssemblerFlag Flag) {
// Let the target do whatever target specific stuff it needs to do. // Let the target do whatever target specific stuff it needs to do.
getAssembler().getBackend().handleAssemblerFlag(Flag); getAssembler().getBackend().handleAssemblerFlag(Flag);
// Do any generic stuff we need to do. // Do any generic stuff we need to do.
@ -161,7 +161,7 @@ void MCELFStreamer::ChangeSection(MCSection *Section,
Asm.registerSymbol(*Section->getBeginSymbol()); Asm.registerSymbol(*Section->getBeginSymbol());
} }
void MCELFStreamer::EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) { void MCELFStreamer::emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) {
getAssembler().registerSymbol(*Symbol); getAssembler().registerSymbol(*Symbol);
const MCExpr *Value = MCSymbolRefExpr::create( const MCExpr *Value = MCSymbolRefExpr::create(
Symbol, MCSymbolRefExpr::VK_WEAKREF, getContext()); Symbol, MCSymbolRefExpr::VK_WEAKREF, getContext());
@ -187,7 +187,7 @@ static unsigned CombineSymbolTypes(unsigned T1, unsigned T2) {
return T2; return T2;
} }
bool MCELFStreamer::EmitSymbolAttribute(MCSymbol *S, MCSymbolAttr Attribute) { bool MCELFStreamer::emitSymbolAttribute(MCSymbol *S, MCSymbolAttr Attribute) {
auto *Symbol = cast<MCSymbolELF>(S); auto *Symbol = cast<MCSymbolELF>(S);
// Adding a symbol attribute always introduces the symbol, note that an // Adding a symbol attribute always introduces the symbol, note that an
@ -286,7 +286,7 @@ bool MCELFStreamer::EmitSymbolAttribute(MCSymbol *S, MCSymbolAttr Attribute) {
return true; return true;
} }
void MCELFStreamer::EmitCommonSymbol(MCSymbol *S, uint64_t Size, void MCELFStreamer::emitCommonSymbol(MCSymbol *S, uint64_t Size,
unsigned ByteAlignment) { unsigned ByteAlignment) {
auto *Symbol = cast<MCSymbolELF>(S); auto *Symbol = cast<MCSymbolELF>(S);
getAssembler().registerSymbol(*Symbol); getAssembler().registerSymbol(*Symbol);
@ -328,14 +328,14 @@ void MCELFStreamer::emitELFSymverDirective(StringRef AliasName,
getAssembler().Symvers.push_back({AliasName, Aliasee}); getAssembler().Symvers.push_back({AliasName, Aliasee});
} }
void MCELFStreamer::EmitLocalCommonSymbol(MCSymbol *S, uint64_t Size, void MCELFStreamer::emitLocalCommonSymbol(MCSymbol *S, uint64_t Size,
unsigned ByteAlignment) { unsigned ByteAlignment) {
auto *Symbol = cast<MCSymbolELF>(S); auto *Symbol = cast<MCSymbolELF>(S);
// FIXME: Should this be caught and done earlier? // FIXME: Should this be caught and done earlier?
getAssembler().registerSymbol(*Symbol); getAssembler().registerSymbol(*Symbol);
Symbol->setBinding(ELF::STB_LOCAL); Symbol->setBinding(ELF::STB_LOCAL);
Symbol->setExternal(false); Symbol->setExternal(false);
EmitCommonSymbol(Symbol, Size, ByteAlignment); emitCommonSymbol(Symbol, Size, ByteAlignment);
} }
void MCELFStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size, void MCELFStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
@ -371,7 +371,7 @@ void MCELFStreamer::EmitIdent(StringRef IdentString) {
EmitIntValue(0, 1); EmitIntValue(0, 1);
SeenIdent = true; SeenIdent = true;
} }
EmitBytes(IdentString); emitBytes(IdentString);
EmitIntValue(0, 1); EmitIntValue(0, 1);
PopSection(); PopSection();
} }
@ -676,15 +676,15 @@ void MCELFStreamer::FinishImpl() {
this->MCObjectStreamer::FinishImpl(); this->MCObjectStreamer::FinishImpl();
} }
void MCELFStreamer::EmitThumbFunc(MCSymbol *Func) { void MCELFStreamer::emitThumbFunc(MCSymbol *Func) {
llvm_unreachable("Generic ELF doesn't support this directive"); llvm_unreachable("Generic ELF doesn't support this directive");
} }
void MCELFStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) { void MCELFStreamer::emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {
llvm_unreachable("ELF doesn't support this directive"); llvm_unreachable("ELF doesn't support this directive");
} }
void MCELFStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol, void MCELFStreamer::emitZerofill(MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment, uint64_t Size, unsigned ByteAlignment,
SMLoc Loc) { SMLoc Loc) {
llvm_unreachable("ELF doesn't support this directive"); llvm_unreachable("ELF doesn't support this directive");

View File

@ -58,8 +58,8 @@ private:
void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo &STI) override; void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo &STI) override;
void EmitDataRegion(DataRegionData::KindTy Kind); void emitDataRegion(DataRegionData::KindTy Kind);
void EmitDataRegionEnd(); void emitDataRegionEnd();
public: public:
MCMachOStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> MAB, MCMachOStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> MAB,
@ -83,24 +83,24 @@ public:
void ChangeSection(MCSection *Sect, const MCExpr *Subsect) override; void ChangeSection(MCSection *Sect, const MCExpr *Subsect) override;
void EmitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override; void EmitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override;
void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) override; void emitAssignment(MCSymbol *Symbol, const MCExpr *Value) override;
void EmitEHSymAttributes(const MCSymbol *Symbol, MCSymbol *EHSymbol) override; void emitEHSymAttributes(const MCSymbol *Symbol, MCSymbol *EHSymbol) override;
void EmitAssemblerFlag(MCAssemblerFlag Flag) override; void emitAssemblerFlag(MCAssemblerFlag Flag) override;
void EmitLinkerOptions(ArrayRef<std::string> Options) override; void emitLinkerOptions(ArrayRef<std::string> Options) override;
void EmitDataRegion(MCDataRegionType Kind) override; void emitDataRegion(MCDataRegionType Kind) override;
void EmitVersionMin(MCVersionMinType Kind, unsigned Major, unsigned Minor, void emitVersionMin(MCVersionMinType Kind, unsigned Major, unsigned Minor,
unsigned Update, VersionTuple SDKVersion) override; unsigned Update, VersionTuple SDKVersion) override;
void EmitBuildVersion(unsigned Platform, unsigned Major, unsigned Minor, void emitBuildVersion(unsigned Platform, unsigned Major, unsigned Minor,
unsigned Update, VersionTuple SDKVersion) override; unsigned Update, VersionTuple SDKVersion) override;
void EmitThumbFunc(MCSymbol *Func) override; void emitThumbFunc(MCSymbol *Func) override;
bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override; bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override; void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override;
void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override; unsigned ByteAlignment) override;
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, void emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override; unsigned ByteAlignment) override;
void EmitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr, void emitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
uint64_t Size = 0, unsigned ByteAlignment = 0, uint64_t Size = 0, unsigned ByteAlignment = 0,
SMLoc Loc = SMLoc()) override; SMLoc Loc = SMLoc()) override;
void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size, void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
@ -110,7 +110,7 @@ public:
llvm_unreachable("macho doesn't support this directive"); llvm_unreachable("macho doesn't support this directive");
} }
void EmitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) override { void emitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) override {
getAssembler().getLOHContainer().addDirective(Kind, Args); getAssembler().getLOHContainer().addDirective(Kind, Args);
} }
@ -167,15 +167,15 @@ void MCMachOStreamer::ChangeSection(MCSection *Section,
} }
} }
void MCMachOStreamer::EmitEHSymAttributes(const MCSymbol *Symbol, void MCMachOStreamer::emitEHSymAttributes(const MCSymbol *Symbol,
MCSymbol *EHSymbol) { MCSymbol *EHSymbol) {
getAssembler().registerSymbol(*Symbol); getAssembler().registerSymbol(*Symbol);
if (Symbol->isExternal()) if (Symbol->isExternal())
EmitSymbolAttribute(EHSymbol, MCSA_Global); emitSymbolAttribute(EHSymbol, MCSA_Global);
if (cast<MCSymbolMachO>(Symbol)->isWeakDefinition()) if (cast<MCSymbolMachO>(Symbol)->isWeakDefinition())
EmitSymbolAttribute(EHSymbol, MCSA_WeakDefinition); emitSymbolAttribute(EHSymbol, MCSA_WeakDefinition);
if (Symbol->isPrivateExtern()) if (Symbol->isPrivateExtern())
EmitSymbolAttribute(EHSymbol, MCSA_PrivateExtern); emitSymbolAttribute(EHSymbol, MCSA_PrivateExtern);
} }
void MCMachOStreamer::EmitLabel(MCSymbol *Symbol, SMLoc Loc) { void MCMachOStreamer::EmitLabel(MCSymbol *Symbol, SMLoc Loc) {
@ -196,7 +196,7 @@ void MCMachOStreamer::EmitLabel(MCSymbol *Symbol, SMLoc Loc) {
cast<MCSymbolMachO>(Symbol)->clearReferenceType(); cast<MCSymbolMachO>(Symbol)->clearReferenceType();
} }
void MCMachOStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) { void MCMachOStreamer::emitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
MCValue Res; MCValue Res;
if (Value->evaluateAsRelocatable(Res, nullptr, nullptr)) { if (Value->evaluateAsRelocatable(Res, nullptr, nullptr)) {
@ -206,10 +206,10 @@ void MCMachOStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
cast<MCSymbolMachO>(Symbol)->setAltEntry(); cast<MCSymbolMachO>(Symbol)->setAltEntry();
} }
} }
MCObjectStreamer::EmitAssignment(Symbol, Value); MCObjectStreamer::emitAssignment(Symbol, Value);
} }
void MCMachOStreamer::EmitDataRegion(DataRegionData::KindTy Kind) { void MCMachOStreamer::emitDataRegion(DataRegionData::KindTy Kind) {
// Create a temporary label to mark the start of the data region. // Create a temporary label to mark the start of the data region.
MCSymbol *Start = getContext().createTempSymbol(); MCSymbol *Start = getContext().createTempSymbol();
EmitLabel(Start); EmitLabel(Start);
@ -219,7 +219,7 @@ void MCMachOStreamer::EmitDataRegion(DataRegionData::KindTy Kind) {
Regions.push_back(Data); Regions.push_back(Data);
} }
void MCMachOStreamer::EmitDataRegionEnd() { void MCMachOStreamer::emitDataRegionEnd() {
std::vector<DataRegionData> &Regions = getAssembler().getDataRegions(); std::vector<DataRegionData> &Regions = getAssembler().getDataRegions();
assert(!Regions.empty() && "Mismatched .end_data_region!"); assert(!Regions.empty() && "Mismatched .end_data_region!");
DataRegionData &Data = Regions.back(); DataRegionData &Data = Regions.back();
@ -229,7 +229,7 @@ void MCMachOStreamer::EmitDataRegionEnd() {
EmitLabel(Data.End); EmitLabel(Data.End);
} }
void MCMachOStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) { void MCMachOStreamer::emitAssemblerFlag(MCAssemblerFlag Flag) {
// Let the target do whatever target specific stuff it needs to do. // Let the target do whatever target specific stuff it needs to do.
getAssembler().getBackend().handleAssemblerFlag(Flag); getAssembler().getBackend().handleAssemblerFlag(Flag);
// Do any generic stuff we need to do. // Do any generic stuff we need to do.
@ -244,51 +244,51 @@ void MCMachOStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
} }
} }
void MCMachOStreamer::EmitLinkerOptions(ArrayRef<std::string> Options) { void MCMachOStreamer::emitLinkerOptions(ArrayRef<std::string> Options) {
getAssembler().getLinkerOptions().push_back(Options); getAssembler().getLinkerOptions().push_back(Options);
} }
void MCMachOStreamer::EmitDataRegion(MCDataRegionType Kind) { void MCMachOStreamer::emitDataRegion(MCDataRegionType Kind) {
switch (Kind) { switch (Kind) {
case MCDR_DataRegion: case MCDR_DataRegion:
EmitDataRegion(DataRegionData::Data); emitDataRegion(DataRegionData::Data);
return; return;
case MCDR_DataRegionJT8: case MCDR_DataRegionJT8:
EmitDataRegion(DataRegionData::JumpTable8); emitDataRegion(DataRegionData::JumpTable8);
return; return;
case MCDR_DataRegionJT16: case MCDR_DataRegionJT16:
EmitDataRegion(DataRegionData::JumpTable16); emitDataRegion(DataRegionData::JumpTable16);
return; return;
case MCDR_DataRegionJT32: case MCDR_DataRegionJT32:
EmitDataRegion(DataRegionData::JumpTable32); emitDataRegion(DataRegionData::JumpTable32);
return; return;
case MCDR_DataRegionEnd: case MCDR_DataRegionEnd:
EmitDataRegionEnd(); emitDataRegionEnd();
return; return;
} }
} }
void MCMachOStreamer::EmitVersionMin(MCVersionMinType Kind, unsigned Major, void MCMachOStreamer::emitVersionMin(MCVersionMinType Kind, unsigned Major,
unsigned Minor, unsigned Update, unsigned Minor, unsigned Update,
VersionTuple SDKVersion) { VersionTuple SDKVersion) {
getAssembler().setVersionMin(Kind, Major, Minor, Update, SDKVersion); getAssembler().setVersionMin(Kind, Major, Minor, Update, SDKVersion);
} }
void MCMachOStreamer::EmitBuildVersion(unsigned Platform, unsigned Major, void MCMachOStreamer::emitBuildVersion(unsigned Platform, unsigned Major,
unsigned Minor, unsigned Update, unsigned Minor, unsigned Update,
VersionTuple SDKVersion) { VersionTuple SDKVersion) {
getAssembler().setBuildVersion((MachO::PlatformType)Platform, Major, Minor, getAssembler().setBuildVersion((MachO::PlatformType)Platform, Major, Minor,
Update, SDKVersion); Update, SDKVersion);
} }
void MCMachOStreamer::EmitThumbFunc(MCSymbol *Symbol) { void MCMachOStreamer::emitThumbFunc(MCSymbol *Symbol) {
// Remember that the function is a thumb function. Fixup and relocation // Remember that the function is a thumb function. Fixup and relocation
// values will need adjusted. // values will need adjusted.
getAssembler().setIsThumbFunc(Symbol); getAssembler().setIsThumbFunc(Symbol);
cast<MCSymbolMachO>(Symbol)->setThumbFunc(); cast<MCSymbolMachO>(Symbol)->setThumbFunc();
} }
bool MCMachOStreamer::EmitSymbolAttribute(MCSymbol *Sym, bool MCMachOStreamer::emitSymbolAttribute(MCSymbol *Sym,
MCSymbolAttr Attribute) { MCSymbolAttr Attribute) {
MCSymbolMachO *Symbol = cast<MCSymbolMachO>(Sym); MCSymbolMachO *Symbol = cast<MCSymbolMachO>(Sym);
@ -396,13 +396,13 @@ bool MCMachOStreamer::EmitSymbolAttribute(MCSymbol *Sym,
return true; return true;
} }
void MCMachOStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) { void MCMachOStreamer::emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {
// Encode the 'desc' value into the lowest implementation defined bits. // Encode the 'desc' value into the lowest implementation defined bits.
getAssembler().registerSymbol(*Symbol); getAssembler().registerSymbol(*Symbol);
cast<MCSymbolMachO>(Symbol)->setDesc(DescValue); cast<MCSymbolMachO>(Symbol)->setDesc(DescValue);
} }
void MCMachOStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, void MCMachOStreamer::emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) { unsigned ByteAlignment) {
// FIXME: Darwin 'as' does appear to allow redef of a .comm by itself. // FIXME: Darwin 'as' does appear to allow redef of a .comm by itself.
assert(Symbol->isUndefined() && "Cannot define a symbol twice!"); assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
@ -412,14 +412,14 @@ void MCMachOStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
Symbol->setCommon(Size, ByteAlignment); Symbol->setCommon(Size, ByteAlignment);
} }
void MCMachOStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, void MCMachOStreamer::emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) { unsigned ByteAlignment) {
// '.lcomm' is equivalent to '.zerofill'. // '.lcomm' is equivalent to '.zerofill'.
return EmitZerofill(getContext().getObjectFileInfo()->getDataBSSSection(), return emitZerofill(getContext().getObjectFileInfo()->getDataBSSSection(),
Symbol, Size, ByteAlignment); Symbol, Size, ByteAlignment);
} }
void MCMachOStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol, void MCMachOStreamer::emitZerofill(MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment, uint64_t Size, unsigned ByteAlignment,
SMLoc Loc) { SMLoc Loc) {
// On darwin all virtual sections have zerofill type. Disallow the usage of // On darwin all virtual sections have zerofill type. Disallow the usage of
@ -449,7 +449,7 @@ void MCMachOStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
// .zerofill directive this doesn't actually switch sections on us. // .zerofill directive this doesn't actually switch sections on us.
void MCMachOStreamer::EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, void MCMachOStreamer::EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment) { uint64_t Size, unsigned ByteAlignment) {
EmitZerofill(Section, Symbol, Size, ByteAlignment); emitZerofill(Section, Symbol, Size, ByteAlignment);
} }
void MCMachOStreamer::EmitInstToData(const MCInst &Inst, void MCMachOStreamer::EmitInstToData(const MCInst &Inst,
@ -513,7 +513,7 @@ MCStreamer *llvm::createMachOStreamer(MCContext &Context,
new MCMachOStreamer(Context, std::move(MAB), std::move(OW), std::move(CE), new MCMachOStreamer(Context, std::move(MAB), std::move(OW), std::move(CE),
DWARFMustBeAtTheEnd, LabelSections); DWARFMustBeAtTheEnd, LabelSections);
const Triple &Target = Context.getObjectFileInfo()->getTargetTriple(); const Triple &Target = Context.getObjectFileInfo()->getTargetTriple();
S->EmitVersionForTarget(Target, Context.getObjectFileInfo()->getSDKVersion()); S->emitVersionForTarget(Target, Context.getObjectFileInfo()->getSDKVersion());
if (RelaxAll) if (RelaxAll)
S->getAssembler().setRelaxAll(true); S->getAssembler().setRelaxAll(true);
return S; return S;

View File

@ -25,14 +25,14 @@ namespace {
bool hasRawTextSupport() const override { return true; } bool hasRawTextSupport() const override { return true; }
void EmitRawTextImpl(StringRef String) override {} void EmitRawTextImpl(StringRef String) override {}
bool EmitSymbolAttribute(MCSymbol *Symbol, bool emitSymbolAttribute(MCSymbol *Symbol,
MCSymbolAttr Attribute) override { MCSymbolAttr Attribute) override {
return true; return true;
} }
void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override {} unsigned ByteAlignment) override {}
void EmitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr, void emitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
uint64_t Size = 0, unsigned ByteAlignment = 0, uint64_t Size = 0, unsigned ByteAlignment = 0,
SMLoc Loc = SMLoc()) override {} SMLoc Loc = SMLoc()) override {}
void EmitGPRel32Value(const MCExpr *Value) override {} void EmitGPRel32Value(const MCExpr *Value) override {}

View File

@ -327,7 +327,7 @@ void MCObjectStreamer::emitSLEB128Value(const MCExpr *Value) {
insert(new MCLEBFragment(*Value, true)); insert(new MCLEBFragment(*Value, true));
} }
void MCObjectStreamer::EmitWeakReference(MCSymbol *Alias, void MCObjectStreamer::emitWeakReference(MCSymbol *Alias,
const MCSymbol *Symbol) { const MCSymbol *Symbol) {
report_fatal_error("This file format doesn't support weak aliases."); report_fatal_error("This file format doesn't support weak aliases.");
} }
@ -356,9 +356,9 @@ bool MCObjectStreamer::changeSectionImpl(MCSection *Section,
return Created; return Created;
} }
void MCObjectStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) { void MCObjectStreamer::emitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
getAssembler().registerSymbol(*Symbol); getAssembler().registerSymbol(*Symbol);
MCStreamer::EmitAssignment(Symbol, Value); MCStreamer::emitAssignment(Symbol, Value);
} }
bool MCObjectStreamer::mayHaveInstructions(MCSection &Sec) const { bool MCObjectStreamer::mayHaveInstructions(MCSection &Sec) const {
@ -567,7 +567,7 @@ void MCObjectStreamer::EmitCVFileChecksumOffsetDirective(unsigned FileNo) {
getContext().getCVContext().emitFileChecksumOffset(*this, FileNo); getContext().getCVContext().emitFileChecksumOffset(*this, FileNo);
} }
void MCObjectStreamer::EmitBytes(StringRef Data) { void MCObjectStreamer::emitBytes(StringRef Data) {
MCDwarfLineEntry::Make(this, getCurrentSectionOnly()); MCDwarfLineEntry::Make(this, getCurrentSectionOnly());
MCDataFragment *DF = getOrCreateDataFragment(); MCDataFragment *DF = getOrCreateDataFragment();
flushPendingLabels(DF, DF->getContents().size()); flushPendingLabels(DF, DF->getContents().size());

View File

@ -814,7 +814,7 @@ bool AsmParser::processIncbinFile(const std::string &Filename, int64_t Skip,
return Warning(Loc, "negative count has no effect"); return Warning(Loc, "negative count has no effect");
Bytes = Bytes.take_front(Res); Bytes = Bytes.take_front(Res);
} }
getStreamer().EmitBytes(Bytes); getStreamer().emitBytes(Bytes);
return false; return false;
} }
@ -2831,9 +2831,9 @@ bool AsmParser::parseAssignment(StringRef Name, bool allow_redef,
} }
// Do the assignment. // Do the assignment.
Out.EmitAssignment(Sym, Value); Out.emitAssignment(Sym, Value);
if (NoDeadStrip) if (NoDeadStrip)
Out.EmitSymbolAttribute(Sym, MCSA_NoDeadStrip); Out.emitSymbolAttribute(Sym, MCSA_NoDeadStrip);
return false; return false;
} }
@ -2976,9 +2976,9 @@ bool AsmParser::parseDirectiveAscii(StringRef IDVal, bool ZeroTerminated) {
std::string Data; std::string Data;
if (checkForValidSection() || parseEscapedString(Data)) if (checkForValidSection() || parseEscapedString(Data))
return true; return true;
getStreamer().EmitBytes(Data); getStreamer().emitBytes(Data);
if (ZeroTerminated) if (ZeroTerminated)
getStreamer().EmitBytes(StringRef("\0", 1)); getStreamer().emitBytes(StringRef("\0", 1));
return false; return false;
}; };
@ -4857,7 +4857,7 @@ bool AsmParser::parseDirectiveSymbolAttribute(MCSymbolAttr Attr) {
if (Sym->isTemporary()) if (Sym->isTemporary())
return Error(Loc, "non-local symbol required"); return Error(Loc, "non-local symbol required");
if (!getStreamer().EmitSymbolAttribute(Sym, Attr)) if (!getStreamer().emitSymbolAttribute(Sym, Attr))
return Error(Loc, "unable to emit symbol attribute"); return Error(Loc, "unable to emit symbol attribute");
return false; return false;
}; };
@ -4934,11 +4934,11 @@ bool AsmParser::parseDirectiveComm(bool IsLocal) {
// Create the Symbol as a common or local common with Size and Pow2Alignment // Create the Symbol as a common or local common with Size and Pow2Alignment
if (IsLocal) { if (IsLocal) {
getStreamer().EmitLocalCommonSymbol(Sym, Size, 1 << Pow2Alignment); getStreamer().emitLocalCommonSymbol(Sym, Size, 1 << Pow2Alignment);
return false; return false;
} }
getStreamer().EmitCommonSymbol(Sym, Size, 1 << Pow2Alignment); getStreamer().emitCommonSymbol(Sym, Size, 1 << Pow2Alignment);
return false; return false;
} }

View File

@ -284,7 +284,7 @@ bool COFFAsmParser::ParseDirectiveSymbolAttribute(StringRef Directive, SMLoc) {
MCSymbol *Sym = getContext().getOrCreateSymbol(Name); MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
getStreamer().EmitSymbolAttribute(Sym, Attr); getStreamer().emitSymbolAttribute(Sym, Attr);
if (getLexer().is(AsmToken::EndOfStatement)) if (getLexer().is(AsmToken::EndOfStatement))
break; break;

View File

@ -510,7 +510,7 @@ bool DarwinAsmParser::parseDirectiveAltEntry(StringRef, SMLoc) {
if (Sym->isDefined()) if (Sym->isDefined())
return TokError(".alt_entry must preceed symbol definition"); return TokError(".alt_entry must preceed symbol definition");
if (!getStreamer().EmitSymbolAttribute(Sym, MCSA_AltEntry)) if (!getStreamer().emitSymbolAttribute(Sym, MCSA_AltEntry))
return TokError("unable to emit symbol attribute"); return TokError("unable to emit symbol attribute");
Lex(); Lex();
@ -541,7 +541,7 @@ bool DarwinAsmParser::parseDirectiveDesc(StringRef, SMLoc) {
Lex(); Lex();
// Set the n_desc field of this Symbol to this DescValue // Set the n_desc field of this Symbol to this DescValue
getStreamer().EmitSymbolDesc(Sym, DescValue); getStreamer().emitSymbolDesc(Sym, DescValue);
return false; return false;
} }
@ -569,7 +569,7 @@ bool DarwinAsmParser::parseDirectiveIndirectSymbol(StringRef, SMLoc Loc) {
if (Sym->isTemporary()) if (Sym->isTemporary())
return TokError("non-local symbol required in directive"); return TokError("non-local symbol required in directive");
if (!getStreamer().EmitSymbolAttribute(Sym, MCSA_IndirectSymbol)) if (!getStreamer().emitSymbolAttribute(Sym, MCSA_IndirectSymbol))
return TokError("unable to emit indirect symbol attribute for: " + Name); return TokError("unable to emit indirect symbol attribute for: " + Name);
if (getLexer().isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
@ -625,7 +625,7 @@ bool DarwinAsmParser::parseDirectiveLinkerOption(StringRef IDVal, SMLoc) {
Lex(); Lex();
} }
getStreamer().EmitLinkerOptions(Args); getStreamer().emitLinkerOptions(Args);
return false; return false;
} }
@ -819,7 +819,7 @@ bool DarwinAsmParser::parseDirectiveSubsectionsViaSymbols(StringRef, SMLoc) {
Lex(); Lex();
getStreamer().EmitAssemblerFlag(MCAF_SubsectionsViaSymbols); getStreamer().emitAssemblerFlag(MCAF_SubsectionsViaSymbols);
return false; return false;
} }
@ -901,7 +901,7 @@ bool DarwinAsmParser::parseDirectiveZerofill(StringRef, SMLoc) {
// the section but with no symbol. // the section but with no symbol.
if (getLexer().is(AsmToken::EndOfStatement)) { if (getLexer().is(AsmToken::EndOfStatement)) {
// Create the zerofill section but no symbol // Create the zerofill section but no symbol
getStreamer().EmitZerofill( getStreamer().emitZerofill(
getContext().getMachOSection(Segment, Section, MachO::S_ZEROFILL, 0, getContext().getMachOSection(Segment, Section, MachO::S_ZEROFILL, 0,
SectionKind::getBSS()), SectionKind::getBSS()),
/*Symbol=*/nullptr, /*Size=*/0, /*ByteAlignment=*/0, SectionLoc); /*Symbol=*/nullptr, /*Size=*/0, /*ByteAlignment=*/0, SectionLoc);
@ -960,7 +960,7 @@ bool DarwinAsmParser::parseDirectiveZerofill(StringRef, SMLoc) {
// Create the zerofill Symbol with Size and Pow2Alignment // Create the zerofill Symbol with Size and Pow2Alignment
// //
// FIXME: Arch specific. // FIXME: Arch specific.
getStreamer().EmitZerofill(getContext().getMachOSection( getStreamer().emitZerofill(getContext().getMachOSection(
Segment, Section, MachO::S_ZEROFILL, Segment, Section, MachO::S_ZEROFILL,
0, SectionKind::getBSS()), 0, SectionKind::getBSS()),
Sym, Size, 1 << Pow2Alignment, SectionLoc); Sym, Size, 1 << Pow2Alignment, SectionLoc);
@ -973,7 +973,7 @@ bool DarwinAsmParser::parseDirectiveZerofill(StringRef, SMLoc) {
bool DarwinAsmParser::parseDirectiveDataRegion(StringRef, SMLoc) { bool DarwinAsmParser::parseDirectiveDataRegion(StringRef, SMLoc) {
if (getLexer().is(AsmToken::EndOfStatement)) { if (getLexer().is(AsmToken::EndOfStatement)) {
Lex(); Lex();
getStreamer().EmitDataRegion(MCDR_DataRegion); getStreamer().emitDataRegion(MCDR_DataRegion);
return false; return false;
} }
StringRef RegionType; StringRef RegionType;
@ -989,7 +989,7 @@ bool DarwinAsmParser::parseDirectiveDataRegion(StringRef, SMLoc) {
return Error(Loc, "unknown region type in '.data_region' directive"); return Error(Loc, "unknown region type in '.data_region' directive");
Lex(); Lex();
getStreamer().EmitDataRegion((MCDataRegionType)Kind); getStreamer().emitDataRegion((MCDataRegionType)Kind);
return false; return false;
} }
@ -1000,7 +1000,7 @@ bool DarwinAsmParser::parseDirectiveDataRegionEnd(StringRef, SMLoc) {
return TokError("unexpected token in '.end_data_region' directive"); return TokError("unexpected token in '.end_data_region' directive");
Lex(); Lex();
getStreamer().EmitDataRegion(MCDR_DataRegionEnd); getStreamer().emitDataRegion(MCDR_DataRegionEnd);
return false; return false;
} }
@ -1137,7 +1137,7 @@ bool DarwinAsmParser::parseVersionMin(StringRef Directive, SMLoc Loc,
Triple::OSType ExpectedOS = getOSTypeFromMCVM(Type); Triple::OSType ExpectedOS = getOSTypeFromMCVM(Type);
checkVersion(Directive, StringRef(), Loc, ExpectedOS); checkVersion(Directive, StringRef(), Loc, ExpectedOS);
getStreamer().EmitVersionMin(Type, Major, Minor, Update, SDKVersion); getStreamer().emitVersionMin(Type, Major, Minor, Update, SDKVersion);
return false; return false;
} }
@ -1194,7 +1194,7 @@ bool DarwinAsmParser::parseBuildVersion(StringRef Directive, SMLoc Loc) {
Triple::OSType ExpectedOS Triple::OSType ExpectedOS
= getOSTypeFromPlatform((MachO::PlatformType)Platform); = getOSTypeFromPlatform((MachO::PlatformType)Platform);
checkVersion(Directive, PlatformName, Loc, ExpectedOS); checkVersion(Directive, PlatformName, Loc, ExpectedOS);
getStreamer().EmitBuildVersion(Platform, Major, Minor, Update, SDKVersion); getStreamer().emitBuildVersion(Platform, Major, Minor, Update, SDKVersion);
return false; return false;
} }

View File

@ -184,7 +184,7 @@ bool ELFAsmParser::ParseDirectiveSymbolAttribute(StringRef Directive, SMLoc) {
MCSymbol *Sym = getContext().getOrCreateSymbol(Name); MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
getStreamer().EmitSymbolAttribute(Sym, Attr); getStreamer().emitSymbolAttribute(Sym, Attr);
if (getLexer().is(AsmToken::EndOfStatement)) if (getLexer().is(AsmToken::EndOfStatement))
break; break;
@ -729,7 +729,7 @@ bool ELFAsmParser::ParseDirectiveType(StringRef, SMLoc) {
return TokError("unexpected token in '.type' directive"); return TokError("unexpected token in '.type' directive");
Lex(); Lex();
getStreamer().EmitSymbolAttribute(Sym, Attr); getStreamer().emitSymbolAttribute(Sym, Attr);
return false; return false;
} }
@ -800,7 +800,7 @@ bool ELFAsmParser::ParseDirectiveVersion(StringRef, SMLoc) {
getStreamer().EmitIntValue(Data.size()+1, 4); // namesz. getStreamer().EmitIntValue(Data.size()+1, 4); // namesz.
getStreamer().EmitIntValue(0, 4); // descsz = 0 (no description). getStreamer().EmitIntValue(0, 4); // descsz = 0 (no description).
getStreamer().EmitIntValue(1, 4); // type = NT_VERSION. getStreamer().EmitIntValue(1, 4); // type = NT_VERSION.
getStreamer().EmitBytes(Data); // name. getStreamer().emitBytes(Data); // name.
getStreamer().EmitIntValue(0, 1); // terminate the string. getStreamer().EmitIntValue(0, 1); // terminate the string.
getStreamer().EmitValueToAlignment(4); // ensure 4 byte alignment. getStreamer().EmitValueToAlignment(4); // ensure 4 byte alignment.
getStreamer().PopSection(); getStreamer().PopSection();
@ -829,7 +829,7 @@ bool ELFAsmParser::ParseDirectiveWeakref(StringRef, SMLoc) {
MCSymbol *Sym = getContext().getOrCreateSymbol(Name); MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
getStreamer().EmitWeakReference(Alias, Sym); getStreamer().emitWeakReference(Alias, Sym);
return false; return false;
} }

View File

@ -232,7 +232,7 @@ public:
if (getParser().parseIdentifier(Name)) if (getParser().parseIdentifier(Name))
return TokError("expected identifier in directive"); return TokError("expected identifier in directive");
MCSymbol *Sym = getContext().getOrCreateSymbol(Name); MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
getStreamer().EmitSymbolAttribute(Sym, Attr); getStreamer().emitSymbolAttribute(Sym, Attr);
if (getLexer().is(AsmToken::EndOfStatement)) if (getLexer().is(AsmToken::EndOfStatement))
break; break;
if (getLexer().isNot(AsmToken::Comma)) if (getLexer().isNot(AsmToken::Comma))

View File

@ -138,7 +138,7 @@ void MCStreamer::EmitIntValue(uint64_t Value, unsigned Size) {
unsigned index = isLittleEndian ? i : (Size - i - 1); unsigned index = isLittleEndian ? i : (Size - i - 1);
buf[i] = uint8_t(Value >> (index * 8)); buf[i] = uint8_t(Value >> (index * 8));
} }
EmitBytes(StringRef(buf, Size)); emitBytes(StringRef(buf, Size));
} }
/// EmitULEB128IntValue - Special case of EmitULEB128Value that avoids the /// EmitULEB128IntValue - Special case of EmitULEB128Value that avoids the
@ -147,7 +147,7 @@ void MCStreamer::emitULEB128IntValue(uint64_t Value, unsigned PadTo) {
SmallString<128> Tmp; SmallString<128> Tmp;
raw_svector_ostream OSE(Tmp); raw_svector_ostream OSE(Tmp);
encodeULEB128(Value, OSE, PadTo); encodeULEB128(Value, OSE, PadTo);
EmitBytes(OSE.str()); emitBytes(OSE.str());
} }
/// EmitSLEB128IntValue - Special case of EmitSLEB128Value that avoids the /// EmitSLEB128IntValue - Special case of EmitSLEB128Value that avoids the
@ -156,7 +156,7 @@ void MCStreamer::emitSLEB128IntValue(int64_t Value) {
SmallString<128> Tmp; SmallString<128> Tmp;
raw_svector_ostream OSE(Tmp); raw_svector_ostream OSE(Tmp);
encodeSLEB128(Value, OSE); encodeSLEB128(Value, OSE);
EmitBytes(OSE.str()); emitBytes(OSE.str());
} }
void MCStreamer::EmitValue(const MCExpr *Value, unsigned Size, SMLoc Loc) { void MCStreamer::EmitValue(const MCExpr *Value, unsigned Size, SMLoc Loc) {
@ -379,7 +379,7 @@ void MCStreamer::EmitCVDefRangeDirective(
EmitCVDefRangeDirective(Ranges, BytePrefix); EmitCVDefRangeDirective(Ranges, BytePrefix);
} }
void MCStreamer::EmitEHSymAttributes(const MCSymbol *Symbol, void MCStreamer::emitEHSymAttributes(const MCSymbol *Symbol,
MCSymbol *EHSymbol) { MCSymbol *EHSymbol) {
} }
@ -966,7 +966,7 @@ void MCStreamer::Finish() {
FinishImpl(); FinishImpl();
} }
void MCStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) { void MCStreamer::emitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
visitUsedExpr(*Value); visitUsedExpr(*Value);
Symbol->setVariableValue(Value); Symbol->setVariableValue(Value);
@ -1033,7 +1033,7 @@ void MCStreamer::emitAbsoluteSymbolDiff(const MCSymbol *Hi, const MCSymbol *Lo,
// Otherwise, emit with .set (aka assignment). // Otherwise, emit with .set (aka assignment).
MCSymbol *SetLabel = Context.createTempSymbol("set", true); MCSymbol *SetLabel = Context.createTempSymbol("set", true);
EmitAssignment(SetLabel, Diff); emitAssignment(SetLabel, Diff);
EmitSymbolValue(SetLabel, Size); EmitSymbolValue(SetLabel, Size);
} }
@ -1047,9 +1047,9 @@ void MCStreamer::emitAbsoluteSymbolDiffAsULEB128(const MCSymbol *Hi,
emitULEB128Value(Diff); emitULEB128Value(Diff);
} }
void MCStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {} void MCStreamer::emitAssemblerFlag(MCAssemblerFlag Flag) {}
void MCStreamer::EmitThumbFunc(MCSymbol *Func) {} void MCStreamer::emitThumbFunc(MCSymbol *Func) {}
void MCStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {} void MCStreamer::emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {}
void MCStreamer::BeginCOFFSymbolDef(const MCSymbol *Symbol) { void MCStreamer::BeginCOFFSymbolDef(const MCSymbol *Symbol) {
llvm_unreachable("this directive only supported on COFF targets"); llvm_unreachable("this directive only supported on COFF targets");
} }
@ -1071,14 +1071,14 @@ void MCStreamer::EmitXCOFFLocalCommonSymbol(MCSymbol *LabelSym, uint64_t Size,
void MCStreamer::emitELFSize(MCSymbol *Symbol, const MCExpr *Value) {} void MCStreamer::emitELFSize(MCSymbol *Symbol, const MCExpr *Value) {}
void MCStreamer::emitELFSymverDirective(StringRef AliasName, void MCStreamer::emitELFSymverDirective(StringRef AliasName,
const MCSymbol *Aliasee) {} const MCSymbol *Aliasee) {}
void MCStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, void MCStreamer::emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) {} unsigned ByteAlignment) {}
void MCStreamer::EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, void MCStreamer::EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment) {} uint64_t Size, unsigned ByteAlignment) {}
void MCStreamer::ChangeSection(MCSection *, const MCExpr *) {} void MCStreamer::ChangeSection(MCSection *, const MCExpr *) {}
void MCStreamer::EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) {} void MCStreamer::emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) {}
void MCStreamer::EmitBytes(StringRef Data) {} void MCStreamer::emitBytes(StringRef Data) {}
void MCStreamer::EmitBinaryData(StringRef Data) { EmitBytes(Data); } void MCStreamer::emitBinaryData(StringRef Data) { emitBytes(Data); }
void MCStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc) { void MCStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc) {
visitUsedExpr(*Value); visitUsedExpr(*Value);
} }
@ -1125,7 +1125,7 @@ MCSymbol *MCStreamer::endSection(MCSection *Section) {
return Sym; return Sym;
} }
void MCStreamer::EmitVersionForTarget(const Triple &Target, void MCStreamer::emitVersionForTarget(const Triple &Target,
const VersionTuple &SDKVersion) { const VersionTuple &SDKVersion) {
if (!Target.isOSBinFormatMachO() || !Target.isOSDarwin()) if (!Target.isOSBinFormatMachO() || !Target.isOSDarwin())
return; return;
@ -1140,7 +1140,7 @@ void MCStreamer::EmitVersionForTarget(const Triple &Target,
// Mac Catalyst always uses the build version load command. // Mac Catalyst always uses the build version load command.
Target.getiOSVersion(Major, Minor, Update); Target.getiOSVersion(Major, Minor, Update);
assert(Major && "A non-zero major version is expected"); assert(Major && "A non-zero major version is expected");
EmitBuildVersion(MachO::PLATFORM_MACCATALYST, Major, Minor, Update, emitBuildVersion(MachO::PLATFORM_MACCATALYST, Major, Minor, Update,
SDKVersion); SDKVersion);
return; return;
} }
@ -1161,5 +1161,5 @@ void MCStreamer::EmitVersionForTarget(const Triple &Target,
Target.getiOSVersion(Major, Minor, Update); Target.getiOSVersion(Major, Minor, Update);
} }
if (Major != 0) if (Major != 0)
EmitVersionMin(VersionType, Major, Minor, Update, SDKVersion); emitVersionMin(VersionType, Major, Minor, Update, SDKVersion);
} }

View File

@ -49,7 +49,7 @@ void MCWasmStreamer::mergeFragment(MCDataFragment *DF, MCDataFragment *EF) {
DF->getContents().append(EF->getContents().begin(), EF->getContents().end()); DF->getContents().append(EF->getContents().begin(), EF->getContents().end());
} }
void MCWasmStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) { void MCWasmStreamer::emitAssemblerFlag(MCAssemblerFlag Flag) {
// Let the target do whatever target specific stuff it needs to do. // Let the target do whatever target specific stuff it needs to do.
getAssembler().getBackend().handleAssemblerFlag(Flag); getAssembler().getBackend().handleAssemblerFlag(Flag);
@ -69,7 +69,7 @@ void MCWasmStreamer::ChangeSection(MCSection *Section,
Asm.registerSymbol(*Section->getBeginSymbol()); Asm.registerSymbol(*Section->getBeginSymbol());
} }
void MCWasmStreamer::EmitWeakReference(MCSymbol *Alias, void MCWasmStreamer::emitWeakReference(MCSymbol *Alias,
const MCSymbol *Symbol) { const MCSymbol *Symbol) {
getAssembler().registerSymbol(*Symbol); getAssembler().registerSymbol(*Symbol);
const MCExpr *Value = MCSymbolRefExpr::create( const MCExpr *Value = MCSymbolRefExpr::create(
@ -77,7 +77,7 @@ void MCWasmStreamer::EmitWeakReference(MCSymbol *Alias,
Alias->setVariableValue(Value); Alias->setVariableValue(Value);
} }
bool MCWasmStreamer::EmitSymbolAttribute(MCSymbol *S, MCSymbolAttr Attribute) { bool MCWasmStreamer::emitSymbolAttribute(MCSymbol *S, MCSymbolAttr Attribute) {
assert(Attribute != MCSA_IndirectSymbol && "indirect symbols not supported"); assert(Attribute != MCSA_IndirectSymbol && "indirect symbols not supported");
auto *Symbol = cast<MCSymbolWasm>(S); auto *Symbol = cast<MCSymbolWasm>(S);
@ -134,7 +134,7 @@ bool MCWasmStreamer::EmitSymbolAttribute(MCSymbol *S, MCSymbolAttr Attribute) {
return true; return true;
} }
void MCWasmStreamer::EmitCommonSymbol(MCSymbol *S, uint64_t Size, void MCWasmStreamer::emitCommonSymbol(MCSymbol *S, uint64_t Size,
unsigned ByteAlignment) { unsigned ByteAlignment) {
llvm_unreachable("Common symbols are not yet implemented for Wasm"); llvm_unreachable("Common symbols are not yet implemented for Wasm");
} }
@ -143,7 +143,7 @@ void MCWasmStreamer::emitELFSize(MCSymbol *Symbol, const MCExpr *Value) {
cast<MCSymbolWasm>(Symbol)->setSize(Value); cast<MCSymbolWasm>(Symbol)->setSize(Value);
} }
void MCWasmStreamer::EmitLocalCommonSymbol(MCSymbol *S, uint64_t Size, void MCWasmStreamer::emitLocalCommonSymbol(MCSymbol *S, uint64_t Size,
unsigned ByteAlignment) { unsigned ByteAlignment) {
llvm_unreachable("Local common symbols are not yet implemented for Wasm"); llvm_unreachable("Local common symbols are not yet implemented for Wasm");
} }
@ -209,15 +209,15 @@ MCStreamer *llvm::createWasmStreamer(MCContext &Context,
return S; return S;
} }
void MCWasmStreamer::EmitThumbFunc(MCSymbol *Func) { void MCWasmStreamer::emitThumbFunc(MCSymbol *Func) {
llvm_unreachable("Generic Wasm doesn't support this directive"); llvm_unreachable("Generic Wasm doesn't support this directive");
} }
void MCWasmStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) { void MCWasmStreamer::emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {
llvm_unreachable("Wasm doesn't support this directive"); llvm_unreachable("Wasm doesn't support this directive");
} }
void MCWasmStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol, void MCWasmStreamer::emitZerofill(MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment, uint64_t Size, unsigned ByteAlignment,
SMLoc Loc) { SMLoc Loc) {
llvm_unreachable("Wasm doesn't support this directive"); llvm_unreachable("Wasm doesn't support this directive");

View File

@ -87,7 +87,7 @@ void MCWinCOFFStreamer::EmitLabel(MCSymbol *S, SMLoc Loc) {
MCObjectStreamer::EmitLabel(Symbol, Loc); MCObjectStreamer::EmitLabel(Symbol, Loc);
} }
void MCWinCOFFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) { void MCWinCOFFStreamer::emitAssemblerFlag(MCAssemblerFlag Flag) {
// Let the target do whatever target specific stuff it needs to do. // Let the target do whatever target specific stuff it needs to do.
getAssembler().getBackend().handleAssemblerFlag(Flag); getAssembler().getBackend().handleAssemblerFlag(Flag);
@ -103,11 +103,11 @@ void MCWinCOFFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
} }
} }
void MCWinCOFFStreamer::EmitThumbFunc(MCSymbol *Func) { void MCWinCOFFStreamer::emitThumbFunc(MCSymbol *Func) {
llvm_unreachable("not implemented"); llvm_unreachable("not implemented");
} }
bool MCWinCOFFStreamer::EmitSymbolAttribute(MCSymbol *S, bool MCWinCOFFStreamer::emitSymbolAttribute(MCSymbol *S,
MCSymbolAttr Attribute) { MCSymbolAttr Attribute) {
auto *Symbol = cast<MCSymbolCOFF>(S); auto *Symbol = cast<MCSymbolCOFF>(S);
getAssembler().registerSymbol(*Symbol); getAssembler().registerSymbol(*Symbol);
@ -129,7 +129,7 @@ bool MCWinCOFFStreamer::EmitSymbolAttribute(MCSymbol *S,
return true; return true;
} }
void MCWinCOFFStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) { void MCWinCOFFStreamer::emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {
llvm_unreachable("not implemented"); llvm_unreachable("not implemented");
} }
@ -262,7 +262,7 @@ void MCWinCOFFStreamer::EmitCOFFImgRel32(const MCSymbol *Symbol,
DF->getContents().resize(DF->getContents().size() + 4, 0); DF->getContents().resize(DF->getContents().size() + 4, 0);
} }
void MCWinCOFFStreamer::EmitCommonSymbol(MCSymbol *S, uint64_t Size, void MCWinCOFFStreamer::emitCommonSymbol(MCSymbol *S, uint64_t Size,
unsigned ByteAlignment) { unsigned ByteAlignment) {
auto *Symbol = cast<MCSymbolCOFF>(S); auto *Symbol = cast<MCSymbolCOFF>(S);
@ -289,12 +289,12 @@ void MCWinCOFFStreamer::EmitCommonSymbol(MCSymbol *S, uint64_t Size,
PushSection(); PushSection();
SwitchSection(MFI->getDrectveSection()); SwitchSection(MFI->getDrectveSection());
EmitBytes(Directive); emitBytes(Directive);
PopSection(); PopSection();
} }
} }
void MCWinCOFFStreamer::EmitLocalCommonSymbol(MCSymbol *S, uint64_t Size, void MCWinCOFFStreamer::emitLocalCommonSymbol(MCSymbol *S, uint64_t Size,
unsigned ByteAlignment) { unsigned ByteAlignment) {
auto *Symbol = cast<MCSymbolCOFF>(S); auto *Symbol = cast<MCSymbolCOFF>(S);
@ -308,7 +308,7 @@ void MCWinCOFFStreamer::EmitLocalCommonSymbol(MCSymbol *S, uint64_t Size,
PopSection(); PopSection();
} }
void MCWinCOFFStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol, void MCWinCOFFStreamer::emitZerofill(MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment, uint64_t Size, unsigned ByteAlignment,
SMLoc Loc) { SMLoc Loc) {
llvm_unreachable("not implemented"); llvm_unreachable("not implemented");

View File

@ -27,7 +27,7 @@ MCXCOFFStreamer::MCXCOFFStreamer(MCContext &Context,
: MCObjectStreamer(Context, std::move(MAB), std::move(OW), : MCObjectStreamer(Context, std::move(MAB), std::move(OW),
std::move(Emitter)) {} std::move(Emitter)) {}
bool MCXCOFFStreamer::EmitSymbolAttribute(MCSymbol *Sym, bool MCXCOFFStreamer::emitSymbolAttribute(MCSymbol *Sym,
MCSymbolAttr Attribute) { MCSymbolAttr Attribute) {
auto *Symbol = cast<MCSymbolXCOFF>(Sym); auto *Symbol = cast<MCSymbolXCOFF>(Sym);
getAssembler().registerSymbol(*Symbol); getAssembler().registerSymbol(*Symbol);
@ -43,7 +43,7 @@ bool MCXCOFFStreamer::EmitSymbolAttribute(MCSymbol *Sym,
return true; return true;
} }
void MCXCOFFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, void MCXCOFFStreamer::emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) { unsigned ByteAlignment) {
getAssembler().registerSymbol(*Symbol); getAssembler().registerSymbol(*Symbol);
Symbol->setExternal(cast<MCSymbolXCOFF>(Symbol)->getStorageClass() != Symbol->setExternal(cast<MCSymbolXCOFF>(Symbol)->getStorageClass() !=
@ -55,7 +55,7 @@ void MCXCOFFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
EmitZeros(Size); EmitZeros(Size);
} }
void MCXCOFFStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol, void MCXCOFFStreamer::emitZerofill(MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment, uint64_t Size, unsigned ByteAlignment,
SMLoc Loc) { SMLoc Loc) {
report_fatal_error("Zero fill not implemented for XCOFF."); report_fatal_error("Zero fill not implemented for XCOFF.");
@ -98,5 +98,5 @@ void MCXCOFFStreamer::EmitXCOFFLocalCommonSymbol(MCSymbol *LabelSym,
uint64_t Size, uint64_t Size,
MCSymbol *CsectSym, MCSymbol *CsectSym,
unsigned ByteAlignment) { unsigned ByteAlignment) {
EmitCommonSymbol(CsectSym, Size, ByteAlignment); emitCommonSymbol(CsectSym, Size, ByteAlignment);
} }

View File

@ -91,12 +91,12 @@ void RecordStreamer::EmitLabel(MCSymbol *Symbol, SMLoc Loc) {
markDefined(*Symbol); markDefined(*Symbol);
} }
void RecordStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) { void RecordStreamer::emitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
markDefined(*Symbol); markDefined(*Symbol);
MCStreamer::EmitAssignment(Symbol, Value); MCStreamer::emitAssignment(Symbol, Value);
} }
bool RecordStreamer::EmitSymbolAttribute(MCSymbol *Symbol, bool RecordStreamer::emitSymbolAttribute(MCSymbol *Symbol,
MCSymbolAttr Attribute) { MCSymbolAttr Attribute) {
if (Attribute == MCSA_Global || Attribute == MCSA_Weak) if (Attribute == MCSA_Global || Attribute == MCSA_Weak)
markGlobal(*Symbol, Attribute); markGlobal(*Symbol, Attribute);
@ -105,13 +105,13 @@ bool RecordStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
return true; return true;
} }
void RecordStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol, void RecordStreamer::emitZerofill(MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment, uint64_t Size, unsigned ByteAlignment,
SMLoc Loc) { SMLoc Loc) {
markDefined(*Symbol); markDefined(*Symbol);
} }
void RecordStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, void RecordStreamer::emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) { unsigned ByteAlignment) {
markDefined(*Symbol); markDefined(*Symbol);
} }
@ -224,9 +224,9 @@ void RecordStreamer::flushSymverDirectives() {
if (IsDefined) if (IsDefined)
markDefined(*Alias); markDefined(*Alias);
// Don't use EmitAssignment override as it always marks alias as defined. // Don't use EmitAssignment override as it always marks alias as defined.
MCStreamer::EmitAssignment(Alias, Value); MCStreamer::emitAssignment(Alias, Value);
if (Attr != MCSA_Invalid) if (Attr != MCSA_Invalid)
EmitSymbolAttribute(Alias, Attr); emitSymbolAttribute(Alias, Attr);
} }
} }
} }

View File

@ -48,11 +48,11 @@ public:
void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override; void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override;
void EmitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override; void EmitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override;
void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) override; void emitAssignment(MCSymbol *Symbol, const MCExpr *Value) override;
bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override; bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
void EmitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size, void emitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment, SMLoc Loc = SMLoc()) override; unsigned ByteAlignment, SMLoc Loc = SMLoc()) override;
void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override; unsigned ByteAlignment) override;
// Ignore COFF-specific directives; we do not need any information from them, // Ignore COFF-specific directives; we do not need any information from them,

View File

@ -229,7 +229,7 @@ void AArch64AsmPrinter::emitStartOfAsmFile(Module &M) {
OutStreamer->EmitIntValue(4, 4); // data size for "GNU\0" OutStreamer->EmitIntValue(4, 4); // data size for "GNU\0"
OutStreamer->EmitIntValue(4 * 4, 4); // Elf_Prop size OutStreamer->EmitIntValue(4 * 4, 4); // Elf_Prop size
OutStreamer->EmitIntValue(ELF::NT_GNU_PROPERTY_TYPE_0, 4); OutStreamer->EmitIntValue(ELF::NT_GNU_PROPERTY_TYPE_0, 4);
OutStreamer->EmitBytes(StringRef("GNU", 4)); // note name OutStreamer->emitBytes(StringRef("GNU", 4)); // note name
// Emit the PAC/BTI properties. // Emit the PAC/BTI properties.
OutStreamer->EmitIntValue(ELF::GNU_PROPERTY_AARCH64_FEATURE_1_AND, 4); OutStreamer->EmitIntValue(ELF::GNU_PROPERTY_AARCH64_FEATURE_1_AND, 4);
@ -363,9 +363,9 @@ void AArch64AsmPrinter::EmitHwasanMemaccessSymbols(Module &M) {
ELF::SHF_EXECINSTR | ELF::SHF_ALLOC | ELF::SHF_GROUP, 0, ELF::SHF_EXECINSTR | ELF::SHF_ALLOC | ELF::SHF_GROUP, 0,
Sym->getName())); Sym->getName()));
OutStreamer->EmitSymbolAttribute(Sym, MCSA_ELF_TypeFunction); OutStreamer->emitSymbolAttribute(Sym, MCSA_ELF_TypeFunction);
OutStreamer->EmitSymbolAttribute(Sym, MCSA_Weak); OutStreamer->emitSymbolAttribute(Sym, MCSA_Weak);
OutStreamer->EmitSymbolAttribute(Sym, MCSA_Hidden); OutStreamer->emitSymbolAttribute(Sym, MCSA_Hidden);
OutStreamer->EmitLabel(Sym); OutStreamer->EmitLabel(Sym);
OutStreamer->emitInstruction(MCInstBuilder(AArch64::UBFMXri) OutStreamer->emitInstruction(MCInstBuilder(AArch64::UBFMXri)
@ -528,7 +528,7 @@ void AArch64AsmPrinter::emitEndOfAsmFile(Module &M) {
// implementation of multiple entry points). If this doesn't occur, the // implementation of multiple entry points). If this doesn't occur, the
// linker can safely perform dead code stripping. Since LLVM never // linker can safely perform dead code stripping. Since LLVM never
// generates code that does this, it is always safe to set. // generates code that does this, it is always safe to set.
OutStreamer->EmitAssemblerFlag(MCAF_SubsectionsViaSymbols); OutStreamer->emitAssemblerFlag(MCAF_SubsectionsViaSymbols);
} }
emitStackMaps(SM); emitStackMaps(SM);
} }
@ -543,7 +543,7 @@ void AArch64AsmPrinter::EmitLOHs() {
"Label hasn't been inserted for LOH related instruction"); "Label hasn't been inserted for LOH related instruction");
MCArgs.push_back(LabelIt->second); MCArgs.push_back(LabelIt->second);
} }
OutStreamer->EmitLOHDirective(D.getKind(), MCArgs); OutStreamer->emitLOHDirective(D.getKind(), MCArgs);
MCArgs.clear(); MCArgs.clear();
} }
} }

View File

@ -5373,7 +5373,7 @@ bool AArch64AsmParser::parseDirectiveLOH(StringRef IDVal, SMLoc Loc) {
"unexpected token in '" + Twine(IDVal) + "' directive")) "unexpected token in '" + Twine(IDVal) + "' directive"))
return true; return true;
getStreamer().EmitLOHDirective((MCLOHType)Kind, Args); getStreamer().emitLOHDirective((MCLOHType)Kind, Args);
return false; return false;
} }

View File

@ -122,28 +122,28 @@ public:
} }
EmitA64MappingSymbol(); EmitA64MappingSymbol();
MCELFStreamer::EmitBytes(StringRef(Buffer, 4)); MCELFStreamer::emitBytes(StringRef(Buffer, 4));
} }
/// This is one of the functions used to emit data into an ELF section, so the /// This is one of the functions used to emit data into an ELF section, so the
/// AArch64 streamer overrides it to add the appropriate mapping symbol ($d) /// AArch64 streamer overrides it to add the appropriate mapping symbol ($d)
/// if necessary. /// if necessary.
void EmitBytes(StringRef Data) override { void emitBytes(StringRef Data) override {
EmitDataMappingSymbol(); emitDataMappingSymbol();
MCELFStreamer::EmitBytes(Data); MCELFStreamer::emitBytes(Data);
} }
/// This is one of the functions used to emit data into an ELF section, so the /// This is one of the functions used to emit data into an ELF section, so the
/// AArch64 streamer overrides it to add the appropriate mapping symbol ($d) /// AArch64 streamer overrides it to add the appropriate mapping symbol ($d)
/// if necessary. /// if necessary.
void EmitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc) override { void EmitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc) override {
EmitDataMappingSymbol(); emitDataMappingSymbol();
MCELFStreamer::EmitValueImpl(Value, Size, Loc); MCELFStreamer::EmitValueImpl(Value, Size, Loc);
} }
void emitFill(const MCExpr &NumBytes, uint64_t FillValue, void emitFill(const MCExpr &NumBytes, uint64_t FillValue,
SMLoc Loc) override { SMLoc Loc) override {
EmitDataMappingSymbol(); emitDataMappingSymbol();
MCObjectStreamer::emitFill(NumBytes, FillValue, Loc); MCObjectStreamer::emitFill(NumBytes, FillValue, Loc);
} }
private: private:
@ -153,7 +153,7 @@ private:
EMS_Data EMS_Data
}; };
void EmitDataMappingSymbol() { void emitDataMappingSymbol() {
if (LastEMS == EMS_Data) if (LastEMS == EMS_Data)
return; return;
EmitMappingSymbol("$d"); EmitMappingSymbol("$d");

View File

@ -51,7 +51,7 @@ void AArch64TargetStreamer::emitInst(uint32_t Inst) {
Inst >>= 8; Inst >>= 8;
} }
getStreamer().EmitBytes(StringRef(Buffer, 4)); getStreamer().emitBytes(StringRef(Buffer, 4));
} }
namespace llvm { namespace llvm {

View File

@ -550,8 +550,8 @@ bool AMDGPUAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
Comment += " ; " + HexLines[i] + "\n"; Comment += " ; " + HexLines[i] + "\n";
} }
OutStreamer->EmitBytes(StringRef(DisasmLines[i])); OutStreamer->emitBytes(StringRef(DisasmLines[i]));
OutStreamer->EmitBytes(StringRef(Comment)); OutStreamer->emitBytes(StringRef(Comment));
} }
} }

View File

@ -427,7 +427,7 @@ void AMDGPUTargetELFStreamer::finish() {
if (Blob.empty()) if (Blob.empty())
return; return;
EmitNote(Vendor, MCConstantExpr::create(Blob.size(), getContext()), Type, EmitNote(Vendor, MCConstantExpr::create(Blob.size(), getContext()), Type,
[&](MCELFStreamer &OS) { OS.EmitBytes(Blob); }); [&](MCELFStreamer &OS) { OS.emitBytes(Blob); });
} }
void AMDGPUTargetELFStreamer::EmitNote( void AMDGPUTargetELFStreamer::EmitNote(
@ -444,7 +444,7 @@ void AMDGPUTargetELFStreamer::EmitNote(
S.EmitIntValue(NameSZ, 4); // namesz S.EmitIntValue(NameSZ, 4); // namesz
S.EmitValue(DescSZ, 4); // descz S.EmitValue(DescSZ, 4); // descz
S.EmitIntValue(NoteType, 4); // type S.EmitIntValue(NoteType, 4); // type
S.EmitBytes(Name); // name S.emitBytes(Name); // name
S.EmitValueToAlignment(4, 0, 1, 0); // padding 0 S.EmitValueToAlignment(4, 0, 1, 0); // padding 0
EmitDesc(S); // desc EmitDesc(S); // desc
S.EmitValueToAlignment(4, 0, 1, 0); // padding 0 S.EmitValueToAlignment(4, 0, 1, 0); // padding 0
@ -483,9 +483,9 @@ AMDGPUTargetELFStreamer::EmitDirectiveHSACodeObjectISA(uint32_t Major,
OS.EmitIntValue(Major, 4); OS.EmitIntValue(Major, 4);
OS.EmitIntValue(Minor, 4); OS.EmitIntValue(Minor, 4);
OS.EmitIntValue(Stepping, 4); OS.EmitIntValue(Stepping, 4);
OS.EmitBytes(VendorName); OS.emitBytes(VendorName);
OS.EmitIntValue(0, 1); // NULL terminate VendorName OS.EmitIntValue(0, 1); // NULL terminate VendorName
OS.EmitBytes(ArchName); OS.emitBytes(ArchName);
OS.EmitIntValue(0, 1); // NULL terminte ArchName OS.EmitIntValue(0, 1); // NULL terminte ArchName
}); });
} }
@ -495,7 +495,7 @@ AMDGPUTargetELFStreamer::EmitAMDKernelCodeT(const amd_kernel_code_t &Header) {
MCStreamer &OS = getStreamer(); MCStreamer &OS = getStreamer();
OS.PushSection(); OS.PushSection();
OS.EmitBytes(StringRef((const char*)&Header, sizeof(Header))); OS.emitBytes(StringRef((const char*)&Header, sizeof(Header)));
OS.PopSection(); OS.PopSection();
} }
@ -540,7 +540,7 @@ bool AMDGPUTargetELFStreamer::EmitISAVersion(StringRef IsaVersionString) {
EmitNote(ElfNote::NoteNameV2, DescSZ, ELF::NT_AMD_AMDGPU_ISA, EmitNote(ElfNote::NoteNameV2, DescSZ, ELF::NT_AMD_AMDGPU_ISA,
[&](MCELFStreamer &OS) { [&](MCELFStreamer &OS) {
OS.EmitLabel(DescBegin); OS.EmitLabel(DescBegin);
OS.EmitBytes(IsaVersionString); OS.emitBytes(IsaVersionString);
OS.EmitLabel(DescEnd); OS.EmitLabel(DescEnd);
}); });
return true; return true;
@ -567,7 +567,7 @@ bool AMDGPUTargetELFStreamer::EmitHSAMetadata(msgpack::Document &HSAMetadataDoc,
EmitNote(ElfNote::NoteNameV3, DescSZ, ELF::NT_AMDGPU_METADATA, EmitNote(ElfNote::NoteNameV3, DescSZ, ELF::NT_AMDGPU_METADATA,
[&](MCELFStreamer &OS) { [&](MCELFStreamer &OS) {
OS.EmitLabel(DescBegin); OS.EmitLabel(DescBegin);
OS.EmitBytes(HSAMetadataString); OS.emitBytes(HSAMetadataString);
OS.EmitLabel(DescEnd); OS.EmitLabel(DescEnd);
}); });
return true; return true;
@ -591,7 +591,7 @@ bool AMDGPUTargetELFStreamer::EmitHSAMetadata(
EmitNote(ElfNote::NoteNameV2, DescSZ, ELF::NT_AMD_AMDGPU_HSA_METADATA, EmitNote(ElfNote::NoteNameV2, DescSZ, ELF::NT_AMD_AMDGPU_HSA_METADATA,
[&](MCELFStreamer &OS) { [&](MCELFStreamer &OS) {
OS.EmitLabel(DescBegin); OS.EmitLabel(DescBegin);
OS.EmitBytes(HSAMetadataString); OS.emitBytes(HSAMetadataString);
OS.EmitLabel(DescEnd); OS.EmitLabel(DescEnd);
}); });
return true; return true;
@ -638,7 +638,7 @@ void AMDGPUTargetELFStreamer::EmitAmdhsaKernelDescriptor(
KernelCodeSymbol->setVisibility(ELF::STV_PROTECTED); KernelCodeSymbol->setVisibility(ELF::STV_PROTECTED);
Streamer.EmitLabel(KernelDescriptorSymbol); Streamer.EmitLabel(KernelDescriptorSymbol);
Streamer.EmitBytes(StringRef( Streamer.emitBytes(StringRef(
(const char*)&(KernelDescriptor), (const char*)&(KernelDescriptor),
offsetof(amdhsa::kernel_descriptor_t, kernel_code_entry_byte_offset))); offsetof(amdhsa::kernel_descriptor_t, kernel_code_entry_byte_offset)));
// FIXME: Remove the use of VK_AMDGPU_REL64 in the expression below. The // FIXME: Remove the use of VK_AMDGPU_REL64 in the expression below. The
@ -652,7 +652,7 @@ void AMDGPUTargetELFStreamer::EmitAmdhsaKernelDescriptor(
KernelDescriptorSymbol, MCSymbolRefExpr::VK_None, Context), KernelDescriptorSymbol, MCSymbolRefExpr::VK_None, Context),
Context), Context),
sizeof(KernelDescriptor.kernel_code_entry_byte_offset)); sizeof(KernelDescriptor.kernel_code_entry_byte_offset));
Streamer.EmitBytes(StringRef( Streamer.emitBytes(StringRef(
(const char*)&(KernelDescriptor) + (const char*)&(KernelDescriptor) +
offsetof(amdhsa::kernel_descriptor_t, kernel_code_entry_byte_offset) + offsetof(amdhsa::kernel_descriptor_t, kernel_code_entry_byte_offset) +
sizeof(KernelDescriptor.kernel_code_entry_byte_offset), sizeof(KernelDescriptor.kernel_code_entry_byte_offset),

View File

@ -63,15 +63,15 @@ void ARMAsmPrinter::emitFunctionBodyEnd() {
if (!InConstantPool) if (!InConstantPool)
return; return;
InConstantPool = false; InConstantPool = false;
OutStreamer->EmitDataRegion(MCDR_DataRegionEnd); OutStreamer->emitDataRegion(MCDR_DataRegionEnd);
} }
void ARMAsmPrinter::emitFunctionEntryLabel() { void ARMAsmPrinter::emitFunctionEntryLabel() {
if (AFI->isThumbFunction()) { if (AFI->isThumbFunction()) {
OutStreamer->EmitAssemblerFlag(MCAF_Code16); OutStreamer->emitAssemblerFlag(MCAF_Code16);
OutStreamer->EmitThumbFunc(CurrentFnSym); OutStreamer->emitThumbFunc(CurrentFnSym);
} else { } else {
OutStreamer->EmitAssemblerFlag(MCAF_Code32); OutStreamer->emitAssemblerFlag(MCAF_Code32);
} }
OutStreamer->EmitLabel(CurrentFnSym); OutStreamer->EmitLabel(CurrentFnSym);
} }
@ -167,7 +167,7 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
// These are created per function, rather than per TU, since it's // These are created per function, rather than per TU, since it's
// relatively easy to exceed the thumb branch range within a TU. // relatively easy to exceed the thumb branch range within a TU.
if (! ThumbIndirectPads.empty()) { if (! ThumbIndirectPads.empty()) {
OutStreamer->EmitAssemblerFlag(MCAF_Code16); OutStreamer->emitAssemblerFlag(MCAF_Code16);
emitAlignment(Align(2)); emitAlignment(Align(2));
for (std::pair<unsigned, MCSymbol *> &TIP : ThumbIndirectPads) { for (std::pair<unsigned, MCSymbol *> &TIP : ThumbIndirectPads) {
OutStreamer->EmitLabel(TIP.second); OutStreamer->EmitLabel(TIP.second);
@ -467,14 +467,14 @@ void ARMAsmPrinter::emitInlineAsmEnd(const MCSubtargetInfo &StartInfo,
// the start mode, then restore the start mode. // the start mode, then restore the start mode.
const bool WasThumb = isThumb(StartInfo); const bool WasThumb = isThumb(StartInfo);
if (!EndInfo || WasThumb != isThumb(*EndInfo)) { if (!EndInfo || WasThumb != isThumb(*EndInfo)) {
OutStreamer->EmitAssemblerFlag(WasThumb ? MCAF_Code16 : MCAF_Code32); OutStreamer->emitAssemblerFlag(WasThumb ? MCAF_Code16 : MCAF_Code32);
} }
} }
void ARMAsmPrinter::emitStartOfAsmFile(Module &M) { void ARMAsmPrinter::emitStartOfAsmFile(Module &M) {
const Triple &TT = TM.getTargetTriple(); const Triple &TT = TM.getTargetTriple();
// Use unified assembler syntax. // Use unified assembler syntax.
OutStreamer->EmitAssemblerFlag(MCAF_SyntaxUnified); OutStreamer->emitAssemblerFlag(MCAF_SyntaxUnified);
// Emit ARM Build Attributes // Emit ARM Build Attributes
if (TT.isOSBinFormatELF()) if (TT.isOSBinFormatELF())
@ -484,7 +484,7 @@ void ARMAsmPrinter::emitStartOfAsmFile(Module &M) {
// if we're thumb for the purposes of the top level code16 assembler // if we're thumb for the purposes of the top level code16 assembler
// flag. // flag.
if (!M.getModuleInlineAsm().empty() && TT.isThumb()) if (!M.getModuleInlineAsm().empty() && TT.isThumb())
OutStreamer->EmitAssemblerFlag(MCAF_Code16); OutStreamer->emitAssemblerFlag(MCAF_Code16);
} }
static void static void
@ -493,7 +493,7 @@ emitNonLazySymbolPointer(MCStreamer &OutStreamer, MCSymbol *StubLabel,
// L_foo$stub: // L_foo$stub:
OutStreamer.EmitLabel(StubLabel); OutStreamer.EmitLabel(StubLabel);
// .indirect_symbol _foo // .indirect_symbol _foo
OutStreamer.EmitSymbolAttribute(MCSym.getPointer(), MCSA_IndirectSymbol); OutStreamer.emitSymbolAttribute(MCSym.getPointer(), MCSA_IndirectSymbol);
if (MCSym.getInt()) if (MCSym.getInt())
// External to current translation unit. // External to current translation unit.
@ -553,7 +553,7 @@ void ARMAsmPrinter::emitEndOfAsmFile(Module &M) {
// implementation of multiple entry points). If this doesn't occur, the // implementation of multiple entry points). If this doesn't occur, the
// linker can safely perform dead code stripping. Since LLVM never // linker can safely perform dead code stripping. Since LLVM never
// generates code that does this, it is always safe to set. // generates code that does this, it is always safe to set.
OutStreamer->EmitAssemblerFlag(MCAF_SubsectionsViaSymbols); OutStreamer->emitAssemblerFlag(MCAF_SubsectionsViaSymbols);
} }
// The last attribute to be emitted is ABI_optimization_goals // The last attribute to be emitted is ABI_optimization_goals
@ -948,7 +948,7 @@ void ARMAsmPrinter::emitJumpTableAddrs(const MachineInstr *MI) {
OutStreamer->EmitLabel(JTISymbol); OutStreamer->EmitLabel(JTISymbol);
// Mark the jump table as data-in-code. // Mark the jump table as data-in-code.
OutStreamer->EmitDataRegion(MCDR_DataRegionJT32); OutStreamer->emitDataRegion(MCDR_DataRegionJT32);
// Emit each entry of the table. // Emit each entry of the table.
const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo(); const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo();
@ -978,7 +978,7 @@ void ARMAsmPrinter::emitJumpTableAddrs(const MachineInstr *MI) {
OutStreamer->EmitValue(Expr, 4); OutStreamer->EmitValue(Expr, 4);
} }
// Mark the end of jump table data-in-code region. // Mark the end of jump table data-in-code region.
OutStreamer->EmitDataRegion(MCDR_DataRegionEnd); OutStreamer->emitDataRegion(MCDR_DataRegionEnd);
} }
void ARMAsmPrinter::emitJumpTableInsts(const MachineInstr *MI) { void ARMAsmPrinter::emitJumpTableInsts(const MachineInstr *MI) {
@ -1027,7 +1027,7 @@ void ARMAsmPrinter::emitJumpTableTBInst(const MachineInstr *MI,
const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs; const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
// Mark the jump table as data-in-code. // Mark the jump table as data-in-code.
OutStreamer->EmitDataRegion(OffsetWidth == 1 ? MCDR_DataRegionJT8 OutStreamer->emitDataRegion(OffsetWidth == 1 ? MCDR_DataRegionJT8
: MCDR_DataRegionJT16); : MCDR_DataRegionJT16);
for (auto MBB : JTBBs) { for (auto MBB : JTBBs) {
@ -1056,7 +1056,7 @@ void ARMAsmPrinter::emitJumpTableTBInst(const MachineInstr *MI,
// Mark the end of jump table data-in-code region. 32-bit offsets use // Mark the end of jump table data-in-code region. 32-bit offsets use
// actual branch instructions here, so we don't mark those as a data-region // actual branch instructions here, so we don't mark those as a data-region
// at all. // at all.
OutStreamer->EmitDataRegion(MCDR_DataRegionEnd); OutStreamer->emitDataRegion(MCDR_DataRegionEnd);
// Make sure the next instruction is 2-byte aligned. // Make sure the next instruction is 2-byte aligned.
emitAlignment(Align(2)); emitAlignment(Align(2));
@ -1253,7 +1253,7 @@ void ARMAsmPrinter::emitInstruction(const MachineInstr *MI) {
// If we just ended a constant pool, mark it as such. // If we just ended a constant pool, mark it as such.
if (InConstantPool && MI->getOpcode() != ARM::CONSTPOOL_ENTRY) { if (InConstantPool && MI->getOpcode() != ARM::CONSTPOOL_ENTRY) {
OutStreamer->EmitDataRegion(MCDR_DataRegionEnd); OutStreamer->emitDataRegion(MCDR_DataRegionEnd);
InConstantPool = false; InConstantPool = false;
} }
@ -1621,7 +1621,7 @@ void ARMAsmPrinter::emitInstruction(const MachineInstr *MI) {
// If this is the first entry of the pool, mark it. // If this is the first entry of the pool, mark it.
if (!InConstantPool) { if (!InConstantPool) {
OutStreamer->EmitDataRegion(MCDR_DataRegion); OutStreamer->emitDataRegion(MCDR_DataRegion);
InConstantPool = true; InConstantPool = true;
} }

View File

@ -10648,7 +10648,7 @@ bool ARMAsmParser::parseDirectiveThumb(SMLoc L) {
if (!isThumb()) if (!isThumb())
SwitchMode(); SwitchMode();
getParser().getStreamer().EmitAssemblerFlag(MCAF_Code16); getParser().getStreamer().emitAssemblerFlag(MCAF_Code16);
return false; return false;
} }
@ -10661,7 +10661,7 @@ bool ARMAsmParser::parseDirectiveARM(SMLoc L) {
if (isThumb()) if (isThumb())
SwitchMode(); SwitchMode();
getParser().getStreamer().EmitAssemblerFlag(MCAF_Code32); getParser().getStreamer().emitAssemblerFlag(MCAF_Code32);
return false; return false;
} }
@ -10673,7 +10673,7 @@ void ARMAsmParser::doBeforeLabelEmit(MCSymbol *Symbol) {
void ARMAsmParser::onLabelParsed(MCSymbol *Symbol) { void ARMAsmParser::onLabelParsed(MCSymbol *Symbol) {
if (NextSymbolIsThumb) { if (NextSymbolIsThumb) {
getParser().getStreamer().EmitThumbFunc(Symbol); getParser().getStreamer().emitThumbFunc(Symbol);
NextSymbolIsThumb = false; NextSymbolIsThumb = false;
} }
} }
@ -10693,7 +10693,7 @@ bool ARMAsmParser::parseDirectiveThumbFunc(SMLoc L) {
Parser.getTok().is(AsmToken::String)) { Parser.getTok().is(AsmToken::String)) {
MCSymbol *Func = getParser().getContext().getOrCreateSymbol( MCSymbol *Func = getParser().getContext().getOrCreateSymbol(
Parser.getTok().getIdentifier()); Parser.getTok().getIdentifier());
getParser().getStreamer().EmitThumbFunc(Func); getParser().getStreamer().emitThumbFunc(Func);
Parser.Lex(); Parser.Lex();
if (parseToken(AsmToken::EndOfStatement, if (parseToken(AsmToken::EndOfStatement,
"unexpected token in '.thumb_func' directive")) "unexpected token in '.thumb_func' directive"))
@ -10757,14 +10757,14 @@ bool ARMAsmParser::parseDirectiveCode(SMLoc L) {
if (!isThumb()) if (!isThumb())
SwitchMode(); SwitchMode();
getParser().getStreamer().EmitAssemblerFlag(MCAF_Code16); getParser().getStreamer().emitAssemblerFlag(MCAF_Code16);
} else { } else {
if (!hasARM()) if (!hasARM())
return Error(L, "target does not support ARM mode"); return Error(L, "target does not support ARM mode");
if (isThumb()) if (isThumb())
SwitchMode(); SwitchMode();
getParser().getStreamer().EmitAssemblerFlag(MCAF_Code32); getParser().getStreamer().emitAssemblerFlag(MCAF_Code32);
} }
return false; return false;
@ -10817,7 +10817,7 @@ void ARMAsmParser::FixModeAfterArchChange(bool WasThumb, SMLoc Loc) {
SwitchMode(); SwitchMode();
} else { } else {
// Mode switch forced, because the new arch doesn't support the old mode. // Mode switch forced, because the new arch doesn't support the old mode.
getParser().getStreamer().EmitAssemblerFlag(isThumb() ? MCAF_Code16 getParser().getStreamer().emitAssemblerFlag(isThumb() ? MCAF_Code16
: MCAF_Code32); : MCAF_Code32);
// Warn about the implcit mode switch. GAS does not switch modes here, // Warn about the implcit mode switch. GAS does not switch modes here,
// but instead stays in the old mode, reporting an error on any following // but instead stays in the old mode, reporting an error on any following

View File

@ -456,7 +456,7 @@ public:
void emitUnwindRaw(int64_t Offset, const SmallVectorImpl<uint8_t> &Opcodes); void emitUnwindRaw(int64_t Offset, const SmallVectorImpl<uint8_t> &Opcodes);
void emitFill(const MCExpr &NumBytes, uint64_t FillValue, void emitFill(const MCExpr &NumBytes, uint64_t FillValue,
SMLoc Loc) override { SMLoc Loc) override {
EmitDataMappingSymbol(); emitDataMappingSymbol();
MCObjectStreamer::emitFill(NumBytes, FillValue, Loc); MCObjectStreamer::emitFill(NumBytes, FillValue, Loc);
} }
@ -521,15 +521,15 @@ public:
llvm_unreachable("Invalid Suffix"); llvm_unreachable("Invalid Suffix");
} }
MCELFStreamer::EmitBytes(StringRef(Buffer, Size)); MCELFStreamer::emitBytes(StringRef(Buffer, Size));
} }
/// This is one of the functions used to emit data into an ELF section, so the /// This is one of the functions used to emit data into an ELF section, so the
/// ARM streamer overrides it to add the appropriate mapping symbol ($d) if /// ARM streamer overrides it to add the appropriate mapping symbol ($d) if
/// necessary. /// necessary.
void EmitBytes(StringRef Data) override { void emitBytes(StringRef Data) override {
EmitDataMappingSymbol(); emitDataMappingSymbol();
MCELFStreamer::EmitBytes(Data); MCELFStreamer::emitBytes(Data);
} }
void FlushPendingMappingSymbol() { void FlushPendingMappingSymbol() {
@ -552,12 +552,12 @@ public:
getOrCreateDataFragment(); getOrCreateDataFragment();
} }
EmitDataMappingSymbol(); emitDataMappingSymbol();
MCELFStreamer::EmitValueImpl(Value, Size, Loc); MCELFStreamer::EmitValueImpl(Value, Size, Loc);
} }
void EmitAssemblerFlag(MCAssemblerFlag Flag) override { void emitAssemblerFlag(MCAssemblerFlag Flag) override {
MCELFStreamer::EmitAssemblerFlag(Flag); MCELFStreamer::emitAssemblerFlag(Flag);
switch (Flag) { switch (Flag) {
case MCAF_SyntaxUnified: case MCAF_SyntaxUnified:
@ -597,7 +597,7 @@ private:
ElfMappingSymbol State; ElfMappingSymbol State;
}; };
void EmitDataMappingSymbol() { void emitDataMappingSymbol() {
if (LastEMSInfo->State == EMS_Data) if (LastEMSInfo->State == EMS_Data)
return; return;
else if (LastEMSInfo->State == EMS_None) { else if (LastEMSInfo->State == EMS_None) {
@ -653,9 +653,9 @@ private:
Symbol->setExternal(false); Symbol->setExternal(false);
} }
void EmitThumbFunc(MCSymbol *Func) override { void emitThumbFunc(MCSymbol *Func) override {
getAssembler().setIsThumbFunc(Func); getAssembler().setIsThumbFunc(Func);
EmitSymbolAttribute(Func, MCSA_ELF_TypeFunction); emitSymbolAttribute(Func, MCSA_ELF_TypeFunction);
} }
// Helper functions for ARM exception handling directives // Helper functions for ARM exception handling directives
@ -1091,7 +1091,7 @@ void ARMTargetELFStreamer::finishAttributeSection() {
const size_t ContentsSize = calculateContentSize(); const size_t ContentsSize = calculateContentSize();
Streamer.EmitIntValue(VendorHeaderSize + TagHeaderSize + ContentsSize, 4); Streamer.EmitIntValue(VendorHeaderSize + TagHeaderSize + ContentsSize, 4);
Streamer.EmitBytes(CurrentVendor); Streamer.emitBytes(CurrentVendor);
Streamer.EmitIntValue(0, 1); // '\0' Streamer.EmitIntValue(0, 1); // '\0'
Streamer.EmitIntValue(ARMBuildAttrs::File, 1); Streamer.EmitIntValue(ARMBuildAttrs::File, 1);
@ -1108,12 +1108,12 @@ void ARMTargetELFStreamer::finishAttributeSection() {
Streamer.emitULEB128IntValue(item.IntValue); Streamer.emitULEB128IntValue(item.IntValue);
break; break;
case AttributeItem::TextAttribute: case AttributeItem::TextAttribute:
Streamer.EmitBytes(item.StringValue); Streamer.emitBytes(item.StringValue);
Streamer.EmitIntValue(0, 1); // '\0' Streamer.EmitIntValue(0, 1); // '\0'
break; break;
case AttributeItem::NumericAndTextAttributes: case AttributeItem::NumericAndTextAttributes:
Streamer.emitULEB128IntValue(item.IntValue); Streamer.emitULEB128IntValue(item.IntValue);
Streamer.EmitBytes(item.StringValue); Streamer.emitBytes(item.StringValue);
Streamer.EmitIntValue(0, 1); // '\0' Streamer.EmitIntValue(0, 1); // '\0'
break; break;
} }
@ -1131,7 +1131,7 @@ void ARMTargetELFStreamer::emitLabel(MCSymbol *Symbol) {
Streamer.getAssembler().registerSymbol(*Symbol); Streamer.getAssembler().registerSymbol(*Symbol);
unsigned Type = cast<MCSymbolELF>(Symbol)->getType(); unsigned Type = cast<MCSymbolELF>(Symbol)->getType();
if (Type == ELF::STT_FUNC || Type == ELF::STT_GNU_IFUNC) if (Type == ELF::STT_FUNC || Type == ELF::STT_GNU_IFUNC)
Streamer.EmitThumbFunc(Symbol); Streamer.emitThumbFunc(Symbol);
} }
void void
@ -1143,13 +1143,13 @@ void ARMTargetELFStreamer::emitThumbSet(MCSymbol *Symbol, const MCExpr *Value) {
if (const MCSymbolRefExpr *SRE = dyn_cast<MCSymbolRefExpr>(Value)) { if (const MCSymbolRefExpr *SRE = dyn_cast<MCSymbolRefExpr>(Value)) {
const MCSymbol &Sym = SRE->getSymbol(); const MCSymbol &Sym = SRE->getSymbol();
if (!Sym.isDefined()) { if (!Sym.isDefined()) {
getStreamer().EmitAssignment(Symbol, Value); getStreamer().emitAssignment(Symbol, Value);
return; return;
} }
} }
getStreamer().EmitThumbFunc(Symbol); getStreamer().emitThumbFunc(Symbol);
getStreamer().EmitAssignment(Symbol, Value); getStreamer().emitAssignment(Symbol, Value);
} }
void ARMTargetELFStreamer::emitInst(uint32_t Inst, char Suffix) { void ARMTargetELFStreamer::emitInst(uint32_t Inst, char Suffix) {

View File

@ -80,7 +80,7 @@ void ARMTargetStreamer::emitInst(uint32_t Inst, char Suffix) {
default: default:
llvm_unreachable("Invalid Suffix"); llvm_unreachable("Invalid Suffix");
} }
getStreamer().EmitBytes(StringRef(Buffer, Size)); getStreamer().emitBytes(StringRef(Buffer, Size));
} }
// The remaining callbacks should be handled separately by each // The remaining callbacks should be handled separately by each

View File

@ -134,7 +134,7 @@ void UnwindOpcodeAssembler::EmitSPOffset(int64_t Offset) {
uint8_t Buff[16]; uint8_t Buff[16];
Buff[0] = ARM::EHABI::UNWIND_OPCODE_INC_VSP_ULEB128; Buff[0] = ARM::EHABI::UNWIND_OPCODE_INC_VSP_ULEB128;
size_t ULEBSize = encodeULEB128((Offset - 0x204) >> 2, Buff + 1); size_t ULEBSize = encodeULEB128((Offset - 0x204) >> 2, Buff + 1);
EmitBytes(Buff, ULEBSize + 1); emitBytes(Buff, ULEBSize + 1);
} else if (Offset > 0) { } else if (Offset > 0) {
if (Offset > 0x100) { if (Offset > 0x100) {
EmitInt8(ARM::EHABI::UNWIND_OPCODE_INC_VSP | 0x3fu); EmitInt8(ARM::EHABI::UNWIND_OPCODE_INC_VSP | 0x3fu);

View File

@ -64,7 +64,7 @@ public:
OpBegins.push_back(OpBegins.back() + Opcodes.size()); OpBegins.push_back(OpBegins.back() + Opcodes.size());
} }
/// Finalize the unwind opcode sequence for EmitBytes() /// Finalize the unwind opcode sequence for emitBytes()
void Finalize(unsigned &PersonalityIndex, void Finalize(unsigned &PersonalityIndex,
SmallVectorImpl<uint8_t> &Result); SmallVectorImpl<uint8_t> &Result);
@ -80,7 +80,7 @@ private:
OpBegins.push_back(OpBegins.back() + 2); OpBegins.push_back(OpBegins.back() + 2);
} }
void EmitBytes(const uint8_t *Opcode, size_t Size) { void emitBytes(const uint8_t *Opcode, size_t Size) {
Ops.insert(Ops.end(), Opcode, Opcode + Size); Ops.insert(Ops.end(), Opcode, Opcode + Size);
OpBegins.push_back(OpBegins.back() + Size); OpBegins.push_back(OpBegins.back() + Size);
} }

View File

@ -22,11 +22,11 @@ public:
std::unique_ptr<MCObjectWriter> OW) std::unique_ptr<MCObjectWriter> OW)
: MCWinCOFFStreamer(C, std::move(AB), std::move(CE), std::move(OW)) {} : MCWinCOFFStreamer(C, std::move(AB), std::move(CE), std::move(OW)) {}
void EmitThumbFunc(MCSymbol *Symbol) override; void emitThumbFunc(MCSymbol *Symbol) override;
void FinishImpl() override; void FinishImpl() override;
}; };
void ARMWinCOFFStreamer::EmitThumbFunc(MCSymbol *Symbol) { void ARMWinCOFFStreamer::emitThumbFunc(MCSymbol *Symbol) {
getAssembler().setIsThumbFunc(Symbol); getAssembler().setIsThumbFunc(Symbol);
} }

View File

@ -32,11 +32,11 @@ void AVRTargetStreamer::finish() {
OS.emitRawComment(" Declaring this symbol tells the CRT that it should"); OS.emitRawComment(" Declaring this symbol tells the CRT that it should");
OS.emitRawComment("copy all variables from program memory to RAM on startup"); OS.emitRawComment("copy all variables from program memory to RAM on startup");
OS.EmitSymbolAttribute(DoCopyData, MCSA_Global); OS.emitSymbolAttribute(DoCopyData, MCSA_Global);
OS.emitRawComment(" Declaring this symbol tells the CRT that it should"); OS.emitRawComment(" Declaring this symbol tells the CRT that it should");
OS.emitRawComment("clear the zeroed data section on startup"); OS.emitRawComment("clear the zeroed data section on startup");
OS.EmitSymbolAttribute(DoClearBss, MCSA_Global); OS.emitSymbolAttribute(DoClearBss, MCSA_Global);
} }
} // end namespace llvm } // end namespace llvm

View File

@ -746,8 +746,8 @@ void BTFDebug::emitBTFSection() {
uint32_t StringOffset = 0; uint32_t StringOffset = 0;
for (const auto &S : StringTable.getTable()) { for (const auto &S : StringTable.getTable()) {
OS.AddComment("string offset=" + std::to_string(StringOffset)); OS.AddComment("string offset=" + std::to_string(StringOffset));
OS.EmitBytes(S); OS.emitBytes(S);
OS.EmitBytes(StringRef("\0", 1)); OS.emitBytes(StringRef("\0", 1));
StringOffset += S.size() + 1; StringOffset += S.size() + 1;
} }
} }

View File

@ -1508,7 +1508,7 @@ int HexagonAsmParser::processInstruction(MCInst &Inst,
Sym = getContext().getOrCreateSymbol(StringRef(myCharStr.c_str() + 16)); Sym = getContext().getOrCreateSymbol(StringRef(myCharStr.c_str() + 16));
if (Sym->isUndefined()) { if (Sym->isUndefined()) {
getStreamer().EmitLabel(Sym); getStreamer().EmitLabel(Sym);
getStreamer().EmitSymbolAttribute(Sym, MCSA_Global); getStreamer().emitSymbolAttribute(Sym, MCSA_Global);
getStreamer().EmitIntValue(Value, byteSize); getStreamer().EmitIntValue(Value, byteSize);
} }
} else if (MO_1.isExpr()) { } else if (MO_1.isExpr()) {
@ -1530,7 +1530,7 @@ int HexagonAsmParser::processInstruction(MCInst &Inst,
if (Sym->isUndefined()) { if (Sym->isUndefined()) {
// case where symbol is not yet defined: emit symbol // case where symbol is not yet defined: emit symbol
getStreamer().EmitLabel(Sym); getStreamer().EmitLabel(Sym);
getStreamer().EmitSymbolAttribute(Sym, MCSA_Local); getStreamer().emitSymbolAttribute(Sym, MCSA_Local);
getStreamer().EmitValue(MO_1.getExpr(), 4); getStreamer().EmitValue(MO_1.getExpr(), 4);
} }
} else } else

View File

@ -207,7 +207,7 @@ static MCSymbol *smallData(AsmPrinter &AP, const MachineInstr &MI,
Sym = AP.OutContext.getOrCreateSymbol(Twine(symbolName)); Sym = AP.OutContext.getOrCreateSymbol(Twine(symbolName));
if (Sym->isUndefined()) { if (Sym->isUndefined()) {
OutStreamer.EmitLabel(Sym); OutStreamer.EmitLabel(Sym);
OutStreamer.EmitSymbolAttribute(Sym, MCSA_Global); OutStreamer.emitSymbolAttribute(Sym, MCSA_Global);
OutStreamer.EmitIntValue(Value, AlignSize); OutStreamer.EmitIntValue(Value, AlignSize);
OutStreamer.EmitCodeAlignment(AlignSize); OutStreamer.EmitCodeAlignment(AlignSize);
} }
@ -235,7 +235,7 @@ static MCSymbol *smallData(AsmPrinter &AP, const MachineInstr &MI,
Sym = AP.OutContext.getOrCreateSymbol(Twine(LitaName)); Sym = AP.OutContext.getOrCreateSymbol(Twine(LitaName));
if (Sym->isUndefined()) { if (Sym->isUndefined()) {
OutStreamer.EmitLabel(Sym); OutStreamer.EmitLabel(Sym);
OutStreamer.EmitSymbolAttribute(Sym, MCSA_Local); OutStreamer.emitSymbolAttribute(Sym, MCSA_Local);
OutStreamer.EmitValue(Imm.getExpr(), AlignSize); OutStreamer.EmitValue(Imm.getExpr(), AlignSize);
OutStreamer.EmitCodeAlignment(AlignSize); OutStreamer.EmitCodeAlignment(AlignSize);
} }

View File

@ -18,10 +18,10 @@ public:
virtual void EmitCodeAlignment(unsigned ByteAlignment, virtual void EmitCodeAlignment(unsigned ByteAlignment,
unsigned MaxBytesToEmit = 0){}; unsigned MaxBytesToEmit = 0){};
virtual void emitFAlign(unsigned Size, unsigned MaxBytesToEmit){}; virtual void emitFAlign(unsigned Size, unsigned MaxBytesToEmit){};
virtual void EmitCommonSymbolSorted(MCSymbol *Symbol, uint64_t Size, virtual void emitCommonSymbolSorted(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment, unsigned ByteAlignment,
unsigned AccessGranularity){}; unsigned AccessGranularity){};
virtual void EmitLocalCommonSymbolSorted(MCSymbol *Symbol, uint64_t Size, virtual void emitLocalCommonSymbolSorted(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlign, unsigned ByteAlign,
unsigned AccessGranularity){}; unsigned AccessGranularity){};
}; };

View File

@ -251,7 +251,7 @@ public:
} }
void EmitCommonSymbolSorted(MCSymbol *Symbol, uint64_t Size, void emitCommonSymbolSorted(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment, unsigned ByteAlignment,
unsigned AccessSize) override { unsigned AccessSize) override {
HexagonMCELFStreamer &HexagonELFStreamer = HexagonMCELFStreamer &HexagonELFStreamer =
@ -260,7 +260,7 @@ public:
AccessSize); AccessSize);
} }
void EmitLocalCommonSymbolSorted(MCSymbol *Symbol, uint64_t Size, void emitLocalCommonSymbolSorted(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment, unsigned ByteAlignment,
unsigned AccessSize) override { unsigned AccessSize) override {
HexagonMCELFStreamer &HexagonELFStreamer = HexagonMCELFStreamer &HexagonELFStreamer =

View File

@ -431,7 +431,7 @@ bool MSP430AsmParser::ParseDirectiveRefSym(AsmToken DirectiveID) {
return TokError("expected identifier in directive"); return TokError("expected identifier in directive");
MCSymbol *Sym = getContext().getOrCreateSymbol(Name); MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
getStreamer().EmitSymbolAttribute(Sym, MCSA_Global); getStreamer().emitSymbolAttribute(Sym, MCSA_Global);
return false; return false;
} }

View File

@ -47,7 +47,7 @@ MSP430TargetELFStreamer::MSP430TargetELFStreamer(MCStreamer &S,
// Subsection length. // Subsection length.
Streamer.EmitIntValue(22, 4); Streamer.EmitIntValue(22, 4);
// Vendor name string, zero-terminated. // Vendor name string, zero-terminated.
Streamer.EmitBytes("mspabi"); Streamer.emitBytes("mspabi");
Streamer.EmitIntValue(0, 1); Streamer.EmitIntValue(0, 1);
// Attribute vector scope tag. 1 stands for the entire file. // Attribute vector scope tag. 1 stands for the entire file.

View File

@ -202,7 +202,7 @@ void MipsAsmPrinter::emitInstruction(const MachineInstr *MI) {
// If we just ended a constant pool, mark it as such. // If we just ended a constant pool, mark it as such.
if (InConstantPool && Opc != Mips::CONSTPOOL_ENTRY) { if (InConstantPool && Opc != Mips::CONSTPOOL_ENTRY) {
OutStreamer->EmitDataRegion(MCDR_DataRegionEnd); OutStreamer->emitDataRegion(MCDR_DataRegionEnd);
InConstantPool = false; InConstantPool = false;
} }
if (Opc == Mips::CONSTPOOL_ENTRY) { if (Opc == Mips::CONSTPOOL_ENTRY) {
@ -218,7 +218,7 @@ void MipsAsmPrinter::emitInstruction(const MachineInstr *MI) {
// If this is the first entry of the pool, mark it. // If this is the first entry of the pool, mark it.
if (!InConstantPool) { if (!InConstantPool) {
OutStreamer->EmitDataRegion(MCDR_DataRegion); OutStreamer->emitDataRegion(MCDR_DataRegion);
InConstantPool = true; InConstantPool = true;
} }
@ -462,7 +462,7 @@ void MipsAsmPrinter::emitFunctionBodyEnd() {
if (!InConstantPool) if (!InConstantPool)
return; return;
InConstantPool = false; InConstantPool = false;
OutStreamer->EmitDataRegion(MCDR_DataRegionEnd); OutStreamer->emitDataRegion(MCDR_DataRegionEnd);
} }
void MipsAsmPrinter::emitBasicBlockEnd(const MachineBasicBlock &MBB) { void MipsAsmPrinter::emitBasicBlockEnd(const MachineBasicBlock &MBB) {
@ -990,7 +990,7 @@ void MipsAsmPrinter::EmitFPCallStub(
// //
// .global xxxx // .global xxxx
// //
OutStreamer->EmitSymbolAttribute(MSymbol, MCSA_Global); OutStreamer->emitSymbolAttribute(MSymbol, MCSA_Global);
const char *RetType; const char *RetType;
// //
// make the comment field identifying the return and parameter // make the comment field identifying the return and parameter
@ -1073,7 +1073,7 @@ void MipsAsmPrinter::EmitFPCallStub(
TS.emitDirectiveEnt(*Stub); TS.emitDirectiveEnt(*Stub);
MCSymbol *MType = MCSymbol *MType =
OutContext.getOrCreateSymbol("__call_stub_fp_" + Twine(Symbol)); OutContext.getOrCreateSymbol("__call_stub_fp_" + Twine(Symbol));
OutStreamer->EmitSymbolAttribute(MType, MCSA_ELF_TypeFunction); OutStreamer->emitSymbolAttribute(MType, MCSA_ELF_TypeFunction);
OutStreamer->EmitLabel(Stub); OutStreamer->EmitLabel(Stub);
// Only handle non-pic for now. // Only handle non-pic for now.

View File

@ -1318,7 +1318,7 @@ void PPCLinuxAsmPrinter::emitStartOfAsmFile(Module &M) {
MCConstantExpr::create(0x8000, OutContext), MCConstantExpr::create(0x8000, OutContext),
OutContext); OutContext);
OutStreamer->EmitAssignment(TOCSym, tocExpr); OutStreamer->emitAssignment(TOCSym, tocExpr);
OutStreamer->SwitchSection(getObjFileLowering().getTextSection()); OutStreamer->SwitchSection(getObjFileLowering().getTextSection());
} }
@ -1626,7 +1626,7 @@ void PPCAIXAsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
OutStreamer->EmitXCOFFLocalCommonSymbol( OutStreamer->EmitXCOFFLocalCommonSymbol(
GVSym, Size, Csect->getQualNameSymbol(), Align); GVSym, Size, Csect->getQualNameSymbol(), Align);
else else
OutStreamer->EmitCommonSymbol(Csect->getQualNameSymbol(), Size, Align); OutStreamer->emitCommonSymbol(Csect->getQualNameSymbol(), Size, Align);
return; return;
} }

View File

@ -801,7 +801,7 @@ public:
std::string S; std::string S;
if (Parser.parseEscapedString(S)) if (Parser.parseEscapedString(S))
return error("Cannot parse string constant: ", Lexer.getTok()); return error("Cannot parse string constant: ", Lexer.getTok());
Out.EmitBytes(StringRef(S.c_str(), S.length() + 1)); Out.emitBytes(StringRef(S.c_str(), S.length() + 1));
return expect(AsmToken::EndOfStatement, "EOL"); return expect(AsmToken::EndOfStatement, "EOL");
} }

View File

@ -167,7 +167,7 @@ void WebAssemblyAsmPrinter::emitEndOfAsmFile(Module &M) {
MCSectionWasm *MySection = MCSectionWasm *MySection =
OutContext.getWasmSection(SectionName, SectionKind::getMetadata()); OutContext.getWasmSection(SectionName, SectionKind::getMetadata());
OutStreamer->SwitchSection(MySection); OutStreamer->SwitchSection(MySection);
OutStreamer->EmitBytes(Contents->getString()); OutStreamer->emitBytes(Contents->getString());
OutStreamer->PopSection(); OutStreamer->PopSection();
} }
} }
@ -214,13 +214,13 @@ void WebAssemblyAsmPrinter::EmitProducerInfo(Module &M) {
if (Producers.second->empty()) if (Producers.second->empty())
continue; continue;
OutStreamer->emitULEB128IntValue(strlen(Producers.first)); OutStreamer->emitULEB128IntValue(strlen(Producers.first));
OutStreamer->EmitBytes(Producers.first); OutStreamer->emitBytes(Producers.first);
OutStreamer->emitULEB128IntValue(Producers.second->size()); OutStreamer->emitULEB128IntValue(Producers.second->size());
for (auto &Producer : *Producers.second) { for (auto &Producer : *Producers.second) {
OutStreamer->emitULEB128IntValue(Producer.first.size()); OutStreamer->emitULEB128IntValue(Producer.first.size());
OutStreamer->EmitBytes(Producer.first); OutStreamer->emitBytes(Producer.first);
OutStreamer->emitULEB128IntValue(Producer.second.size()); OutStreamer->emitULEB128IntValue(Producer.second.size());
OutStreamer->EmitBytes(Producer.second); OutStreamer->emitBytes(Producer.second);
} }
} }
OutStreamer->PopSection(); OutStreamer->PopSection();
@ -271,7 +271,7 @@ void WebAssemblyAsmPrinter::EmitTargetFeatures(Module &M) {
for (auto &F : EmittedFeatures) { for (auto &F : EmittedFeatures) {
OutStreamer->EmitIntValue(F.Prefix, 1); OutStreamer->EmitIntValue(F.Prefix, 1);
OutStreamer->emitULEB128IntValue(F.Name.size()); OutStreamer->emitULEB128IntValue(F.Name.size());
OutStreamer->EmitBytes(F.Name); OutStreamer->emitBytes(F.Name);
} }
OutStreamer->PopSection(); OutStreamer->PopSection();

View File

@ -3752,7 +3752,7 @@ bool X86AsmParser::ParseDirectiveCode(StringRef IDVal, SMLoc L) {
Parser.Lex(); Parser.Lex();
if (!is16BitMode()) { if (!is16BitMode()) {
SwitchMode(X86::Mode16Bit); SwitchMode(X86::Mode16Bit);
getParser().getStreamer().EmitAssemblerFlag(MCAF_Code16); getParser().getStreamer().emitAssemblerFlag(MCAF_Code16);
} }
} else if (IDVal == ".code16gcc") { } else if (IDVal == ".code16gcc") {
// .code16gcc parses as if in 32-bit mode, but emits code in 16-bit mode. // .code16gcc parses as if in 32-bit mode, but emits code in 16-bit mode.
@ -3760,19 +3760,19 @@ bool X86AsmParser::ParseDirectiveCode(StringRef IDVal, SMLoc L) {
Code16GCC = true; Code16GCC = true;
if (!is16BitMode()) { if (!is16BitMode()) {
SwitchMode(X86::Mode16Bit); SwitchMode(X86::Mode16Bit);
getParser().getStreamer().EmitAssemblerFlag(MCAF_Code16); getParser().getStreamer().emitAssemblerFlag(MCAF_Code16);
} }
} else if (IDVal == ".code32") { } else if (IDVal == ".code32") {
Parser.Lex(); Parser.Lex();
if (!is32BitMode()) { if (!is32BitMode()) {
SwitchMode(X86::Mode32Bit); SwitchMode(X86::Mode32Bit);
getParser().getStreamer().EmitAssemblerFlag(MCAF_Code32); getParser().getStreamer().emitAssemblerFlag(MCAF_Code32);
} }
} else if (IDVal == ".code64") { } else if (IDVal == ".code64") {
Parser.Lex(); Parser.Lex();
if (!is64BitMode()) { if (!is64BitMode()) {
SwitchMode(X86::Mode64Bit); SwitchMode(X86::Mode64Bit);
getParser().getStreamer().EmitAssemblerFlag(MCAF_Code64); getParser().getStreamer().emitAssemblerFlag(MCAF_Code64);
} }
} else { } else {
Error(L, "unknown directive " + IDVal); Error(L, "unknown directive " + IDVal);

View File

@ -601,7 +601,7 @@ void X86AsmPrinter::emitStartOfAsmFile(Module &M) {
OutStreamer->EmitIntValue(4, 4 /*size*/); // data size for "GNU\0" OutStreamer->EmitIntValue(4, 4 /*size*/); // data size for "GNU\0"
OutStreamer->EmitIntValue(8 + WordSize, 4 /*size*/); // Elf_Prop size OutStreamer->EmitIntValue(8 + WordSize, 4 /*size*/); // Elf_Prop size
OutStreamer->EmitIntValue(ELF::NT_GNU_PROPERTY_TYPE_0, 4 /*size*/); OutStreamer->EmitIntValue(ELF::NT_GNU_PROPERTY_TYPE_0, 4 /*size*/);
OutStreamer->EmitBytes(StringRef("GNU", 4)); // note name OutStreamer->emitBytes(StringRef("GNU", 4)); // note name
// Emitting an Elf_Prop for the CET properties. // Emitting an Elf_Prop for the CET properties.
OutStreamer->EmitIntValue(ELF::GNU_PROPERTY_X86_FEATURE_1_AND, 4); OutStreamer->EmitIntValue(ELF::GNU_PROPERTY_X86_FEATURE_1_AND, 4);
@ -639,8 +639,8 @@ void X86AsmPrinter::emitStartOfAsmFile(Module &M) {
if (M.getModuleFlag("cfguard")) if (M.getModuleFlag("cfguard"))
Feat00Flags |= 0x800; // Object is CFG-aware. Feat00Flags |= 0x800; // Object is CFG-aware.
OutStreamer->EmitSymbolAttribute(S, MCSA_Global); OutStreamer->emitSymbolAttribute(S, MCSA_Global);
OutStreamer->EmitAssignment( OutStreamer->emitAssignment(
S, MCConstantExpr::create(Feat00Flags, MMI->getContext())); S, MCConstantExpr::create(Feat00Flags, MMI->getContext()));
} }
OutStreamer->EmitSyntaxDirective(); OutStreamer->EmitSyntaxDirective();
@ -649,7 +649,7 @@ void X86AsmPrinter::emitStartOfAsmFile(Module &M) {
// mode prefix assembly with .code16. // mode prefix assembly with .code16.
bool is16 = TT.getEnvironment() == Triple::CODE16; bool is16 = TT.getEnvironment() == Triple::CODE16;
if (M.getModuleInlineAsm().empty() && is16) if (M.getModuleInlineAsm().empty() && is16)
OutStreamer->EmitAssemblerFlag(MCAF_Code16); OutStreamer->emitAssemblerFlag(MCAF_Code16);
} }
static void static void
@ -658,7 +658,7 @@ emitNonLazySymbolPointer(MCStreamer &OutStreamer, MCSymbol *StubLabel,
// L_foo$stub: // L_foo$stub:
OutStreamer.EmitLabel(StubLabel); OutStreamer.EmitLabel(StubLabel);
// .indirect_symbol _foo // .indirect_symbol _foo
OutStreamer.EmitSymbolAttribute(MCSym.getPointer(), MCSA_IndirectSymbol); OutStreamer.emitSymbolAttribute(MCSym.getPointer(), MCSA_IndirectSymbol);
if (MCSym.getInt()) if (MCSym.getInt())
// External to current translation unit. // External to current translation unit.
@ -715,7 +715,7 @@ void X86AsmPrinter::emitEndOfAsmFile(Module &M) {
// points). If this doesn't occur, the linker can safely perform dead code // points). If this doesn't occur, the linker can safely perform dead code
// stripping. Since LLVM never generates code that does this, it is always // stripping. Since LLVM never generates code that does this, it is always
// safe to set. // safe to set.
OutStreamer->EmitAssemblerFlag(MCAF_SubsectionsViaSymbols); OutStreamer->emitAssemblerFlag(MCAF_SubsectionsViaSymbols);
} else if (TT.isOSBinFormatCOFF()) { } else if (TT.isOSBinFormatCOFF()) {
if (MMI->usesMSVCFloatingPoint()) { if (MMI->usesMSVCFloatingPoint()) {
// In Windows' libcmt.lib, there is a file which is linked in only if the // In Windows' libcmt.lib, there is a file which is linked in only if the
@ -734,7 +734,7 @@ void X86AsmPrinter::emitEndOfAsmFile(Module &M) {
StringRef SymbolName = StringRef SymbolName =
(TT.getArch() == Triple::x86) ? "__fltused" : "_fltused"; (TT.getArch() == Triple::x86) ? "__fltused" : "_fltused";
MCSymbol *S = MMI->getContext().getOrCreateSymbol(SymbolName); MCSymbol *S = MMI->getContext().getOrCreateSymbol(SymbolName);
OutStreamer->EmitSymbolAttribute(S, MCSA_Global); OutStreamer->emitSymbolAttribute(S, MCSA_Global);
return; return;
} }
emitStackMaps(SM); emitStackMaps(SM);

View File

@ -297,7 +297,7 @@ MCOperand X86MCInstLower::LowerSymbolOperand(const MachineOperand &MO,
// local labels. This is only safe when the symbols are in the same // local labels. This is only safe when the symbols are in the same
// section so we are restricting it to jumptable references. // section so we are restricting it to jumptable references.
MCSymbol *Label = Ctx.createTempSymbol(); MCSymbol *Label = Ctx.createTempSymbol();
AsmPrinter.OutStreamer->EmitAssignment(Label, Expr); AsmPrinter.OutStreamer->emitAssignment(Label, Expr);
Expr = MCSymbolRefExpr::create(Label, Ctx); Expr = MCSymbolRefExpr::create(Label, Ctx);
} }
break; break;
@ -1151,7 +1151,7 @@ static unsigned EmitNop(MCStreamer &OS, unsigned NumBytes, bool Is64Bit,
unsigned NumPrefixes = std::min(NumBytes - NopSize, 5U); unsigned NumPrefixes = std::min(NumBytes - NopSize, 5U);
NopSize += NumPrefixes; NopSize += NumPrefixes;
for (unsigned i = 0; i != NumPrefixes; ++i) for (unsigned i = 0; i != NumPrefixes; ++i)
OS.EmitBytes("\x66"); OS.emitBytes("\x66");
switch (Opc) { switch (Opc) {
default: llvm_unreachable("Unexpected opcode"); default: llvm_unreachable("Unexpected opcode");
@ -1451,7 +1451,7 @@ void X86AsmPrinter::LowerPATCHABLE_EVENT_CALL(const MachineInstr &MI,
// Use a two-byte `jmp`. This version of JMP takes an 8-bit relative offset as // Use a two-byte `jmp`. This version of JMP takes an 8-bit relative offset as
// an operand (computed as an offset from the jmp instruction). // an operand (computed as an offset from the jmp instruction).
// FIXME: Find another less hacky way do force the relative jump. // FIXME: Find another less hacky way do force the relative jump.
OutStreamer->EmitBinaryData("\xeb\x0f"); OutStreamer->emitBinaryData("\xeb\x0f");
// The default C calling convention will place two arguments into %rcx and // The default C calling convention will place two arguments into %rcx and
// %rdx -- so we only work with those. // %rdx -- so we only work with those.
@ -1547,7 +1547,7 @@ void X86AsmPrinter::LowerPATCHABLE_TYPED_EVENT_CALL(const MachineInstr &MI,
// Use a two-byte `jmp`. This version of JMP takes an 8-bit relative offset as // Use a two-byte `jmp`. This version of JMP takes an 8-bit relative offset as
// an operand (computed as an offset from the jmp instruction). // an operand (computed as an offset from the jmp instruction).
// FIXME: Find another less hacky way do force the relative jump. // FIXME: Find another less hacky way do force the relative jump.
OutStreamer->EmitBinaryData("\xeb\x14"); OutStreamer->emitBinaryData("\xeb\x14");
// An x86-64 convention may place three arguments into %rcx, %rdx, and R8, // An x86-64 convention may place three arguments into %rcx, %rdx, and R8,
// so we'll work with those. Or we may be called via SystemV, in which case // so we'll work with those. Or we may be called via SystemV, in which case
@ -1649,7 +1649,7 @@ void X86AsmPrinter::LowerPATCHABLE_FUNCTION_ENTER(const MachineInstr &MI,
// Use a two-byte `jmp`. This version of JMP takes an 8-bit relative offset as // Use a two-byte `jmp`. This version of JMP takes an 8-bit relative offset as
// an operand (computed as an offset from the jmp instruction). // an operand (computed as an offset from the jmp instruction).
// FIXME: Find another less hacky way do force the relative jump. // FIXME: Find another less hacky way do force the relative jump.
OutStreamer->EmitBytes("\xeb\x09"); OutStreamer->emitBytes("\xeb\x09");
EmitNops(*OutStreamer, 9, Subtarget->is64Bit(), getSubtargetInfo()); EmitNops(*OutStreamer, 9, Subtarget->is64Bit(), getSubtargetInfo());
recordSled(CurSled, MI, SledKind::FUNCTION_ENTER); recordSled(CurSled, MI, SledKind::FUNCTION_ENTER);
} }
@ -1704,7 +1704,7 @@ void X86AsmPrinter::LowerPATCHABLE_TAIL_CALL(const MachineInstr &MI,
// Use a two-byte `jmp`. This version of JMP takes an 8-bit relative offset as // Use a two-byte `jmp`. This version of JMP takes an 8-bit relative offset as
// an operand (computed as an offset from the jmp instruction). // an operand (computed as an offset from the jmp instruction).
// FIXME: Find another less hacky way do force the relative jump. // FIXME: Find another less hacky way do force the relative jump.
OutStreamer->EmitBytes("\xeb\x09"); OutStreamer->emitBytes("\xeb\x09");
EmitNops(*OutStreamer, 9, Subtarget->is64Bit(), getSubtargetInfo()); EmitNops(*OutStreamer, 9, Subtarget->is64Bit(), getSubtargetInfo());
OutStreamer->EmitLabel(Target); OutStreamer->EmitLabel(Target);
recordSled(CurSled, MI, SledKind::TAIL_CALL); recordSled(CurSled, MI, SledKind::TAIL_CALL);

View File

@ -93,13 +93,13 @@ void XCoreAsmPrinter::emitArrayBound(MCSymbol *Sym, const GlobalVariable *GV) {
MCSymbol *SymGlob = OutContext.getOrCreateSymbol( MCSymbol *SymGlob = OutContext.getOrCreateSymbol(
Twine(Sym->getName() + StringRef(".globound"))); Twine(Sym->getName() + StringRef(".globound")));
OutStreamer->EmitSymbolAttribute(SymGlob, MCSA_Global); OutStreamer->emitSymbolAttribute(SymGlob, MCSA_Global);
OutStreamer->EmitAssignment(SymGlob, OutStreamer->emitAssignment(SymGlob,
MCConstantExpr::create(ATy->getNumElements(), MCConstantExpr::create(ATy->getNumElements(),
OutContext)); OutContext));
if (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || if (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() ||
GV->hasCommonLinkage()) { GV->hasCommonLinkage()) {
OutStreamer->EmitSymbolAttribute(SymGlob, MCSA_Weak); OutStreamer->emitSymbolAttribute(SymGlob, MCSA_Weak);
} }
} }
} }
@ -129,11 +129,11 @@ void XCoreAsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
case GlobalValue::ExternalLinkage: case GlobalValue::ExternalLinkage:
case GlobalValue::CommonLinkage: case GlobalValue::CommonLinkage:
emitArrayBound(GVSym, GV); emitArrayBound(GVSym, GV);
OutStreamer->EmitSymbolAttribute(GVSym, MCSA_Global); OutStreamer->emitSymbolAttribute(GVSym, MCSA_Global);
if (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || if (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() ||
GV->hasCommonLinkage()) GV->hasCommonLinkage())
OutStreamer->EmitSymbolAttribute(GVSym, MCSA_Weak); OutStreamer->emitSymbolAttribute(GVSym, MCSA_Weak);
LLVM_FALLTHROUGH; LLVM_FALLTHROUGH;
case GlobalValue::InternalLinkage: case GlobalValue::InternalLinkage:
case GlobalValue::PrivateLinkage: case GlobalValue::PrivateLinkage:
@ -149,7 +149,7 @@ void XCoreAsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
} }
unsigned Size = DL.getTypeAllocSize(C->getType()); unsigned Size = DL.getTypeAllocSize(C->getType());
if (MAI->hasDotTypeDotSizeDirective()) { if (MAI->hasDotTypeDotSizeDirective()) {
OutStreamer->EmitSymbolAttribute(GVSym, MCSA_ELF_TypeObject); OutStreamer->emitSymbolAttribute(GVSym, MCSA_ELF_TypeObject);
OutStreamer->emitELFSize(GVSym, MCConstantExpr::create(Size, OutContext)); OutStreamer->emitELFSize(GVSym, MCConstantExpr::create(Size, OutContext));
} }
OutStreamer->EmitLabel(GVSym); OutStreamer->EmitLabel(GVSym);

View File

@ -212,7 +212,7 @@ void DwarfStreamer::emitSectionContents(const object::ObjectFile &Obj,
if (auto Sec = getSectionByName(Obj, SecName)) { if (auto Sec = getSectionByName(Obj, SecName)) {
if (Expected<StringRef> E = Sec->getContents()) if (Expected<StringRef> E = Sec->getContents())
MS->EmitBytes(*E); MS->emitBytes(*E);
else else
consumeError(E.takeError()); consumeError(E.takeError());
} }
@ -237,7 +237,7 @@ void DwarfStreamer::emitStrings(const NonRelocatableStringpool &Pool) {
std::vector<DwarfStringPoolEntryRef> Entries = Pool.getEntriesForEmission(); std::vector<DwarfStringPoolEntryRef> Entries = Pool.getEntriesForEmission();
for (auto Entry : Entries) { for (auto Entry : Entries) {
// Emit the string itself. // Emit the string itself.
Asm->OutStreamer->EmitBytes(Entry.getString()); Asm->OutStreamer->emitBytes(Entry.getString());
// Emit a null terminator. // Emit a null terminator.
Asm->emitInt8(0); Asm->emitInt8(0);
} }
@ -303,7 +303,7 @@ void DwarfStreamer::emitSwiftAST(StringRef Buffer) {
MCSection *SwiftASTSection = MOFI->getDwarfSwiftASTSection(); MCSection *SwiftASTSection = MOFI->getDwarfSwiftASTSection();
SwiftASTSection->setAlignment(Align(32)); SwiftASTSection->setAlignment(Align(32));
MS->SwitchSection(SwiftASTSection); MS->SwitchSection(SwiftASTSection);
MS->EmitBytes(Buffer); MS->emitBytes(Buffer);
} }
/// Emit the debug_range section contents for \p FuncRange by /// Emit the debug_range section contents for \p FuncRange by
@ -485,7 +485,7 @@ void DwarfStreamer::emitLocationsForUnit(
Buffer.resize(0); Buffer.resize(0);
StringRef Input = InputSec.Data.substr(Offset, Length); StringRef Input = InputSec.Data.substr(Offset, Length);
ProcessExpr(Input, Buffer); ProcessExpr(Input, Buffer);
Asm->OutStreamer->EmitBytes( Asm->OutStreamer->emitBytes(
StringRef((const char *)Buffer.data(), Length)); StringRef((const char *)Buffer.data(), Length));
Offset += Length; Offset += Length;
LocSectionSize += Length + 2; LocSectionSize += Length + 2;
@ -508,7 +508,7 @@ void DwarfStreamer::emitLineTableForUnit(MCDwarfLineTableParams Params,
Asm->emitLabelDifference(LineEndSym, LineStartSym, 4); Asm->emitLabelDifference(LineEndSym, LineStartSym, 4);
Asm->OutStreamer->EmitLabel(LineStartSym); Asm->OutStreamer->EmitLabel(LineStartSym);
// Copy Prologue. // Copy Prologue.
MS->EmitBytes(PrologueBytes); MS->emitBytes(PrologueBytes);
LineSectionSize += PrologueBytes.size() + 4; LineSectionSize += PrologueBytes.size() + 4;
SmallString<128> EncodingBuffer; SmallString<128> EncodingBuffer;
@ -519,7 +519,7 @@ void DwarfStreamer::emitLineTableForUnit(MCDwarfLineTableParams Params,
// address in that case. // address in that case.
MCDwarfLineAddr::Encode(*MC, Params, std::numeric_limits<int64_t>::max(), 0, MCDwarfLineAddr::Encode(*MC, Params, std::numeric_limits<int64_t>::max(), 0,
EncodingOS); EncodingOS);
MS->EmitBytes(EncodingOS.str()); MS->emitBytes(EncodingOS.str());
LineSectionSize += EncodingBuffer.size(); LineSectionSize += EncodingBuffer.size();
MS->EmitLabel(LineEndSym); MS->EmitLabel(LineEndSym);
return; return;
@ -600,7 +600,7 @@ void DwarfStreamer::emitLineTableForUnit(MCDwarfLineTableParams Params,
int64_t LineDelta = int64_t(Row.Line) - LastLine; int64_t LineDelta = int64_t(Row.Line) - LastLine;
if (!Row.EndSequence) { if (!Row.EndSequence) {
MCDwarfLineAddr::Encode(*MC, Params, LineDelta, AddressDelta, EncodingOS); MCDwarfLineAddr::Encode(*MC, Params, LineDelta, AddressDelta, EncodingOS);
MS->EmitBytes(EncodingOS.str()); MS->emitBytes(EncodingOS.str());
LineSectionSize += EncodingBuffer.size(); LineSectionSize += EncodingBuffer.size();
EncodingBuffer.resize(0); EncodingBuffer.resize(0);
Address = Row.Address.Address; Address = Row.Address.Address;
@ -619,7 +619,7 @@ void DwarfStreamer::emitLineTableForUnit(MCDwarfLineTableParams Params,
} }
MCDwarfLineAddr::Encode(*MC, Params, std::numeric_limits<int64_t>::max(), MCDwarfLineAddr::Encode(*MC, Params, std::numeric_limits<int64_t>::max(),
0, EncodingOS); 0, EncodingOS);
MS->EmitBytes(EncodingOS.str()); MS->emitBytes(EncodingOS.str());
LineSectionSize += EncodingBuffer.size(); LineSectionSize += EncodingBuffer.size();
EncodingBuffer.resize(0); EncodingBuffer.resize(0);
Address = -1ULL; Address = -1ULL;
@ -631,7 +631,7 @@ void DwarfStreamer::emitLineTableForUnit(MCDwarfLineTableParams Params,
if (RowsSinceLastSequence) { if (RowsSinceLastSequence) {
MCDwarfLineAddr::Encode(*MC, Params, std::numeric_limits<int64_t>::max(), 0, MCDwarfLineAddr::Encode(*MC, Params, std::numeric_limits<int64_t>::max(), 0,
EncodingOS); EncodingOS);
MS->EmitBytes(EncodingOS.str()); MS->emitBytes(EncodingOS.str());
LineSectionSize += EncodingBuffer.size(); LineSectionSize += EncodingBuffer.size();
EncodingBuffer.resize(0); EncodingBuffer.resize(0);
} }
@ -677,7 +677,7 @@ void DwarfStreamer::translateLineTable(DataExtractor Data, uint64_t Offset) {
Offset += (Version >= 4) ? 5 : 4; Offset += (Version >= 4) ? 5 : 4;
unsigned OpcodeBase = Data.getU8(&Offset); unsigned OpcodeBase = Data.getU8(&Offset);
Offset += OpcodeBase - 1; Offset += OpcodeBase - 1;
Asm->OutStreamer->EmitBytes(Contents.slice(AfterHeaderLengthOffset, Offset)); Asm->OutStreamer->emitBytes(Contents.slice(AfterHeaderLengthOffset, Offset));
LineSectionSize += Offset - AfterHeaderLengthOffset; LineSectionSize += Offset - AfterHeaderLengthOffset;
// Offset points to the first directory. // Offset points to the first directory.
@ -686,7 +686,7 @@ void DwarfStreamer::translateLineTable(DataExtractor Data, uint64_t Offset) {
break; break;
StringRef Translated = Options.Translator(Dir); StringRef Translated = Options.Translator(Dir);
Asm->OutStreamer->EmitBytes(Translated); Asm->OutStreamer->emitBytes(Translated);
Asm->emitInt8(0); Asm->emitInt8(0);
LineSectionSize += Translated.size() + 1; LineSectionSize += Translated.size() + 1;
} }
@ -698,7 +698,7 @@ void DwarfStreamer::translateLineTable(DataExtractor Data, uint64_t Offset) {
break; break;
StringRef Translated = Options.Translator(File); StringRef Translated = Options.Translator(File);
Asm->OutStreamer->EmitBytes(Translated); Asm->OutStreamer->emitBytes(Translated);
Asm->emitInt8(0); Asm->emitInt8(0);
LineSectionSize += Translated.size() + 1; LineSectionSize += Translated.size() + 1;
@ -714,7 +714,7 @@ void DwarfStreamer::translateLineTable(DataExtractor Data, uint64_t Offset) {
Asm->OutStreamer->EmitLabel(HeaderEndLabel); Asm->OutStreamer->EmitLabel(HeaderEndLabel);
// Copy the actual line table program over. // Copy the actual line table program over.
Asm->OutStreamer->EmitBytes(Contents.slice(Offset, UnitEnd)); Asm->OutStreamer->emitBytes(Contents.slice(Offset, UnitEnd));
LineSectionSize += UnitEnd - Offset; LineSectionSize += UnitEnd - Offset;
Asm->OutStreamer->EmitLabel(EndLabel); Asm->OutStreamer->EmitLabel(EndLabel);
@ -771,7 +771,7 @@ void DwarfStreamer::emitPubSectionForUnit(
Asm->emitInt32(Name.Die->getOffset()); Asm->emitInt32(Name.Die->getOffset());
// Emit the string itself. // Emit the string itself.
Asm->OutStreamer->EmitBytes(Name.Name.getString()); Asm->OutStreamer->emitBytes(Name.Name.getString());
// Emit a null terminator. // Emit a null terminator.
Asm->emitInt8(0); Asm->emitInt8(0);
} }
@ -802,7 +802,7 @@ void DwarfStreamer::emitPubTypesForUnit(const CompileUnit &Unit) {
void DwarfStreamer::emitCIE(StringRef CIEBytes) { void DwarfStreamer::emitCIE(StringRef CIEBytes) {
MS->SwitchSection(MC->getObjectFileInfo()->getDwarfFrameSection()); MS->SwitchSection(MC->getObjectFileInfo()->getDwarfFrameSection());
MS->EmitBytes(CIEBytes); MS->emitBytes(CIEBytes);
FrameSectionSize += CIEBytes.size(); FrameSectionSize += CIEBytes.size();
} }
@ -816,7 +816,7 @@ void DwarfStreamer::emitFDE(uint32_t CIEOffset, uint32_t AddrSize,
MS->EmitIntValue(FDEBytes.size() + 4 + AddrSize, 4); MS->EmitIntValue(FDEBytes.size() + 4 + AddrSize, 4);
MS->EmitIntValue(CIEOffset, 4); MS->EmitIntValue(CIEOffset, 4);
MS->EmitIntValue(Address, AddrSize); MS->EmitIntValue(Address, AddrSize);
MS->EmitBytes(FDEBytes); MS->emitBytes(FDEBytes);
FrameSectionSize += FDEBytes.size() + 8 + AddrSize; FrameSectionSize += FDEBytes.size() + 8 + AddrSize;
} }

View File

@ -44,7 +44,7 @@ public:
auto Pair = Pool.insert(std::make_pair(Str, Offset)); auto Pair = Pool.insert(std::make_pair(Str, Offset));
if (Pair.second) { if (Pair.second) {
Out.SwitchSection(Sec); Out.SwitchSection(Sec);
Out.EmitBytes(StringRef(Str, Length)); Out.emitBytes(StringRef(Str, Length));
Offset += Length; Offset += Length;
} }

View File

@ -235,7 +235,7 @@ static void addAllTypesFromDWP(
++I; ++I;
} }
auto &C = Entry.Contributions[DW_SECT_TYPES - DW_SECT_INFO]; auto &C = Entry.Contributions[DW_SECT_TYPES - DW_SECT_INFO];
Out.EmitBytes(Types.substr( Out.emitBytes(Types.substr(
C.Offset - TUEntry.Contributions[DW_SECT_TYPES - DW_SECT_INFO].Offset, C.Offset - TUEntry.Contributions[DW_SECT_TYPES - DW_SECT_INFO].Offset,
C.Length)); C.Length));
C.Offset = TypesOffset; C.Offset = TypesOffset;
@ -272,7 +272,7 @@ static void addAllTypes(MCStreamer &Out,
if (!P.second) if (!P.second)
continue; continue;
Out.EmitBytes(Types.substr(PrevOffset, C.Length)); Out.emitBytes(Types.substr(PrevOffset, C.Length));
TypesOffset += C.Length; TypesOffset += C.Length;
} }
} }
@ -458,7 +458,7 @@ static Error handleSection(
CurTUIndexSection = Contents; CurTUIndexSection = Contents;
else { else {
Out.SwitchSection(OutSection); Out.SwitchSection(OutSection);
Out.EmitBytes(Contents); Out.emitBytes(Contents);
} }
return Error::success(); return Error::success();
} }

View File

@ -87,15 +87,15 @@ public:
private: private:
// We only care about instructions, we don't implement this part of the API. // We only care about instructions, we don't implement this part of the API.
void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override {} unsigned ByteAlignment) override {}
bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override { bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override {
return false; return false;
} }
void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value, void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value,
unsigned ValueSize, unsigned ValueSize,
unsigned MaxBytesToEmit) override {} unsigned MaxBytesToEmit) override {}
void EmitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size, void emitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment, SMLoc Loc) override {} unsigned ByteAlignment, SMLoc Loc) override {}
unsigned findRegisterByName(const StringRef RegName) const { unsigned findRegisterByName(const StringRef RegName) const {

View File

@ -52,13 +52,13 @@ public:
Regions.addInstruction(Inst); Regions.addInstruction(Inst);
} }
bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override { bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override {
return true; return true;
} }
void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override {} unsigned ByteAlignment) override {}
void EmitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr, void emitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
uint64_t Size = 0, unsigned ByteAlignment = 0, uint64_t Size = 0, unsigned ByteAlignment = 0,
SMLoc Loc = SMLoc()) override {} SMLoc Loc = SMLoc()) override {}
void EmitGPRel32Value(const MCExpr *Value) override {} void EmitGPRel32Value(const MCExpr *Value) override {}

View File

@ -2520,10 +2520,10 @@ TEST(DWARFDebugInfo, TestErrorReportingPolicy) {
// Emit two compressed sections with broken headers. // Emit two compressed sections with broken headers.
AP->OutStreamer->SwitchSection( AP->OutStreamer->SwitchSection(
MC->getELFSection(".zdebug_foo", 0 /*Type*/, 0 /*Flags*/)); MC->getELFSection(".zdebug_foo", 0 /*Type*/, 0 /*Flags*/));
AP->OutStreamer->EmitBytes("0"); AP->OutStreamer->emitBytes("0");
AP->OutStreamer->SwitchSection( AP->OutStreamer->SwitchSection(
MC->getELFSection(".zdebug_bar", 0 /*Type*/, 0 /*Flags*/)); MC->getELFSection(".zdebug_bar", 0 /*Type*/, 0 /*Flags*/));
AP->OutStreamer->EmitBytes("0"); AP->OutStreamer->emitBytes("0");
MemoryBufferRef FileBuffer(DG->generate(), "dwarf"); MemoryBufferRef FileBuffer(DG->generate(), "dwarf");
auto Obj = object::ObjectFile::createObjectFile(FileBuffer); auto Obj = object::ObjectFile::createObjectFile(FileBuffer);

View File

@ -327,7 +327,7 @@ void dwarfgen::LineTable::writePrologue(AsmPrinter &Asm) const {
} }
static void writeCString(StringRef Str, AsmPrinter &Asm) { static void writeCString(StringRef Str, AsmPrinter &Asm) {
Asm.OutStreamer->EmitBytes(Str); Asm.OutStreamer->emitBytes(Str);
Asm.emitInt8(0); Asm.emitInt8(0);
} }