summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/ARMException.cpp22
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp4
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp329
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp63
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp14
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/ByteStreamer.h6
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DIE.cpp12
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp36
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp12
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp8
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp122
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp4
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp10
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp18
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp70
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/ErlangGCPrinter.cpp4
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp24
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp30
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp66
19 files changed, 427 insertions, 427 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/ARMException.cpp b/llvm/lib/CodeGen/AsmPrinter/ARMException.cpp
index 9a16e15ecf7..4cb460a7bbf 100644
--- a/llvm/lib/CodeGen/AsmPrinter/ARMException.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/ARMException.cpp
@@ -41,7 +41,7 @@ ARMException::ARMException(AsmPrinter *A) : DwarfCFIExceptionBase(A) {}
ARMException::~ARMException() {}
ARMTargetStreamer &ARMException::getTargetStreamer() {
- MCTargetStreamer &TS = *Asm->OutStreamer.getTargetStreamer();
+ MCTargetStreamer &TS = *Asm->OutStreamer->getTargetStreamer();
return static_cast<ARMTargetStreamer &>(TS);
}
@@ -49,7 +49,7 @@ ARMTargetStreamer &ARMException::getTargetStreamer() {
/// content.
void ARMException::endModule() {
if (shouldEmitCFI)
- Asm->OutStreamer.EmitCFISections(false, true);
+ Asm->OutStreamer->EmitCFISections(false, true);
}
void ARMException::beginFunction(const MachineFunction *MF) {
@@ -61,7 +61,7 @@ void ARMException::beginFunction(const MachineFunction *MF) {
"non-EH CFI not yet supported in prologue with EHABI lowering");
if (MoveType == AsmPrinter::CFI_M_Debug) {
shouldEmitCFI = true;
- Asm->OutStreamer.EmitCFIStartProc(false);
+ Asm->OutStreamer->EmitCFIStartProc(false);
}
}
@@ -77,7 +77,7 @@ void ARMException::endFunction(const MachineFunction *MF) {
// Emit references to personality.
if (const Function *Personality = MMI->getPersonality()) {
MCSymbol *PerSym = Asm->getSymbol(Personality);
- Asm->OutStreamer.EmitSymbolAttribute(PerSym, MCSA_Global);
+ Asm->OutStreamer->EmitSymbolAttribute(PerSym, MCSA_Global);
ATS.emitPersonality(PerSym);
}
@@ -97,13 +97,13 @@ void ARMException::emitTypeInfos(unsigned TTypeEncoding) {
const std::vector<const GlobalValue *> &TypeInfos = MMI->getTypeInfos();
const std::vector<unsigned> &FilterIds = MMI->getFilterIds();
- bool VerboseAsm = Asm->OutStreamer.isVerboseAsm();
+ bool VerboseAsm = Asm->OutStreamer->isVerboseAsm();
int Entry = 0;
// Emit the Catch TypeInfos.
if (VerboseAsm && !TypeInfos.empty()) {
- Asm->OutStreamer.AddComment(">> Catch TypeInfos <<");
- Asm->OutStreamer.AddBlankLine();
+ Asm->OutStreamer->AddComment(">> Catch TypeInfos <<");
+ Asm->OutStreamer->AddBlankLine();
Entry = TypeInfos.size();
}
@@ -111,14 +111,14 @@ void ARMException::emitTypeInfos(unsigned TTypeEncoding) {
I = TypeInfos.rbegin(), E = TypeInfos.rend(); I != E; ++I) {
const GlobalValue *GV = *I;
if (VerboseAsm)
- Asm->OutStreamer.AddComment("TypeInfo " + Twine(Entry--));
+ Asm->OutStreamer->AddComment("TypeInfo " + Twine(Entry--));
Asm->EmitTTypeReference(GV, TTypeEncoding);
}
// Emit the Exception Specifications.
if (VerboseAsm && !FilterIds.empty()) {
- Asm->OutStreamer.AddComment(">> Filter TypeInfos <<");
- Asm->OutStreamer.AddBlankLine();
+ Asm->OutStreamer->AddComment(">> Filter TypeInfos <<");
+ Asm->OutStreamer->AddBlankLine();
Entry = 0;
}
for (std::vector<unsigned>::const_iterator
@@ -127,7 +127,7 @@ void ARMException::emitTypeInfos(unsigned TTypeEncoding) {
if (VerboseAsm) {
--Entry;
if (TypeID != 0)
- Asm->OutStreamer.AddComment("FilterInfo " + Twine(Entry));
+ Asm->OutStreamer->AddComment("FilterInfo " + Twine(Entry));
}
Asm->EmitTTypeReference((TypeID == 0 ? nullptr : TypeInfos[TypeID - 1]),
diff --git a/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp b/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
index 8dab5e59d63..4dc5e9f66b6 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
@@ -29,7 +29,7 @@ void AddressPool::emit(AsmPrinter &Asm, const MCSection *AddrSection) {
return;
// Start the dwarf addr section.
- Asm.OutStreamer.SwitchSection(AddrSection);
+ Asm.OutStreamer->SwitchSection(AddrSection);
// Order the address pool entries by ID
SmallVector<const MCExpr *, 64> Entries(Pool.size());
@@ -41,5 +41,5 @@ void AddressPool::emit(AsmPrinter &Asm, const MCSection *AddrSection) {
: MCSymbolRefExpr::Create(I.first, Asm.OutContext);
for (const MCExpr *Entry : Entries)
- Asm.OutStreamer.EmitValue(Entry, Asm.getDataLayout().getPointerSize());
+ Asm.OutStreamer->EmitValue(Entry, Asm.getDataLayout().getPointerSize());
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index ec76cd61376..a8fb9b776d4 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -102,7 +102,7 @@ static unsigned getGVAlignmentLog2(const GlobalValue *GV, const DataLayout &DL,
AsmPrinter::AsmPrinter(TargetMachine &tm, std::unique_ptr<MCStreamer> Streamer)
: MachineFunctionPass(ID), TM(tm), MAI(tm.getMCAsmInfo()),
- OutContext(Streamer->getContext()), OutStreamer(*Streamer.release()),
+ OutContext(Streamer->getContext()), OutStreamer(std::move(Streamer)),
LastMI(nullptr), LastFn(0), Counter(~0U) {
DD = nullptr;
MMI = nullptr;
@@ -112,7 +112,7 @@ AsmPrinter::AsmPrinter(TargetMachine &tm, std::unique_ptr<MCStreamer> Streamer)
CurrentFnBegin = nullptr;
CurrentFnEnd = nullptr;
GCMetadataPrinters = nullptr;
- VerboseAsm = OutStreamer.isVerboseAsm();
+ VerboseAsm = OutStreamer->isVerboseAsm();
}
AsmPrinter::~AsmPrinter() {
@@ -124,8 +124,6 @@ AsmPrinter::~AsmPrinter() {
delete &GCMap;
GCMetadataPrinters = nullptr;
}
-
- delete &OutStreamer;
}
/// getFunctionNumber - Return a unique ID for the current function.
@@ -158,7 +156,7 @@ StringRef AsmPrinter::getTargetTriple() const {
/// getCurrentSection() - Return the current section we are emitting to.
const MCSection *AsmPrinter::getCurrentSection() const {
- return OutStreamer.getCurrentSection().first;
+ return OutStreamer->getCurrentSection().first;
}
@@ -180,7 +178,7 @@ bool AsmPrinter::doInitialization(Module &M) {
const_cast<TargetLoweringObjectFile&>(getObjFileLowering())
.Initialize(OutContext, TM);
- OutStreamer.InitSections(false);
+ OutStreamer->InitSections(false);
Mang = new Mangler(TM.getDataLayout());
@@ -198,9 +196,9 @@ bool AsmPrinter::doInitialization(Module &M) {
TT.getOSVersion(Major, Minor, Update);
// If there is a version specified, Major will be non-zero.
if (Major)
- OutStreamer.EmitVersionMin((TT.isMacOSX() ?
- MCVM_OSXVersionMin : MCVM_IOSVersionMin),
- Major, Minor, Update);
+ OutStreamer->EmitVersionMin((TT.isMacOSX() ?
+ MCVM_OSXVersionMin : MCVM_IOSVersionMin),
+ Major, Minor, Update);
}
// Allow the target to emit any magic that it wants at the start of the file.
@@ -210,7 +208,7 @@ bool AsmPrinter::doInitialization(Module &M) {
// don't, this at least helps the user find where a global came from.
if (MAI->hasSingleParameterDotFile()) {
// .file "foo.c"
- OutStreamer.EmitFileDirective(M.getModuleIdentifier());
+ OutStreamer->EmitFileDirective(M.getModuleIdentifier());
}
GCModuleInfo *MI = getAnalysisIfAvailable<GCModuleInfo>();
@@ -225,11 +223,11 @@ bool AsmPrinter::doInitialization(Module &M) {
// and target triple.
std::unique_ptr<MCSubtargetInfo> STI(TM.getTarget().createMCSubtargetInfo(
TM.getTargetTriple(), TM.getTargetCPU(), TM.getTargetFeatureString()));
- OutStreamer.AddComment("Start of file scope inline assembly");
- OutStreamer.AddBlankLine();
+ OutStreamer->AddComment("Start of file scope inline assembly");
+ OutStreamer->AddBlankLine();
EmitInlineAsm(M.getModuleInlineAsm()+"\n", *STI);
- OutStreamer.AddComment("End of file scope inline assembly");
- OutStreamer.AddBlankLine();
+ OutStreamer->AddComment("End of file scope inline assembly");
+ OutStreamer->AddBlankLine();
}
if (MAI->doesSupportDebugInformation()) {
@@ -296,20 +294,20 @@ void AsmPrinter::EmitLinkage(const GlobalValue *GV, MCSymbol *GVSym) const {
case GlobalValue::WeakODRLinkage:
if (MAI->hasWeakDefDirective()) {
// .globl _foo
- OutStreamer.EmitSymbolAttribute(GVSym, MCSA_Global);
+ OutStreamer->EmitSymbolAttribute(GVSym, MCSA_Global);
if (!canBeHidden(GV, *MAI))
// .weak_definition _foo
- OutStreamer.EmitSymbolAttribute(GVSym, MCSA_WeakDefinition);
+ OutStreamer->EmitSymbolAttribute(GVSym, MCSA_WeakDefinition);
else
- OutStreamer.EmitSymbolAttribute(GVSym, MCSA_WeakDefAutoPrivate);
+ OutStreamer->EmitSymbolAttribute(GVSym, MCSA_WeakDefAutoPrivate);
} else if (MAI->hasLinkOnceDirective()) {
// .globl _foo
- OutStreamer.EmitSymbolAttribute(GVSym, MCSA_Global);
+ OutStreamer->EmitSymbolAttribute(GVSym, MCSA_Global);
//NOTE: linkonce is handled by the section the symbol was assigned to.
} else {
// .weak _foo
- OutStreamer.EmitSymbolAttribute(GVSym, MCSA_Weak);
+ OutStreamer->EmitSymbolAttribute(GVSym, MCSA_Weak);
}
return;
case GlobalValue::AppendingLinkage:
@@ -318,7 +316,7 @@ void AsmPrinter::EmitLinkage(const GlobalValue *GV, MCSymbol *GVSym) const {
case GlobalValue::ExternalLinkage:
// If external or appending, declare as a global symbol.
// .globl _foo
- OutStreamer.EmitSymbolAttribute(GVSym, MCSA_Global);
+ OutStreamer->EmitSymbolAttribute(GVSym, MCSA_Global);
return;
case GlobalValue::PrivateLinkage:
case GlobalValue::InternalLinkage:
@@ -353,9 +351,9 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
return;
if (isVerbose()) {
- GV->printAsOperand(OutStreamer.GetCommentOS(),
+ GV->printAsOperand(OutStreamer->GetCommentOS(),
/*PrintType=*/false, GV->getParent());
- OutStreamer.GetCommentOS() << '\n';
+ OutStreamer->GetCommentOS() << '\n';
}
}
@@ -371,7 +369,7 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
"' is already defined");
if (MAI->hasDotTypeDotSizeDirective())
- OutStreamer.EmitSymbolAttribute(GVSym, MCSA_ELF_TypeObject);
+ OutStreamer->EmitSymbolAttribute(GVSym, MCSA_ELF_TypeObject);
SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GV, TM);
@@ -399,7 +397,7 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
Align = 0;
// .comm _foo, 42, 4
- OutStreamer.EmitCommonSymbol(GVSym, Size, Align);
+ OutStreamer->EmitCommonSymbol(GVSym, Size, Align);
return;
}
@@ -408,7 +406,7 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
const MCSection *TheSection =
getObjFileLowering().SectionForGlobal(GV, GVKind, *Mang, TM);
// .zerofill __DATA, __bss, _foo, 400, 5
- OutStreamer.EmitZerofill(TheSection, GVSym, Size, Align);
+ OutStreamer->EmitZerofill(TheSection, GVSym, Size, Align);
return;
}
@@ -420,7 +418,7 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
// Prefer to simply fall back to .local / .comm in this case.
if (MAI->getLCOMMDirectiveAlignmentType() != LCOMM::NoAlignment) {
// .lcomm _foo, 42
- OutStreamer.EmitLocalCommonSymbol(GVSym, Size, Align);
+ OutStreamer->EmitLocalCommonSymbol(GVSym, Size, Align);
return;
}
@@ -428,9 +426,9 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
Align = 0;
// .local _foo
- OutStreamer.EmitSymbolAttribute(GVSym, MCSA_Local);
+ OutStreamer->EmitSymbolAttribute(GVSym, MCSA_Local);
// .comm _foo, 42, 4
- OutStreamer.EmitCommonSymbol(GVSym, Size, Align);
+ OutStreamer->EmitCommonSymbol(GVSym, Size, Align);
return;
}
@@ -443,9 +441,9 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
if (Size == 0) Size = 1; // zerofill of 0 bytes is undefined.
// .globl _foo
- OutStreamer.EmitSymbolAttribute(GVSym, MCSA_Global);
+ OutStreamer->EmitSymbolAttribute(GVSym, MCSA_Global);
// .zerofill __DATA, __common, _foo, 400, 5
- OutStreamer.EmitZerofill(TheSection, GVSym, Size, 1 << AlignLog);
+ OutStreamer->EmitZerofill(TheSection, GVSym, Size, 1 << AlignLog);
return;
}
@@ -466,55 +464,55 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
if (GVKind.isThreadBSS()) {
TheSection = getObjFileLowering().getTLSBSSSection();
- OutStreamer.EmitTBSSSymbol(TheSection, MangSym, Size, 1 << AlignLog);
+ OutStreamer->EmitTBSSSymbol(TheSection, MangSym, Size, 1 << AlignLog);
} else if (GVKind.isThreadData()) {
- OutStreamer.SwitchSection(TheSection);
+ OutStreamer->SwitchSection(TheSection);
EmitAlignment(AlignLog, GV);
- OutStreamer.EmitLabel(MangSym);
+ OutStreamer->EmitLabel(MangSym);
EmitGlobalConstant(GV->getInitializer());
}
- OutStreamer.AddBlankLine();
+ OutStreamer->AddBlankLine();
// Emit the variable struct for the runtime.
const MCSection *TLVSect
= getObjFileLowering().getTLSExtraDataSection();
- OutStreamer.SwitchSection(TLVSect);
+ OutStreamer->SwitchSection(TLVSect);
// Emit the linkage here.
EmitLinkage(GV, GVSym);
- OutStreamer.EmitLabel(GVSym);
+ OutStreamer->EmitLabel(GVSym);
// Three pointers in size:
// - __tlv_bootstrap - used to make sure support exists
// - spare pointer, used when mapped by the runtime
// - pointer to mangled symbol above with initializer
unsigned PtrSize = DL->getPointerTypeSize(GV->getType());
- OutStreamer.EmitSymbolValue(GetExternalSymbolSymbol("_tlv_bootstrap"),
+ OutStreamer->EmitSymbolValue(GetExternalSymbolSymbol("_tlv_bootstrap"),
PtrSize);
- OutStreamer.EmitIntValue(0, PtrSize);
- OutStreamer.EmitSymbolValue(MangSym, PtrSize);
+ OutStreamer->EmitIntValue(0, PtrSize);
+ OutStreamer->EmitSymbolValue(MangSym, PtrSize);
- OutStreamer.AddBlankLine();
+ OutStreamer->AddBlankLine();
return;
}
- OutStreamer.SwitchSection(TheSection);
+ OutStreamer->SwitchSection(TheSection);
EmitLinkage(GV, GVSym);
EmitAlignment(AlignLog, GV);
- OutStreamer.EmitLabel(GVSym);
+ OutStreamer->EmitLabel(GVSym);
EmitGlobalConstant(GV->getInitializer());
if (MAI->hasDotTypeDotSizeDirective())
// .size foo, 42
- OutStreamer.EmitELFSize(GVSym, MCConstantExpr::Create(Size, OutContext));
+ OutStreamer->EmitELFSize(GVSym, MCConstantExpr::Create(Size, OutContext));
- OutStreamer.AddBlankLine();
+ OutStreamer->AddBlankLine();
}
/// EmitFunctionHeader - This method emits the header for the current
@@ -526,7 +524,7 @@ void AsmPrinter::EmitFunctionHeader() {
// Print the 'header' of function.
const Function *F = MF->getFunction();
- OutStreamer.SwitchSection(
+ OutStreamer->SwitchSection(
getObjFileLowering().SectionForGlobal(F, *Mang, TM));
EmitVisibility(CurrentFnSym, F->getVisibility());
@@ -535,12 +533,12 @@ void AsmPrinter::EmitFunctionHeader() {
EmitAlignment(MF->getAlignment(), F);
if (MAI->hasDotTypeDotSizeDirective())
- OutStreamer.EmitSymbolAttribute(CurrentFnSym, MCSA_ELF_TypeFunction);
+ OutStreamer->EmitSymbolAttribute(CurrentFnSym, MCSA_ELF_TypeFunction);
if (isVerbose()) {
- F->printAsOperand(OutStreamer.GetCommentOS(),
+ F->printAsOperand(OutStreamer->GetCommentOS(),
/*PrintType=*/false, F->getParent());
- OutStreamer.GetCommentOS() << '\n';
+ OutStreamer->GetCommentOS() << '\n';
}
// Emit the prefix data.
@@ -557,18 +555,18 @@ void AsmPrinter::EmitFunctionHeader() {
std::vector<MCSymbol*> DeadBlockSyms;
MMI->takeDeletedSymbolsForFunction(F, DeadBlockSyms);
for (unsigned i = 0, e = DeadBlockSyms.size(); i != e; ++i) {
- OutStreamer.AddComment("Address taken block that was later removed");
- OutStreamer.EmitLabel(DeadBlockSyms[i]);
+ OutStreamer->AddComment("Address taken block that was later removed");
+ OutStreamer->EmitLabel(DeadBlockSyms[i]);
}
if (CurrentFnBegin) {
if (MAI->useAssignmentForEHBegin()) {
MCSymbol *CurPos = OutContext.CreateTempSymbol();
- OutStreamer.EmitLabel(CurPos);
- OutStreamer.EmitAssignment(CurrentFnBegin,
+ OutStreamer->EmitLabel(CurPos);
+ OutStreamer->EmitAssignment(CurrentFnBegin,
MCSymbolRefExpr::Create(CurPos, OutContext));
} else {
- OutStreamer.EmitLabel(CurrentFnBegin);
+ OutStreamer->EmitLabel(CurrentFnBegin);
}
}
@@ -597,7 +595,7 @@ void AsmPrinter::EmitFunctionEntryLabel() {
report_fatal_error("'" + Twine(CurrentFnSym->getName()) +
"' label emitted multiple times to assembly file");
- return OutStreamer.EmitLabel(CurrentFnSym);
+ return OutStreamer->EmitLabel(CurrentFnSym);
}
/// emitComments - Pretty-print comments for instructions.
@@ -640,9 +638,9 @@ static void emitComments(const MachineInstr &MI, raw_ostream &CommentOS) {
/// that is an implicit def.
void AsmPrinter::emitImplicitDef(const MachineInstr *MI) const {
unsigned RegNo = MI->getOperand(0).getReg();
- OutStreamer.AddComment(Twine("implicit-def: ") +
- MMI->getContext().getRegisterInfo()->getName(RegNo));
- OutStreamer.AddBlankLine();
+ OutStreamer->AddComment(Twine("implicit-def: ") +
+ MMI->getContext().getRegisterInfo()->getName(RegNo));
+ OutStreamer->AddBlankLine();
}
static void emitKill(const MachineInstr *MI, AsmPrinter &AP) {
@@ -654,8 +652,8 @@ static void emitKill(const MachineInstr *MI, AsmPrinter &AP) {
Str += AP.MMI->getContext().getRegisterInfo()->getName(Op.getReg());
Str += (Op.isDef() ? "<def>" : "<kill>");
}
- AP.OutStreamer.AddComment(Str);
- AP.OutStreamer.AddBlankLine();
+ AP.OutStreamer->AddComment(Str);
+ AP.OutStreamer->AddBlankLine();
}
/// emitDebugValueComment - This method handles the target-independent form
@@ -722,7 +720,7 @@ static bool emitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP) {
// Suppress offset, it is not meaningful here.
OS << "undef";
// NOTE: Want this comment at start of line, don't emit with AddComment.
- AP.OutStreamer.emitRawComment(OS.str());
+ AP.OutStreamer->emitRawComment(OS.str());
return true;
}
if (Deref)
@@ -734,7 +732,7 @@ static bool emitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP) {
OS << '+' << Offset << ']';
// NOTE: Want this comment at start of line, don't emit with AddComment.
- AP.OutStreamer.emitRawComment(OS.str());
+ AP.OutStreamer->emitRawComment(OS.str());
return true;
}
@@ -775,7 +773,7 @@ void AsmPrinter::emitFrameAlloc(const MachineInstr &MI) {
int FrameOffset = MI.getOperand(1).getImm();
// Emit a symbol assignment.
- OutStreamer.EmitAssignment(FrameAllocSym,
+ OutStreamer->EmitAssignment(FrameAllocSym,
MCConstantExpr::Create(FrameOffset, OutContext));
}
@@ -812,7 +810,7 @@ void AsmPrinter::EmitFunctionBody() {
}
if (isVerbose())
- emitComments(MI, OutStreamer.GetCommentOS());
+ emitComments(MI, OutStreamer->GetCommentOS());
switch (MI.getOpcode()) {
case TargetOpcode::CFI_INSTRUCTION:
@@ -825,7 +823,7 @@ void AsmPrinter::EmitFunctionBody() {
case TargetOpcode::EH_LABEL:
case TargetOpcode::GC_LABEL:
- OutStreamer.EmitLabel(MI.getOperand(0).getMCSymbol());
+ OutStreamer->EmitLabel(MI.getOperand(0).getMCSymbol());
break;
case TargetOpcode::INLINEASM:
EmitInlineAsm(&MI);
@@ -865,12 +863,12 @@ void AsmPrinter::EmitFunctionBody() {
if ((MAI->hasSubsectionsViaSymbols() && !HasAnyRealCode)) {
MCInst Noop;
MF->getSubtarget().getInstrInfo()->getNoopForMachoTarget(Noop);
- OutStreamer.AddComment("avoids zero-length function");
+ OutStreamer->AddComment("avoids zero-length function");
// Targets can opt-out of emitting the noop here by leaving the opcode
// unspecified.
if (Noop.getOpcode())
- OutStreamer.EmitInstruction(Noop, getSubtargetInfo());
+ OutStreamer->EmitInstruction(Noop, getSubtargetInfo());
}
const Function *F = MF->getFunction();
@@ -880,8 +878,8 @@ void AsmPrinter::EmitFunctionBody() {
MCSymbol *Sym = GetBlockAddressSymbol(&BB);
if (Sym->isDefined())
continue;
- OutStreamer.AddComment("Address of block that was removed by CodeGen");
- OutStreamer.EmitLabel(Sym);
+ OutStreamer->AddComment("Address of block that was removed by CodeGen");
+ OutStreamer->EmitLabel(Sym);
}
// Emit target-specific gunk after the function body.
@@ -891,7 +889,7 @@ void AsmPrinter::EmitFunctionBody() {
MAI->hasDotTypeDotSizeDirective()) {
// Create a symbol for the end of function.
CurrentFnEnd = createTempSymbol("func_end");
- OutStreamer.EmitLabel(CurrentFnEnd);
+ OutStreamer->EmitLabel(CurrentFnEnd);
}
// If the target wants a .size directive for the size of the function, emit
@@ -904,7 +902,7 @@ void AsmPrinter::EmitFunctionBody() {
MCSymbolRefExpr::Create(CurrentFnSymForSize,
OutContext),
OutContext);
- OutStreamer.EmitELFSize(CurrentFnSym, SizeExp);
+ OutStreamer->EmitELFSize(CurrentFnSym, SizeExp);
}
for (const HandlerInfo &HI : Handlers) {
@@ -922,7 +920,7 @@ void AsmPrinter::EmitFunctionBody() {
}
MMI->EndFunction();
- OutStreamer.AddBlankLine();
+ OutStreamer->AddBlankLine();
}
/// \brief Compute the number of Global Variables that uses a Constant.
@@ -1040,7 +1038,7 @@ bool AsmPrinter::doFinalization(Module &M) {
SmallVector<Module::ModuleFlagEntry, 8> ModuleFlags;
M.getModuleFlagsMetadata(ModuleFlags);
if (!ModuleFlags.empty())
- TLOF.emitModuleFlags(OutStreamer, ModuleFlags, *Mang, TM);
+ TLOF.emitModuleFlags(*OutStreamer, ModuleFlags, *Mang, TM);
Triple TT(TM.getTargetTriple());
if (TT.isOSBinFormatELF()) {
@@ -1049,19 +1047,19 @@ bool AsmPrinter::doFinalization(Module &M) {
// Output stubs for external and common global variables.
MachineModuleInfoELF::SymbolListTy Stubs = MMIELF.GetGVStubList();
if (!Stubs.empty()) {
- OutStreamer.SwitchSection(TLOF.getDataRelSection());
+ OutStreamer->SwitchSection(TLOF.getDataRelSection());
const DataLayout *DL = TM.getDataLayout();
for (const auto &Stub : Stubs) {
- OutStreamer.EmitLabel(Stub.first);
- OutStreamer.EmitSymbolValue(Stub.second.getPointer(),
- DL->getPointerSize());
+ OutStreamer->EmitLabel(Stub.first);
+ OutStreamer->EmitSymbolValue(Stub.second.getPointer(),
+ DL->getPointerSize());
}
}
}
// Make sure we wrote out everything we need.
- OutStreamer.Flush();
+ OutStreamer->Flush();
// Finalize debug and EH information.
for (const HandlerInfo &HI : Handlers) {
@@ -1084,31 +1082,31 @@ bool AsmPrinter::doFinalization(Module &M) {
for (const auto &G : M.globals()) {
if (!G.hasExternalWeakLinkage())
continue;
- OutStreamer.EmitSymbolAttribute(getSymbol(&G), MCSA_WeakReference);
+ OutStreamer->EmitSymbolAttribute(getSymbol(&G), MCSA_WeakReference);
}
for (const auto &F : M) {
if (!F.hasExternalWeakLinkage())
continue;
- OutStreamer.EmitSymbolAttribute(getSymbol(&F), MCSA_WeakReference);
+ OutStreamer->EmitSymbolAttribute(getSymbol(&F), MCSA_WeakReference);
}
}
- OutStreamer.AddBlankLine();
+ OutStreamer->AddBlankLine();
for (const auto &Alias : M.aliases()) {
MCSymbol *Name = getSymbol(&Alias);
if (Alias.hasExternalLinkage() || !MAI->getWeakRefDirective())
- OutStreamer.EmitSymbolAttribute(Name, MCSA_Global);
+ OutStreamer->EmitSymbolAttribute(Name, MCSA_Global);
else if (Alias.hasWeakLinkage() || Alias.hasLinkOnceLinkage())
- OutStreamer.EmitSymbolAttribute(Name, MCSA_WeakReference);
+ OutStreamer->EmitSymbolAttribute(Name, MCSA_WeakReference);
else
assert(Alias.hasLocalLinkage() && "Invalid alias linkage");
EmitVisibility(Name, Alias.getVisibility());
// Emit the directives as assignments aka .set:
- OutStreamer.EmitAssignment(Name, lowerConstant(Alias.getAliasee()));
+ OutStreamer->EmitAssignment(Name, lowerConstant(Alias.getAliasee()));
}
GCModuleInfo *MI = getAnalysisIfAvailable<GCModuleInfo>();
@@ -1125,15 +1123,15 @@ bool AsmPrinter::doFinalization(Module &M) {
const MCSection *ReadOnlySection =
getObjFileLowering().getSectionForConstant(SectionKind::getReadOnly(),
/*C=*/nullptr);
- OutStreamer.SwitchSection(ReadOnlySection);
+ OutStreamer->SwitchSection(ReadOnlySection);
MCSymbol *AddrSymbol =
OutContext.GetOrCreateSymbol(StringRef("__morestack_addr"));
- OutStreamer.EmitLabel(AddrSymbol);
+ OutStreamer->EmitLabel(AddrSymbol);
unsigned PtrSize = TM.getDataLayout()->getPointerSize(0);
- OutStreamer.EmitSymbolValue(GetExternalSymbolSymbol("__morestack"),
- PtrSize);
+ OutStreamer->EmitSymbolValue(GetExternalSymbolSymbol("__morestack"),
+ PtrSize);
}
// If we don't have any trampolines, then we don't require stack memory
@@ -1141,7 +1139,7 @@ bool AsmPrinter::doFinalization(Module &M) {
Function *InitTrampolineIntrinsic = M.getFunction("llvm.init.trampoline");
if (!InitTrampolineIntrinsic || InitTrampolineIntrinsic->use_empty())
if (const MCSection *S = MAI->getNonexecutableStackSection(OutContext))
- OutStreamer.SwitchSection(S);
+ OutStreamer->SwitchSection(S);
// Allow the target to emit any magic that it wants at the end of the file,
// after everything else has gone out.
@@ -1150,8 +1148,8 @@ bool AsmPrinter::doFinalization(Module &M) {
delete Mang; Mang = nullptr;
MMI = nullptr;
- OutStreamer.Finish();
- OutStreamer.reset();
+ OutStreamer->Finish();
+ OutStreamer->reset();
return false;
}
@@ -1248,7 +1246,7 @@ void AsmPrinter::EmitConstantPool() {
continue;
if (CurSection != CPSections[i].S) {
- OutStreamer.SwitchSection(CPSections[i].S);
+ OutStreamer->SwitchSection(CPSections[i].S);
EmitAlignment(Log2_32(CPSections[i].Alignment));
CurSection = CPSections[i].S;
Offset = 0;
@@ -1259,13 +1257,13 @@ void AsmPrinter::EmitConstantPool() {
// Emit inter-object padding for alignment.
unsigned AlignMask = CPE.getAlignment() - 1;
unsigned NewOffset = (Offset + AlignMask) & ~AlignMask;
- OutStreamer.EmitZeros(NewOffset - Offset);
+ OutStreamer->EmitZeros(NewOffset - Offset);
Type *Ty = CPE.getType();
Offset = NewOffset +
TM.getDataLayout()->getTypeAllocSize(Ty);
- OutStreamer.EmitLabel(Sym);
+ OutStreamer->EmitLabel(Sym);
if (CPE.isMachineConstantPoolEntry())
EmitMachineConstantPoolValue(CPE.Val.MachineCPVal);
else
@@ -1296,7 +1294,7 @@ void AsmPrinter::EmitJumpTableInfo() {
// Drop it in the readonly section.
const MCSection *ReadOnlySection =
TLOF.getSectionForJumpTable(*F, *Mang, TM);
- OutStreamer.SwitchSection(ReadOnlySection);
+ OutStreamer->SwitchSection(ReadOnlySection);
}
EmitAlignment(Log2_32(
@@ -1305,7 +1303,7 @@ void AsmPrinter::EmitJumpTableInfo() {
// Jump tables in code sections are marked with a data_region directive
// where that's supported.
if (!JTInDiffSection)
- OutStreamer.EmitDataRegion(MCDR_DataRegionJT32);
+ OutStreamer->EmitDataRegion(MCDR_DataRegionJT32);
for (unsigned JTI = 0, e = JT.size(); JTI != e; ++JTI) {
const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
@@ -1328,8 +1326,9 @@ void AsmPrinter::EmitJumpTableInfo() {
// .set LJTSet, LBB32-base
const MCExpr *LHS =
MCSymbolRefExpr::Create(MBB->getSymbol(), OutContext);
- OutStreamer.EmitAssignment(GetJTSetSymbol(JTI, MBB->getNumber()),
- MCBinaryExpr::CreateSub(LHS, Base, OutContext));
+ OutStreamer->EmitAssignment(GetJTSetSymbol(JTI, MBB->getNumber()),
+ MCBinaryExpr::CreateSub(LHS, Base,
+ OutContext));
}
}
@@ -1340,15 +1339,15 @@ void AsmPrinter::EmitJumpTableInfo() {
if (JTInDiffSection && DL->hasLinkerPrivateGlobalPrefix())
// FIXME: This doesn't have to have any specific name, just any randomly
// named and numbered 'l' label would work. Simplify GetJTISymbol.
- OutStreamer.EmitLabel(GetJTISymbol(JTI, true));
+ OutStreamer->EmitLabel(GetJTISymbol(JTI, true));
- OutStreamer.EmitLabel(GetJTISymbol(JTI));
+ OutStreamer->EmitLabel(GetJTISymbol(JTI));
for (unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii)
EmitJumpTableEntry(MJTI, JTBBs[ii], JTI);
}
if (!JTInDiffSection)
- OutStreamer.EmitDataRegion(MCDR_DataRegionEnd);
+ OutStreamer->EmitDataRegion(MCDR_DataRegionEnd);
}
/// EmitJumpTableEntry - Emit a jump table entry for the specified MBB to the
@@ -1375,7 +1374,7 @@ void AsmPrinter::EmitJumpTableEntry(const MachineJumpTableInfo *MJTI,
// with a relocation as gp-relative, e.g.:
// .gprel32 LBB123
MCSymbol *MBBSym = MBB->getSymbol();
- OutStreamer.EmitGPRel32Value(MCSymbolRefExpr::Create(MBBSym, OutContext));
+ OutStreamer->EmitGPRel32Value(MCSymbolRefExpr::Create(MBBSym, OutContext));
return;
}
@@ -1384,7 +1383,7 @@ void AsmPrinter::EmitJumpTableEntry(const MachineJumpTableInfo *MJTI,
// with a relocation as gp-relative, e.g.:
// .gpdword LBB123
MCSymbol *MBBSym = MBB->getSymbol();
- OutStreamer.EmitGPRel64Value(MCSymbolRefExpr::Create(MBBSym, OutContext));
+ OutStreamer->EmitGPRel64Value(MCSymbolRefExpr::Create(MBBSym, OutContext));
return;
}
@@ -1413,7 +1412,7 @@ void AsmPrinter::EmitJumpTableEntry(const MachineJumpTableInfo *MJTI,
unsigned EntrySize =
MJTI->getEntrySize(*TM.getDataLayout());
- OutStreamer.EmitValue(Value, EntrySize);
+ OutStreamer->EmitValue(Value, EntrySize);
}
@@ -1442,8 +1441,8 @@ bool AsmPrinter::EmitSpecialLLVMGlobal(const GlobalVariable *GV) {
if (TM.getRelocationModel() == Reloc::Static &&
MAI->hasStaticCtorDtorReferenceInStaticMode()) {
StringRef Sym(".constructors_used");
- OutStreamer.EmitSymbolAttribute(OutContext.GetOrCreateSymbol(Sym),
- MCSA_Reference);
+ OutStreamer->EmitSymbolAttribute(OutContext.GetOrCreateSymbol(Sym),
+ MCSA_Reference);
}
return true;
}
@@ -1454,8 +1453,8 @@ bool AsmPrinter::EmitSpecialLLVMGlobal(const GlobalVariable *GV) {
if (TM.getRelocationModel() == Reloc::Static &&
MAI->hasStaticCtorDtorReferenceInStaticMode()) {
StringRef Sym(".destructors_used");
- OutStreamer.EmitSymbolAttribute(OutContext.GetOrCreateSymbol(Sym),
- MCSA_Reference);
+ OutStreamer->EmitSymbolAttribute(OutContext.GetOrCreateSymbol(Sym),
+ MCSA_Reference);
}
return true;
}
@@ -1472,7 +1471,7 @@ void AsmPrinter::EmitLLVMUsedList(const ConstantArray *InitList) {
const GlobalValue *GV =
dyn_cast<GlobalValue>(InitList->getOperand(i)->stripPointerCasts());
if (GV)
- OutStreamer.EmitSymbolAttribute(getSymbol(GV), MCSA_NoDeadStrip);
+ OutStreamer->EmitSymbolAttribute(getSymbol(GV), MCSA_NoDeadStrip);
}
}
@@ -1541,8 +1540,8 @@ void AsmPrinter::EmitXXStructorList(const Constant *List, bool isCtor) {
const MCSection *OutputSection =
(isCtor ? Obj.getStaticCtorSection(S.Priority, KeySym)
: Obj.getStaticDtorSection(S.Priority, KeySym));
- OutStreamer.SwitchSection(OutputSection);
- if (OutStreamer.getCurrentSection() != OutStreamer.getPreviousSection())
+ OutStreamer->SwitchSection(OutputSection);
+ if (OutStreamer->getCurrentSection() != OutStreamer->getPreviousSection())
EmitAlignment(Align);
EmitXXStructor(S.Func);
}
@@ -1558,7 +1557,7 @@ void AsmPrinter::EmitModuleIdents(Module &M) {
assert(N->getNumOperands() == 1 &&
"llvm.ident metadata entry can have only one operand");
const MDString *S = cast<MDString>(N->getOperand(0));
- OutStreamer.EmitIdent(S->getString());
+ OutStreamer->EmitIdent(S->getString());
}
}
}
@@ -1570,19 +1569,19 @@ void AsmPrinter::EmitModuleIdents(Module &M) {
/// EmitInt8 - Emit a byte directive and value.
///
void AsmPrinter::EmitInt8(int Value) const {
- OutStreamer.EmitIntValue(Value, 1);
+ OutStreamer->EmitIntValue(Value, 1);
}
/// EmitInt16 - Emit a short directive and value.
///
void AsmPrinter::EmitInt16(int Value) const {
- OutStreamer.EmitIntValue(Value, 2);
+ OutStreamer->EmitIntValue(Value, 2);
}
/// EmitInt32 - Emit a long directive and value.
///
void AsmPrinter::EmitInt32(int Value) const {
- OutStreamer.EmitIntValue(Value, 4);
+ OutStreamer->EmitIntValue(Value, 4);
}
/// Emit something like ".long Hi-Lo" where the size in bytes of the directive
@@ -1597,14 +1596,14 @@ void AsmPrinter::EmitLabelDifference(const MCSymbol *Hi, const MCSymbol *Lo,
OutContext);
if (!MAI->doesSetDirectiveSuppressesReloc()) {
- OutStreamer.EmitValue(Diff, Size);
+ OutStreamer->EmitValue(Diff, Size);
return;
}
// Otherwise, emit with .set (aka assignment).
MCSymbol *SetLabel = createTempSymbol("set");
- OutStreamer.EmitAssignment(SetLabel, Diff);
- OutStreamer.EmitSymbolValue(SetLabel, Size);
+ OutStreamer->EmitAssignment(SetLabel, Diff);
+ OutStreamer->EmitSymbolValue(SetLabel, Size);
}
/// EmitLabelPlusOffset - Emit something like ".long Label+Offset"
@@ -1614,7 +1613,7 @@ void AsmPrinter::EmitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset,
unsigned Size,
bool IsSectionRelative) const {
if (MAI->needsDwarfSectionOffsetDirective() && IsSectionRelative) {
- OutStreamer.EmitCOFFSecRel32(Label);
+ OutStreamer->EmitCOFFSecRel32(Label);
return;
}
@@ -1624,7 +1623,7 @@ void AsmPrinter::EmitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset,
Expr = MCBinaryExpr::CreateAdd(
Expr, MCConstantExpr::Create(Offset, OutContext), OutContext);
- OutStreamer.EmitValue(Expr, Size);
+ OutStreamer->EmitValue(Expr, Size);
}
//===----------------------------------------------------------------------===//
@@ -1646,9 +1645,9 @@ void AsmPrinter::EmitAlignment(unsigned NumBits, const GlobalObject *GV) const {
static_cast<unsigned>(std::numeric_limits<unsigned>::digits) &&
"undefined behavior");
if (getCurrentSection()->getKind().isText())
- OutStreamer.EmitCodeAlignment(1u << NumBits);
+ OutStreamer->EmitCodeAlignment(1u << NumBits);
else
- OutStreamer.EmitValueToAlignment(1u << NumBits);
+ OutStreamer->EmitValueToAlignment(1u << NumBits);
}
//===----------------------------------------------------------------------===//
@@ -1860,22 +1859,22 @@ static void emitGlobalConstantDataSequential(const ConstantDataSequential *CDS,
CDS->getType());
// Don't emit a 1-byte object as a .fill.
if (Bytes > 1)
- return AP.OutStreamer.EmitFill(Bytes, Value);
+ return AP.OutStreamer->EmitFill(Bytes, Value);
}
// If this can be emitted with .ascii/.asciz, emit it as such.
if (CDS->isString())
- return AP.OutStreamer.EmitBytes(CDS->getAsString());
+ return AP.OutStreamer->EmitBytes(CDS->getAsString());
// Otherwise, emit the values in successive locations.
unsigned ElementByteSize = CDS->getElementByteSize();
if (isa<IntegerType>(CDS->getElementType())) {
for (unsigned i = 0, e = CDS->getNumElements(); i != e; ++i) {
if (AP.isVerbose())
- AP.OutStreamer.GetCommentOS() << format("0x%" PRIx64 "\n",
- CDS->getElementAsInteger(i));
- AP.OutStreamer.EmitIntValue(CDS->getElementAsInteger(i),
- ElementByteSize);
+ AP.OutStreamer->GetCommentOS() << format("0x%" PRIx64 "\n",
+ CDS->getElementAsInteger(i));
+ AP.OutStreamer->EmitIntValue(CDS->getElementAsInteger(i),
+ ElementByteSize);
}
} else if (ElementByteSize == 4) {
// FP Constants are printed as integer constants to avoid losing
@@ -1889,8 +1888,8 @@ static void emitGlobalConstantDataSequential(const ConstantDataSequential *CDS,
F = CDS->getElementAsFloat(i);
if (AP.isVerbose())
- AP.OutStreamer.GetCommentOS() << "float " << F << '\n';
- AP.OutStreamer.EmitIntValue(I, 4);
+ AP.OutStreamer->GetCommentOS() << "float " << F << '\n';
+ AP.OutStreamer->EmitIntValue(I, 4);
}
} else {
assert(CDS->getElementType()->isDoubleTy());
@@ -1902,8 +1901,8 @@ static void emitGlobalConstantDataSequential(const ConstantDataSequential *CDS,
F = CDS->getElementAsDouble(i);
if (AP.isVerbose())
- AP.OutStreamer.GetCommentOS() << "double " << F << '\n';
- AP.OutStreamer.EmitIntValue(I, 8);
+ AP.OutStreamer->GetCommentOS() << "double " << F << '\n';
+ AP.OutStreamer->EmitIntValue(I, 8);
}
}
@@ -1912,7 +1911,7 @@ static void emitGlobalConstantDataSequential(const ConstantDataSequential *CDS,
unsigned EmittedSize = DL.getTypeAllocSize(CDS->getType()->getElementType()) *
CDS->getNumElements();
if (unsigned Padding = Size - EmittedSize)
- AP.OutStreamer.EmitZeros(Padding);
+ AP.OutStreamer->EmitZeros(Padding);
}
@@ -1925,7 +1924,7 @@ static void emitGlobalConstantArray(const ConstantArray *CA, AsmPrinter &AP,
if (Value != -1) {
uint64_t Bytes = DL.getTypeAllocSize(CA->getType());
- AP.OutStreamer.EmitFill(Bytes, Value);
+ AP.OutStreamer->EmitFill(Bytes, Value);
}
else {
for (unsigned i = 0, e = CA->getNumOperands(); i != e; ++i) {
@@ -1944,7 +1943,7 @@ static void emitGlobalConstantVector(const ConstantVector *CV, AsmPrinter &AP) {
unsigned EmittedSize = DL.getTypeAllocSize(CV->getType()->getElementType()) *
CV->getType()->getNumElements();
if (unsigned Padding = Size - EmittedSize)
- AP.OutStreamer.EmitZeros(Padding);
+ AP.OutStreamer->EmitZeros(Padding);
}
static void emitGlobalConstantStruct(const ConstantStruct *CS, AsmPrinter &AP,
@@ -1969,7 +1968,7 @@ static void emitGlobalConstantStruct(const ConstantStruct *CS, AsmPrinter &AP,
// Insert padding - this may include padding to increase the size of the
// current field up to the ABI size (if the struct is not packed) as well
// as padding to ensure that the next field starts at the right offset.
- AP.OutStreamer.EmitZeros(PadSize);
+ AP.OutStreamer->EmitZeros(PadSize);
}
assert(SizeSoFar == Layout->getSizeInBytes() &&
"Layout of constant struct may be incorrect!");
@@ -1985,10 +1984,10 @@ static void emitGlobalConstantFP(const ConstantFP *CFP, AsmPrinter &AP) {
CFP->getValueAPF().toString(StrVal);
if (CFP->getType())
- CFP->getType()->print(AP.OutStreamer.GetCommentOS());
+ CFP->getType()->print(AP.OutStreamer->GetCommentOS());
else
- AP.OutStreamer.GetCommentOS() << "Printing <null> Type";
- AP.OutStreamer.GetCommentOS() << ' ' << StrVal << '\n';
+ AP.OutStreamer->GetCommentOS() << "Printing <null> Type";
+ AP.OutStreamer->GetCommentOS() << ' ' << StrVal << '\n';
}
// Now iterate through the APInt chunks, emitting them in endian-correct
@@ -2005,23 +2004,23 @@ static void emitGlobalConstantFP(const ConstantFP *CFP, AsmPrinter &AP) {
int Chunk = API.getNumWords() - 1;
if (TrailingBytes)
- AP.OutStreamer.EmitIntValue(p[Chunk--], TrailingBytes);
+ AP.OutStreamer->EmitIntValue(p[Chunk--], TrailingBytes);
for (; Chunk >= 0; --Chunk)
- AP.OutStreamer.EmitIntValue(p[Chunk], sizeof(uint64_t));
+ AP.OutStreamer->EmitIntValue(p[Chunk], sizeof(uint64_t));
} else {
unsigned Chunk;
for (Chunk = 0; Chunk < NumBytes / sizeof(uint64_t); ++Chunk)
- AP.OutStreamer.EmitIntValue(p[Chunk], sizeof(uint64_t));
+ AP.OutStreamer->EmitIntValue(p[Chunk], sizeof(uint64_t));
if (TrailingBytes)
- AP.OutStreamer.EmitIntValue(p[Chunk], TrailingBytes);
+ AP.OutStreamer->EmitIntValue(p[Chunk], TrailingBytes);
}
// Emit the tail padding for the long double.
const DataLayout &DL = *AP.TM.getDataLayout();
- AP.OutStreamer.EmitZeros(DL.getTypeAllocSize(CFP->getType()) -
- DL.getTypeStoreSize(CFP->getType()));
+ AP.OutStreamer->EmitZeros(DL.getTypeAllocSize(CFP->getType()) -
+ DL.getTypeStoreSize(CFP->getType()));
}
static void emitGlobalConstantLargeInt(const ConstantInt *CI, AsmPrinter &AP) {
@@ -2064,7 +2063,7 @@ static void emitGlobalConstantLargeInt(const ConstantInt *CI, AsmPrinter &AP) {
const uint64_t *RawData = Realigned.getRawData();
for (unsigned i = 0, e = BitWidth / 64; i != e; ++i) {
uint64_t Val = DL->isBigEndian() ? RawData[e - i - 1] : RawData[i];
- AP.OutStreamer.EmitIntValue(Val, 8);
+ AP.OutStreamer->EmitIntValue(Val, 8);
}
if (ExtraBitsSize) {
@@ -2077,7 +2076,7 @@ static void emitGlobalConstantLargeInt(const ConstantInt *CI, AsmPrinter &AP) {
assert(Size && Size * 8 >= ExtraBitsSize &&
(ExtraBits & (((uint64_t)-1) >> (64 - ExtraBitsSize)))
== ExtraBits && "Directive too small for extra bits.");
- AP.OutStreamer.EmitIntValue(ExtraBits, Size);
+ AP.OutStreamer->EmitIntValue(ExtraBits, Size);
}
}
@@ -2160,7 +2159,7 @@ static void handleIndirectSymViaGOTPCRel(AsmPrinter &AP, const MCExpr **ME,
const GlobalValue *FinalGV = dyn_cast<GlobalValue>(GV->getOperand(0));
const MCSymbol *FinalSym = AP.getSymbol(FinalGV);
*ME = AP.getObjFileLowering().getIndirectSymViaGOTPCRel(
- FinalSym, MV, Offset, AP.MMI, AP.OutStreamer);
+ FinalSym, MV, Offset, AP.MMI, *AP.OutStreamer);
// Update GOT equivalent usage information
--NumUses;
@@ -2180,7 +2179,7 @@ static void emitGlobalConstantImpl(const Constant *CV, AsmPrinter &AP,
BaseCV = dyn_cast<Constant>(CV->user_back());
if (isa<ConstantAggregateZero>(CV) || isa<UndefValue>(CV))
- return AP.OutStreamer.EmitZeros(Size);
+ return AP.OutStreamer->EmitZeros(Size);
if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
switch (Size) {
@@ -2189,9 +2188,9 @@ static void emitGlobalConstantImpl(const Constant *CV, AsmPrinter &AP,
case 4:
case 8:
if (AP.isVerbose())
- AP.OutStreamer.GetCommentOS() << format("0x%" PRIx64 "\n",
- CI->getZExtValue());
- AP.OutStreamer.EmitIntValue(CI->getZExtValue(), Size);
+ AP.OutStreamer->GetCommentOS() << format("0x%" PRIx64 "\n",
+ CI->getZExtValue());
+ AP.OutStreamer->EmitIntValue(CI->getZExtValue(), Size);
return;
default:
emitGlobalConstantLargeInt(CI, AP);
@@ -2203,7 +2202,7 @@ static void emitGlobalConstantImpl(const Constant *CV, AsmPrinter &AP,
return emitGlobalConstantFP(CFP, AP);
if (isa<ConstantPointerNull>(CV)) {
- AP.OutStreamer.EmitIntValue(0, Size);
+ AP.OutStreamer->EmitIntValue(0, Size);
return;
}
@@ -2245,7 +2244,7 @@ static void emitGlobalConstantImpl(const Constant *CV, AsmPrinter &AP,
if (AP.getObjFileLowering().supportIndirectSymViaGOTPCRel())
handleIndirectSymViaGOTPCRel(AP, &ME, BaseCV, Offset);
- AP.OutStreamer.EmitValue(ME, Size);
+ AP.OutStreamer->EmitValue(ME, Size);
}
/// EmitGlobalConstant - Print a general LLVM constant to the .s file.
@@ -2257,7 +2256,7 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV) {
else if (MAI->hasSubsectionsViaSymbols()) {
// If the global has zero size, emit a single byte so that two labels don't
// look like they are at the same location.
- OutStreamer.EmitIntValue(0, 1);
+ OutStreamer->EmitIntValue(0, 1);
}
}
@@ -2367,16 +2366,16 @@ static void emitBasicBlockLoopComments(const MachineBasicBlock &MBB,
// If this block is not a loop header, just print out what is the loop header
// and return.
if (Header != &MBB) {
- AP.OutStreamer.AddComment(" in Loop: Header=BB" +
- Twine(AP.getFunctionNumber())+"_" +
- Twine(Loop->getHeader()->getNumber())+
- " Depth="+Twine(Loop->getLoopDepth()));
+ AP.OutStreamer->AddComment(" in Loop: Header=BB" +
+ Twine(AP.getFunctionNumber())+"_" +
+ Twine(Loop->getHeader()->getNumber())+
+ " Depth="+Twine(Loop->getLoopDepth()));
return;
}
// Otherwise, it is a loop header. Print out information about child and
// parent loops.
- raw_ostream &OS = AP.OutStreamer.GetCommentOS();
+ raw_ostream &OS = AP.OutStreamer->GetCommentOS();
PrintParentLoopComment(OS, Loop->getParentLoop(), AP.getFunctionNumber());
@@ -2407,18 +2406,18 @@ void AsmPrinter::EmitBasicBlockStart(const MachineBasicBlock &MBB) const {
if (MBB.hasAddressTaken()) {
const BasicBlock *BB = MBB.getBasicBlock();
if (isVerbose())
- OutStreamer.AddComment("Block address taken");
+ OutStreamer->AddComment("Block address taken");
std::vector<MCSymbol*> Symbols = MMI->getAddrLabelSymbolToEmit(BB);
for (auto *Sym : Symbols)
- OutStreamer.EmitLabel(Sym);
+ OutStreamer->EmitLabel(Sym);
}
// Print some verbose block comments.
if (isVerbose()) {
if (const BasicBlock *BB = MBB.getBasicBlock())
if (BB->hasName())
- OutStreamer.AddComment("%" + BB->getName());
+ OutStreamer->AddComment("%" + BB->getName());
emitBasicBlockLoopComments(MBB, LI, *this);
}
@@ -2426,10 +2425,10 @@ void AsmPrinter::EmitBasicBlockStart(const MachineBasicBlock &MBB) const {
if (MBB.pred_empty() || isBlockOnlyReachableByFallthrough(&MBB)) {
if (isVerbose()) {
// NOTE: Want this comment at start of line, don't emit with AddComment.
- OutStreamer.emitRawComment(" BB#" + Twine(MBB.getNumber()) + ":", false);
+ OutStreamer->emitRawComment(" BB#" + Twine(MBB.getNumber()) + ":", false);
}
} else {
- OutStreamer.EmitLabel(MBB.getSymbol());
+ OutStreamer->EmitLabel(MBB.getSymbol());
}
}
@@ -2451,7 +2450,7 @@ void AsmPrinter::EmitVisibility(MCSymbol *Sym, unsigned Visibility,
}
if (Attr != MCSA_Invalid)
- OutStreamer.EmitSymbolAttribute(Sym, Attr);
+ OutStreamer->EmitSymbolAttribute(Sym, Attr);
}
/// isBlockOnlyReachableByFallthough - Return true if the basic block has
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
index 9de36da51a0..6f48767c1df 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
@@ -42,30 +42,30 @@ using namespace llvm;
/// EmitSLEB128 - emit the specified signed leb128 value.
void AsmPrinter::EmitSLEB128(int64_t Value, const char *Desc) const {
if (isVerbose() && Desc)
- OutStreamer.AddComment(Desc);
+ OutStreamer->AddComment(Desc);
- OutStreamer.EmitSLEB128IntValue(Value);
+ OutStreamer->EmitSLEB128IntValue(Value);
}
/// EmitULEB128 - emit the specified signed leb128 value.
void AsmPrinter::EmitULEB128(uint64_t Value, const char *Desc,
unsigned PadTo) const {
if (isVerbose() && Desc)
- OutStreamer.AddComment(Desc);
+ OutStreamer->AddComment(Desc);
- OutStreamer.EmitULEB128IntValue(Value, PadTo);
+ OutStreamer->EmitULEB128IntValue(Value, PadTo);
}
/// EmitCFAByte - Emit a .byte 42 directive for a DW_CFA_xxx value.
void AsmPrinter::EmitCFAByte(unsigned Val) const {
if (isVerbose()) {
if (Val >= dwarf::DW_CFA_offset && Val < dwarf::DW_CFA_offset + 64)
- OutStreamer.AddComment("DW_CFA_offset + Reg (" +
- Twine(Val - dwarf::DW_CFA_offset) + ")");
+ OutStreamer->AddComment("DW_CFA_offset + Reg (" +
+ Twine(Val - dwarf::DW_CFA_offset) + ")");
else
- OutStreamer.AddComment(dwarf::CallFrameString(Val));
+ OutStreamer->AddComment(dwarf::CallFrameString(Val));
}
- OutStreamer.EmitIntValue(Val, 1);
+ OutStreamer->EmitIntValue(Val, 1);
}
static const char *DecodeDWARFEncoding(unsigned Encoding) {
@@ -116,13 +116,13 @@ static const char *DecodeDWARFEncoding(unsigned Encoding) {
void AsmPrinter::EmitEncodingByte(unsigned Val, const char *Desc) const {
if (isVerbose()) {
if (Desc)
- OutStreamer.AddComment(Twine(Desc) + " Encoding = " +
- Twine(DecodeDWARFEncoding(Val)));
+ OutStreamer->AddComment(Twine(Desc) + " Encoding = " +
+ Twine(DecodeDWARFEncoding(Val)));
else
- OutStreamer.AddComment(Twine("Encoding = ") + DecodeDWARFEncoding(Val));
+ OutStreamer->AddComment(Twine("Encoding = ") + DecodeDWARFEncoding(Val));
}
- OutStreamer.EmitIntValue(Val, 1);
+ OutStreamer->EmitIntValue(Val, 1);
}
/// GetSizeOfEncodedValue - Return the size of the encoding in bytes.
@@ -150,10 +150,11 @@ void AsmPrinter::EmitTTypeReference(const GlobalValue *GV,
const TargetLoweringObjectFile &TLOF = getObjFileLowering();
const MCExpr *Exp =
- TLOF.getTTypeGlobalReference(GV, Encoding, *Mang, TM, MMI, OutStreamer);
- OutStreamer.EmitValue(Exp, GetSizeOfEncodedValue(Encoding));
+ TLOF.getTTypeGlobalReference(GV, Encoding, *Mang, TM, MMI,
+ *OutStreamer);
+ OutStreamer->EmitValue(Exp, GetSizeOfEncodedValue(Encoding));
} else
- OutStreamer.EmitIntValue(0, GetSizeOfEncodedValue(Encoding));
+ OutStreamer->EmitIntValue(0, GetSizeOfEncodedValue(Encoding));
}
/// EmitSectionOffset - Emit the 4-byte offset of Label from the start of its
@@ -166,13 +167,13 @@ void AsmPrinter::EmitTTypeReference(const GlobalValue *GV,
void AsmPrinter::emitSectionOffset(const MCSymbol *Label) const {
// On COFF targets, we have to emit the special .secrel32 directive.
if (MAI->needsDwarfSectionOffsetDirective()) {
- OutStreamer.EmitCOFFSecRel32(Label);
+ OutStreamer->EmitCOFFSecRel32(Label);
return;
}
// If the format uses relocations with dwarf, refer to the symbol directly.
if (MAI->doesDwarfUseRelocationsAcrossSections()) {
- OutStreamer.EmitSymbolValue(Label, 4);
+ OutStreamer->EmitSymbolValue(Label, 4);
return;
}
@@ -219,25 +220,25 @@ void AsmPrinter::emitCFIInstruction(const MCCFIInstruction &Inst) const {
default:
llvm_unreachable("Unexpected instruction");
case MCCFIInstruction::OpDefCfaOffset:
- OutStreamer.EmitCFIDefCfaOffset(Inst.getOffset());
+ OutStreamer->EmitCFIDefCfaOffset(Inst.getOffset());
break;
case MCCFIInstruction::OpDefCfa:
- OutStreamer.EmitCFIDefCfa(Inst.getRegister(), Inst.getOffset());
+ OutStreamer->EmitCFIDefCfa(Inst.getRegister(), Inst.getOffset());
break;
case MCCFIInstruction::OpDefCfaRegister:
- OutStreamer.EmitCFIDefCfaRegister(Inst.getRegister());
+ OutStreamer->EmitCFIDefCfaRegister(Inst.getRegister());
break;
case MCCFIInstruction::OpOffset:
- OutStreamer.EmitCFIOffset(Inst.getRegister(), Inst.getOffset());
+ OutStreamer->EmitCFIOffset(Inst.getRegister(), Inst.getOffset());
break;
case MCCFIInstruction::OpRegister:
- OutStreamer.EmitCFIRegister(Inst.getRegister(), Inst.getRegister2());
+ OutStreamer->EmitCFIRegister(Inst.getRegister(), Inst.getRegister2());
break;
case MCCFIInstruction::OpWindowSave:
- OutStreamer.EmitCFIWindowSave();
+ OutStreamer->EmitCFIWindowSave();
break;
case MCCFIInstruction::OpSameValue:
- OutStreamer.EmitCFISameValue(Inst.getRegister());
+ OutStreamer->EmitCFISameValue(Inst.getRegister());
break;
}
}
@@ -248,10 +249,10 @@ void AsmPrinter::emitDwarfDIE(const DIE &Die) const {
// Emit the code (index) for the abbreviation.
if (isVerbose())
- OutStreamer.AddComment("Abbrev [" + Twine(Abbrev.getNumber()) +
- "] 0x" + Twine::utohexstr(Die.getOffset()) +
- ":0x" + Twine::utohexstr(Die.getSize()) + " " +
- dwarf::TagString(Abbrev.getTag()));
+ OutStreamer->AddComment("Abbrev [" + Twine(Abbrev.getNumber()) +
+ "] 0x" + Twine::utohexstr(Die.getOffset()) +
+ ":0x" + Twine::utohexstr(Die.getSize()) + " " +
+ dwarf::TagString(Abbrev.getTag()));
EmitULEB128(Abbrev.getNumber());
const SmallVectorImpl<DIEValue *> &Values = Die.getValues();
@@ -264,9 +265,9 @@ void AsmPrinter::emitDwarfDIE(const DIE &Die) const {
assert(Form && "Too many attributes for DIE (check abbreviation)");
if (isVerbose()) {
- OutStreamer.AddComment(dwarf::AttributeString(Attr));
+ OutStreamer->AddComment(dwarf::AttributeString(Attr));
if (Attr == dwarf::DW_AT_accessibility)
- OutStreamer.AddComment(dwarf::AccessibilityString(
+ OutStreamer->AddComment(dwarf::AccessibilityString(
cast<DIEInteger>(Values[i])->getValue()));
}
@@ -279,7 +280,7 @@ void AsmPrinter::emitDwarfDIE(const DIE &Die) const {
for (auto &Child : Die.getChildren())
emitDwarfDIE(*Child);
- OutStreamer.AddComment("End Of Children Mark");
+ OutStreamer->AddComment("End Of Children Mark");
EmitInt8(0);
}
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
index bf63b1ba3dd..04ab2d16b70 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
@@ -91,9 +91,9 @@ void AsmPrinter::EmitInlineAsm(StringRef Str, const MCSubtargetInfo &STI,
const MCAsmInfo *MCAI = TM.getMCAsmInfo();
assert(MCAI && "No MCAsmInfo");
if (!MCAI->useIntegratedAssembler() &&
- !OutStreamer.isIntegratedAssemblerRequired()) {
+ !OutStreamer->isIntegratedAssemblerRequired()) {
emitInlineAsmStart();
- OutStreamer.EmitRawText(Str);
+ OutStreamer->EmitRawText(Str);
emitInlineAsmEnd(STI, nullptr);
return;
}
@@ -124,7 +124,7 @@ void AsmPrinter::EmitInlineAsm(StringRef Str, const MCSubtargetInfo &STI,
SrcMgr.AddNewSourceBuffer(std::move(Buffer), SMLoc());
std::unique_ptr<MCAsmParser> Parser(
- createMCAsmParser(SrcMgr, OutContext, OutStreamer, *MAI));
+ createMCAsmParser(SrcMgr, OutContext, *OutStreamer, *MAI));
// Create a temporary copy of the original STI because the parser may modify
// it. For example, when switching between arm and thumb mode. If the target
@@ -448,14 +448,14 @@ void AsmPrinter::EmitInlineAsm(const MachineInstr *MI) const {
// If this asmstr is empty, just print the #APP/#NOAPP markers.
// These are useful to see where empty asm's wound up.
if (AsmStr[0] == 0) {
- OutStreamer.emitRawComment(MAI->getInlineAsmStart());
- OutStreamer.emitRawComment(MAI->getInlineAsmEnd());
+ OutStreamer->emitRawComment(MAI->getInlineAsmStart());
+ OutStreamer->emitRawComment(MAI->getInlineAsmEnd());
return;
}
// Emit the #APP start marker. This has to happen even if verbose-asm isn't
// enabled, so we use emitRawComment.
- OutStreamer.emitRawComment(MAI->getInlineAsmStart());
+ OutStreamer->emitRawComment(MAI->getInlineAsmStart());
// Get the !srcloc metadata node if we have it, and decode the loc cookie from
// it.
@@ -492,7 +492,7 @@ void AsmPrinter::EmitInlineAsm(const MachineInstr *MI) const {
// Emit the #NOAPP end marker. This has to happen even if verbose-asm isn't
// enabled, so we use emitRawComment.
- OutStreamer.emitRawComment(MAI->getInlineAsmEnd());
+ OutStreamer->emitRawComment(MAI->getInlineAsmEnd());
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/ByteStreamer.h b/llvm/lib/CodeGen/AsmPrinter/ByteStreamer.h
index 179a4d49582..05767206e6c 100644
--- a/llvm/lib/CodeGen/AsmPrinter/ByteStreamer.h
+++ b/llvm/lib/CodeGen/AsmPrinter/ByteStreamer.h
@@ -40,15 +40,15 @@ private:
public:
APByteStreamer(AsmPrinter &Asm) : AP(Asm) {}
void EmitInt8(uint8_t Byte, const Twine &Comment) override {
- AP.OutStreamer.AddComment(Comment);
+ AP.OutStreamer->AddComment(Comment);
AP.EmitInt8(Byte);
}
void EmitSLEB128(uint64_t DWord, const Twine &Comment) override {
- AP.OutStreamer.AddComment(Comment);
+ AP.OutStreamer->AddComment(Comment);
AP.EmitSLEB128(DWord);
}
void EmitULEB128(uint64_t DWord, const Twine &Comment) override {
- AP.OutStreamer.AddComment(Comment);
+ AP.OutStreamer->AddComment(Comment);
AP.EmitULEB128(DWord);
}
};
diff --git a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
index bb4cf660cef..aa6647f4395 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
@@ -211,7 +211,7 @@ void DIEInteger::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
case dwarf::DW_FORM_flag_present:
// Emit something to keep the lines and comments in sync.
// FIXME: Is there a better way to do this?
- Asm->OutStreamer.AddBlankLine();
+ Asm->OutStreamer->AddBlankLine();
return;
case dwarf::DW_FORM_flag: // Fall thru
case dwarf::DW_FORM_ref1: // Fall thru
@@ -236,7 +236,7 @@ void DIEInteger::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
break;
default: llvm_unreachable("DIE Value form not supported yet");
}
- Asm->OutStreamer.EmitIntValue(Integer, Size);
+ Asm->OutStreamer->EmitIntValue(Integer, Size);
}
/// SizeOf - Determine size of integer value in bytes.
@@ -262,7 +262,7 @@ unsigned DIEInteger::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
case dwarf::DW_FORM_sdata: return getSLEB128Size(Integer);
case dwarf::DW_FORM_addr: return AP->getDataLayout().getPointerSize();
case dwarf::DW_FORM_ref_addr:
- if (AP->OutStreamer.getContext().getDwarfVersion() == 2)
+ if (AP->OutStreamer->getContext().getDwarfVersion() == 2)
return AP->getDataLayout().getPointerSize();
return sizeof(int32_t);
default: llvm_unreachable("DIE Value form not supported yet");
@@ -283,7 +283,7 @@ void DIEInteger::print(raw_ostream &O) const {
/// EmitValue - Emit expression value.
///
void DIEExpr::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
- AP->OutStreamer.EmitValue(Expr, SizeOf(AP, Form));
+ AP->OutStreamer->EmitValue(Expr, SizeOf(AP, Form));
}
/// SizeOf - Determine size of expression value in bytes.
@@ -400,7 +400,7 @@ void DIEEntry::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
AP->EmitLabelPlusOffset(CU->getSectionSym(), Addr,
DIEEntry::getRefAddrSize(AP));
else
- AP->OutStreamer.EmitIntValue(Addr, DIEEntry::getRefAddrSize(AP));
+ AP->OutStreamer->EmitIntValue(Addr, DIEEntry::getRefAddrSize(AP));
} else
AP->EmitInt32(Entry.getOffset());
}
@@ -428,7 +428,7 @@ void DIEEntry::print(raw_ostream &O) const {
//===----------------------------------------------------------------------===//
void DIETypeSignature::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
assert(Form == dwarf::DW_FORM_ref_sig8);
- Asm->OutStreamer.EmitIntValue(Unit.getTypeSignature(), 8);
+ Asm->OutStreamer->EmitIntValue(Unit.getTypeSignature(), 8);
}
#ifndef NDEBUG
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp
index f64338ec832..dfc61e69a88 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp
@@ -111,27 +111,27 @@ void DwarfAccelTable::FinalizeTable(AsmPrinter *Asm, StringRef Prefix) {
// Emits the header for the table via the AsmPrinter.
void DwarfAccelTable::EmitHeader(AsmPrinter *Asm) {
- Asm->OutStreamer.AddComment("Header Magic");
+ Asm->OutStreamer->AddComment("Header Magic");
Asm->EmitInt32(Header.magic);
- Asm->OutStreamer.AddComment("Header Version");
+ Asm->OutStreamer->AddComment("Header Version");
Asm->EmitInt16(Header.version);
- Asm->OutStreamer.AddComment("Header Hash Function");
+ Asm->OutStreamer->AddComment("Header Hash Function");
Asm->EmitInt16(Header.hash_function);
- Asm->OutStreamer.AddComment("Header Bucket Count");
+ Asm->OutStreamer->AddComment("Header Bucket Count");
Asm->EmitInt32(Header.bucket_count);
- Asm->OutStreamer.AddComment("Header Hash Count");
+ Asm->OutStreamer->AddComment("Header Hash Count");
Asm->EmitInt32(Header.hashes_count);
- Asm->OutStreamer.AddComment("Header Data Length");
+ Asm->OutStreamer->AddComment("Header Data Length");
Asm->EmitInt32(Header.header_data_len);
- Asm->OutStreamer.AddComment("HeaderData Die Offset Base");
+ Asm->OutStreamer->AddComment("HeaderData Die Offset Base");
Asm->EmitInt32(HeaderData.die_offset_base);
- Asm->OutStreamer.AddComment("HeaderData Atom Count");
+ Asm->OutStreamer->AddComment("HeaderData Atom Count");
Asm->EmitInt32(HeaderData.Atoms.size());
for (size_t i = 0; i < HeaderData.Atoms.size(); i++) {
Atom A = HeaderData.Atoms[i];
- Asm->OutStreamer.AddComment(dwarf::AtomTypeString(A.type));
+ Asm->OutStreamer->AddComment(dwarf::AtomTypeString(A.type));
Asm->EmitInt16(A.type);
- Asm->OutStreamer.AddComment(dwarf::FormEncodingString(A.form));
+ Asm->OutStreamer->AddComment(dwarf::FormEncodingString(A.form));
Asm->EmitInt16(A.form);
}
}
@@ -141,7 +141,7 @@ void DwarfAccelTable::EmitHeader(AsmPrinter *Asm) {
void DwarfAccelTable::EmitBuckets(AsmPrinter *Asm) {
unsigned index = 0;
for (size_t i = 0, e = Buckets.size(); i < e; ++i) {
- Asm->OutStreamer.AddComment("Bucket " + Twine(i));
+ Asm->OutStreamer->AddComment("Bucket " + Twine(i));
if (Buckets[i].size() != 0)
Asm->EmitInt32(index);
else
@@ -169,7 +169,7 @@ void DwarfAccelTable::EmitHashes(AsmPrinter *Asm) {
uint32_t HashValue = (*HI)->HashValue;
if (PrevHash == HashValue)
continue;
- Asm->OutStreamer.AddComment("Hash in Bucket " + Twine(i));
+ Asm->OutStreamer->AddComment("Hash in Bucket " + Twine(i));
Asm->EmitInt32(HashValue);
PrevHash = HashValue;
}
@@ -190,12 +190,12 @@ void DwarfAccelTable::emitOffsets(AsmPrinter *Asm, const MCSymbol *SecBegin) {
if (PrevHash == HashValue)
continue;
PrevHash = HashValue;
- Asm->OutStreamer.AddComment("Offset in Bucket " + Twine(i));
- MCContext &Context = Asm->OutStreamer.getContext();
+ Asm->OutStreamer->AddComment("Offset in Bucket " + Twine(i));
+ MCContext &Context = Asm->OutStreamer->getContext();
const MCExpr *Sub = MCBinaryExpr::CreateSub(
MCSymbolRefExpr::Create((*HI)->Sym, Context),
MCSymbolRefExpr::Create(SecBegin, Context), Context);
- Asm->OutStreamer.EmitValue(Sub, sizeof(uint32_t));
+ Asm->OutStreamer->EmitValue(Sub, sizeof(uint32_t));
}
}
}
@@ -214,10 +214,10 @@ void DwarfAccelTable::EmitData(AsmPrinter *Asm, DwarfDebug *D) {
if (PrevHash != UINT64_MAX && PrevHash != (*HI)->HashValue)
Asm->EmitInt32(0);
// Remember to emit the label for our offset.
- Asm->OutStreamer.EmitLabel((*HI)->Sym);
- Asm->OutStreamer.AddComment((*HI)->Str);
+ Asm->OutStreamer->EmitLabel((*HI)->Sym);
+ Asm->OutStreamer->AddComment((*HI)->Str);
Asm->emitSectionOffset((*HI)->Data.StrSym);
- Asm->OutStreamer.AddComment("Num DIEs");
+ Asm->OutStreamer->AddComment("Num DIEs");
Asm->EmitInt32((*HI)->Data.Values.size());
for (HashDataContents *HD : (*HI)->Data.Values) {
// Emit the DIE offset
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
index 1bee367996d..0bc873e326b 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
@@ -44,7 +44,7 @@ DwarfCFIExceptionBase::DwarfCFIExceptionBase(AsmPrinter *A)
void DwarfCFIExceptionBase::markFunctionEnd() {
if (shouldEmitCFI)
- Asm->OutStreamer.EmitCFIEndProc();
+ Asm->OutStreamer->EmitCFIEndProc();
if (MMI->getLandingPads().empty())
return;
@@ -64,7 +64,7 @@ DwarfCFIException::~DwarfCFIException() {}
/// content.
void DwarfCFIException::endModule() {
if (moveTypeModule == AsmPrinter::CFI_M_Debug)
- Asm->OutStreamer.EmitCFISections(false, true);
+ Asm->OutStreamer->EmitCFISections(false, true);
// SjLj uses this pass and it doesn't need this info.
if (!Asm->MAI->usesCFIForEH())
@@ -83,7 +83,7 @@ void DwarfCFIException::endModule() {
if (!Personalities[i])
continue;
MCSymbol *Sym = Asm->getSymbol(Personalities[i]);
- TLOF.emitPersonalityValue(Asm->OutStreamer, Asm->TM, Sym);
+ TLOF.emitPersonalityValue(*Asm->OutStreamer, Asm->TM, Sym);
}
}
@@ -117,7 +117,7 @@ void DwarfCFIException::beginFunction(const MachineFunction *MF) {
if (!shouldEmitCFI)
return;
- Asm->OutStreamer.EmitCFIStartProc(/*IsSimple=*/false);
+ Asm->OutStreamer->EmitCFIStartProc(/*IsSimple=*/false);
// Indicate personality routine, if any.
if (!shouldEmitPersonality)
@@ -125,13 +125,13 @@ void DwarfCFIException::beginFunction(const MachineFunction *MF) {
const MCSymbol *Sym =
TLOF.getCFIPersonalitySymbol(Per, *Asm->Mang, Asm->TM, MMI);
- Asm->OutStreamer.EmitCFIPersonality(Sym, PerEncoding);
+ Asm->OutStreamer->EmitCFIPersonality(Sym, PerEncoding);
// Provide LSDA information.
if (!shouldEmitLSDA)
return;
- Asm->OutStreamer.EmitCFILsda(Asm->getCurExceptionSym(), LSDAEncoding);
+ Asm->OutStreamer->EmitCFILsda(Asm->getCurExceptionSym(), LSDAEncoding);
}
/// endFunction - Gather and emit post-function exception information.
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index dbaf1c65273..856920f2ffc 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -64,9 +64,9 @@ unsigned DwarfCompileUnit::getOrCreateSourceID(StringRef FileName,
// FIXME: add a better feature test than hasRawTextSupport. Even better,
// extend .file to support this.
- return Asm->OutStreamer.EmitDwarfFileDirective(
+ return Asm->OutStreamer->EmitDwarfFileDirective(
0, DirName, FileName,
- Asm->OutStreamer.hasRawTextSupport() ? 0 : getUniqueID());
+ Asm->OutStreamer->hasRawTextSupport() ? 0 : getUniqueID());
}
// Return const expression if value is a GEP to access merged global
@@ -240,7 +240,7 @@ void DwarfCompileUnit::addSectionLabel(DIE &Die, dwarf::Attribute Attribute,
void DwarfCompileUnit::initStmtList() {
// Define start line table label for each Compile Unit.
MCSymbol *LineTableStartSym =
- Asm->OutStreamer.getDwarfLineTableSymbol(getUniqueID());
+ Asm->OutStreamer->getDwarfLineTableSymbol(getUniqueID());
stmtListIndex = UnitDie.getValues().size();
@@ -700,7 +700,7 @@ void DwarfCompileUnit::emitHeader(bool UseOffsets) {
// Don't bother labeling the .dwo unit, as its offset isn't used.
if (!Skeleton) {
LabelBegin = Asm->createTempSymbol("cu_begin");
- Asm->OutStreamer.EmitLabel(LabelBegin);
+ Asm->OutStreamer->EmitLabel(LabelBegin);
}
DwarfUnit::emitHeader(UseOffsets);
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index fdea05e50a2..345eea67f7d 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -234,7 +234,7 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
// Everybody else uses GNU's.
UseGNUTLSOpcode = !(IsDarwin || IsPS4) || DwarfVersion < 3;
- Asm->OutStreamer.getContext().setDwarfVersion(DwarfVersion);
+ Asm->OutStreamer->getContext().setDwarfVersion(DwarfVersion);
{
NamedRegionTimer T(DbgTimerName, DWARFGroupName, TimePassesIsEnabled);
@@ -380,8 +380,8 @@ DwarfDebug::constructDwarfCompileUnit(const MDCompileUnit *DIUnit) {
// To avoid the compilation directory being ambiguous, let the line table
// explicitly describe the directory of all files, never relying on the
// compilation directory.
- if (!Asm->OutStreamer.hasRawTextSupport() || SingleCU)
- Asm->OutStreamer.getContext().setMCLineTableCompilationDir(
+ if (!Asm->OutStreamer->hasRawTextSupport() || SingleCU)
+ Asm->OutStreamer->getContext().setMCLineTableCompilationDir(
NewCU.getUniqueID(), CompilationDir);
NewCU.addString(Die, dwarf::DW_AT_producer, DIUnit->getProducer());
@@ -972,7 +972,7 @@ void DwarfDebug::beginInstruction(const MachineInstr *MI) {
Flags |= DWARF2_FLAG_IS_STMT;
}
if (DL.getLine() !=
- Asm->OutStreamer.getContext().getCurrentDwarfLoc().getLine())
+ Asm->OutStreamer->getContext().getCurrentDwarfLoc().getLine())
Flags |= DWARF2_FLAG_IS_STMT;
const MDNode *Scope = DL.getScope();
@@ -998,7 +998,7 @@ void DwarfDebug::beginInstruction(const MachineInstr *MI) {
if (!PrevLabel) {
PrevLabel = MMI->getContext().CreateTempSymbol();
- Asm->OutStreamer.EmitLabel(PrevLabel);
+ Asm->OutStreamer->EmitLabel(PrevLabel);
}
I->second = PrevLabel;
}
@@ -1026,7 +1026,7 @@ void DwarfDebug::endInstruction() {
// We need a label after this instruction.
if (!PrevLabel) {
PrevLabel = MMI->getContext().CreateTempSymbol();
- Asm->OutStreamer.EmitLabel(PrevLabel);
+ Asm->OutStreamer->EmitLabel(PrevLabel);
}
I->second = PrevLabel;
}
@@ -1110,11 +1110,11 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
// is absolute (such as an <> lookup header)))
DwarfCompileUnit *TheCU = SPMap.lookup(FnScope->getScopeNode());
assert(TheCU && "Unable to find compile unit!");
- if (Asm->OutStreamer.hasRawTextSupport())
+ if (Asm->OutStreamer->hasRawTextSupport())
// Use a single line table if we are generating assembly.
- Asm->OutStreamer.getContext().setDwarfCompileUnitID(0);
+ Asm->OutStreamer->getContext().setDwarfCompileUnitID(0);
else
- Asm->OutStreamer.getContext().setDwarfCompileUnitID(TheCU->getUniqueID());
+ Asm->OutStreamer->getContext().setDwarfCompileUnitID(TheCU->getUniqueID());
// Calculate history for local variables.
calculateDbgValueHistory(MF, Asm->MF->getSubtarget().getRegisterInfo(),
@@ -1183,7 +1183,7 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
}
// Set DwarfDwarfCompileUnitID in MCContext to default value.
- Asm->OutStreamer.getContext().setDwarfCompileUnitID(0);
+ Asm->OutStreamer->getContext().setDwarfCompileUnitID(0);
LexicalScope *FnScope = LScopes.getCurrentFunctionScope();
auto *SP = cast<MDSubprogram>(FnScope->getScopeNode());
@@ -1260,12 +1260,12 @@ void DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, const MDNode *S,
if (auto *LBF = dyn_cast<MDLexicalBlockFile>(Scope))
Discriminator = LBF->getDiscriminator();
- unsigned CUID = Asm->OutStreamer.getContext().getDwarfCompileUnitID();
+ unsigned CUID = Asm->OutStreamer->getContext().getDwarfCompileUnitID();
Src = static_cast<DwarfCompileUnit &>(*InfoHolder.getUnits()[CUID])
.getOrCreateSourceID(Fn, Dir);
}
- Asm->OutStreamer.EmitDwarfLocDirective(Src, Line, Col, Flags, 0,
- Discriminator, Fn);
+ Asm->OutStreamer->EmitDwarfLocDirective(Src, Line, Col, Flags, 0,
+ Discriminator, Fn);
}
//===----------------------------------------------------------------------===//
@@ -1288,7 +1288,7 @@ void DwarfDebug::emitAbbreviations() {
void DwarfDebug::emitAccel(DwarfAccelTable &Accel, const MCSection *Section,
StringRef TableName) {
Accel.FinalizeTable(Asm, TableName);
- Asm->OutStreamer.SwitchSection(Section);
+ Asm->OutStreamer->SwitchSection(Section);
// Emit the full data.
Accel.emit(Asm, Section->getBeginSymbol(), this);
@@ -1402,23 +1402,23 @@ void DwarfDebug::emitDebugPubSection(
TheU = Skeleton;
// Start the dwarf pubnames section.
- Asm->OutStreamer.SwitchSection(PSec);
+ Asm->OutStreamer->SwitchSection(PSec);
// Emit the header.
- Asm->OutStreamer.AddComment("Length of Public " + Name + " Info");
+ Asm->OutStreamer->AddComment("Length of Public " + Name + " Info");
MCSymbol *BeginLabel = Asm->createTempSymbol("pub" + Name + "_begin");
MCSymbol *EndLabel = Asm->createTempSymbol("pub" + Name + "_end");
Asm->EmitLabelDifference(EndLabel, BeginLabel, 4);
- Asm->OutStreamer.EmitLabel(BeginLabel);
+ Asm->OutStreamer->EmitLabel(BeginLabel);
- Asm->OutStreamer.AddComment("DWARF Version");
+ Asm->OutStreamer->AddComment("DWARF Version");
Asm->EmitInt16(dwarf::DW_PUBNAMES_VERSION);
- Asm->OutStreamer.AddComment("Offset of Compilation Unit Info");
+ Asm->OutStreamer->AddComment("Offset of Compilation Unit Info");
Asm->emitSectionOffset(TheU->getLabelBegin());
- Asm->OutStreamer.AddComment("Compilation Unit Length");
+ Asm->OutStreamer->AddComment("Compilation Unit Length");
Asm->EmitInt32(TheU->getLength());
// Emit the pubnames for this compilation unit.
@@ -1426,24 +1426,24 @@ void DwarfDebug::emitDebugPubSection(
const char *Name = GI.getKeyData();
const DIE *Entity = GI.second;
- Asm->OutStreamer.AddComment("DIE offset");
+ Asm->OutStreamer->AddComment("DIE offset");
Asm->EmitInt32(Entity->getOffset());
if (GnuStyle) {
dwarf::PubIndexEntryDescriptor Desc = computeIndexValue(TheU, Entity);
- Asm->OutStreamer.AddComment(
+ Asm->OutStreamer->AddComment(
Twine("Kind: ") + dwarf::GDBIndexEntryKindString(Desc.Kind) + ", " +
dwarf::GDBIndexEntryLinkageString(Desc.Linkage));
Asm->EmitInt8(Desc.toBits());
}
- Asm->OutStreamer.AddComment("External Name");
- Asm->OutStreamer.EmitBytes(StringRef(Name, GI.getKeyLength() + 1));
+ Asm->OutStreamer->AddComment("External Name");
+ Asm->OutStreamer->EmitBytes(StringRef(Name, GI.getKeyLength() + 1));
}
- Asm->OutStreamer.AddComment("End Mark");
+ Asm->OutStreamer->AddComment("End Mark");
Asm->EmitInt32(0);
- Asm->OutStreamer.EmitLabel(EndLabel);
+ Asm->OutStreamer->EmitLabel(EndLabel);
}
}
@@ -1545,26 +1545,26 @@ void DebugLocEntry::finalize(const AsmPrinter &AP, DebugLocStream &Locs,
}
void DwarfDebug::emitDebugLocEntryLocation(const DebugLocStream::Entry &Entry) {
- Asm->OutStreamer.AddComment("Loc expr size");
- MCSymbol *begin = Asm->OutStreamer.getContext().CreateTempSymbol();
- MCSymbol *end = Asm->OutStreamer.getContext().CreateTempSymbol();
+ Asm->OutStreamer->AddComment("Loc expr size");
+ MCSymbol *begin = Asm->OutStreamer->getContext().CreateTempSymbol();
+ MCSymbol *end = Asm->OutStreamer->getContext().CreateTempSymbol();
Asm->EmitLabelDifference(end, begin, 2);
- Asm->OutStreamer.EmitLabel(begin);
+ Asm->OutStreamer->EmitLabel(begin);
// Emit the entry.
APByteStreamer Streamer(*Asm);
emitDebugLocEntry(Streamer, Entry);
// Close the range.
- Asm->OutStreamer.EmitLabel(end);
+ Asm->OutStreamer->EmitLabel(end);
}
// Emit locations into the debug loc section.
void DwarfDebug::emitDebugLoc() {
// Start the dwarf loc section.
- Asm->OutStreamer.SwitchSection(
+ Asm->OutStreamer->SwitchSection(
Asm->getObjFileLowering().getDwarfLocSection());
unsigned char Size = Asm->getDataLayout().getPointerSize();
for (const auto &List : DebugLocs.getLists()) {
- Asm->OutStreamer.EmitLabel(List.Label);
+ Asm->OutStreamer->EmitLabel(List.Label);
const DwarfCompileUnit *CU = List.CU;
for (const auto &Entry : DebugLocs.getEntries(List)) {
// Set up the range. This range is relative to the entry point of the
@@ -1574,22 +1574,22 @@ void DwarfDebug::emitDebugLoc() {
Asm->EmitLabelDifference(Entry.BeginSym, Base, Size);
Asm->EmitLabelDifference(Entry.EndSym, Base, Size);
} else {
- Asm->OutStreamer.EmitSymbolValue(Entry.BeginSym, Size);
- Asm->OutStreamer.EmitSymbolValue(Entry.EndSym, Size);
+ Asm->OutStreamer->EmitSymbolValue(Entry.BeginSym, Size);
+ Asm->OutStreamer->EmitSymbolValue(Entry.EndSym, Size);
}
emitDebugLocEntryLocation(Entry);
}
- Asm->OutStreamer.EmitIntValue(0, Size);
- Asm->OutStreamer.EmitIntValue(0, Size);
+ Asm->OutStreamer->EmitIntValue(0, Size);
+ Asm->OutStreamer->EmitIntValue(0, Size);
}
}
void DwarfDebug::emitDebugLocDWO() {
- Asm->OutStreamer.SwitchSection(
+ Asm->OutStreamer->SwitchSection(
Asm->getObjFileLowering().getDwarfLocDWOSection());
for (const auto &List : DebugLocs.getLists()) {
- Asm->OutStreamer.EmitLabel(List.Label);
+ Asm->OutStreamer->EmitLabel(List.Label);
for (const auto &Entry : DebugLocs.getEntries(List)) {
// Just always use start_length for now - at least that's one address
// rather than two. We could get fancier and try to, say, reuse an
@@ -1637,7 +1637,7 @@ void DwarfDebug::emitDebugARanges() {
MCSymbol *Sym = nullptr;
if (Section)
- Sym = Asm->OutStreamer.endSection(Section);
+ Sym = Asm->OutStreamer->endSection(Section);
// Insert a final terminator.
SectionMap[Section].push_back(SymbolCU(nullptr, Sym));
@@ -1667,8 +1667,8 @@ void DwarfDebug::emitDebugARanges() {
// Sort the symbols by offset within the section.
std::sort(List.begin(), List.end(),
[&](const SymbolCU &A, const SymbolCU &B) {
- unsigned IA = A.Sym ? Asm->OutStreamer.GetSymbolOrder(A.Sym) : 0;
- unsigned IB = B.Sym ? Asm->OutStreamer.GetSymbolOrder(B.Sym) : 0;
+ unsigned IA = A.Sym ? Asm->OutStreamer->GetSymbolOrder(A.Sym) : 0;
+ unsigned IB = B.Sym ? Asm->OutStreamer->GetSymbolOrder(B.Sym) : 0;
// Symbols with no order assigned should be placed at the end.
// (e.g. section end labels)
@@ -1697,7 +1697,7 @@ void DwarfDebug::emitDebugARanges() {
}
// Start the dwarf aranges section.
- Asm->OutStreamer.SwitchSection(
+ Asm->OutStreamer->SwitchSection(
Asm->getObjFileLowering().getDwarfARangesSection());
unsigned PtrSize = Asm->getDataLayout().getPointerSize();
@@ -1739,18 +1739,18 @@ void DwarfDebug::emitDebugARanges() {
ContentSize += (List.size() + 1) * TupleSize;
// For each compile unit, write the list of spans it covers.
- Asm->OutStreamer.AddComment("Length of ARange Set");
+ Asm->OutStreamer->AddComment("Length of ARange Set");
Asm->EmitInt32(ContentSize);
- Asm->OutStreamer.AddComment("DWARF Arange version number");
+ Asm->OutStreamer->AddComment("DWARF Arange version number");
Asm->EmitInt16(dwarf::DW_ARANGES_VERSION);
- Asm->OutStreamer.AddComment("Offset Into Debug Info Section");
+ Asm->OutStreamer->AddComment("Offset Into Debug Info Section");
Asm->emitSectionOffset(CU->getLabelBegin());
- Asm->OutStreamer.AddComment("Address Size (in bytes)");
+ Asm->OutStreamer->AddComment("Address Size (in bytes)");
Asm->EmitInt8(PtrSize);
- Asm->OutStreamer.AddComment("Segment Size (in bytes)");
+ Asm->OutStreamer->AddComment("Segment Size (in bytes)");
Asm->EmitInt8(0);
- Asm->OutStreamer.EmitFill(Padding, 0xff);
+ Asm->OutStreamer->EmitFill(Padding, 0xff);
for (const ArangeSpan &Span : List) {
Asm->EmitLabelReference(Span.Start, PtrSize);
@@ -1765,20 +1765,20 @@ void DwarfDebug::emitDebugARanges() {
if (Size == 0)
Size = 1;
- Asm->OutStreamer.EmitIntValue(Size, PtrSize);
+ Asm->OutStreamer->EmitIntValue(Size, PtrSize);
}
}
- Asm->OutStreamer.AddComment("ARange terminator");
- Asm->OutStreamer.EmitIntValue(0, PtrSize);
- Asm->OutStreamer.EmitIntValue(0, PtrSize);
+ Asm->OutStreamer->AddComment("ARange terminator");
+ Asm->OutStreamer->EmitIntValue(0, PtrSize);
+ Asm->OutStreamer->EmitIntValue(0, PtrSize);
}
}
// Emit visible names into a debug ranges section.
void DwarfDebug::emitDebugRanges() {
// Start the dwarf ranges section.
- Asm->OutStreamer.SwitchSection(
+ Asm->OutStreamer->SwitchSection(
Asm->getObjFileLowering().getDwarfRangesSection());
// Size for our labels.
@@ -1794,7 +1794,7 @@ void DwarfDebug::emitDebugRanges() {
// Iterate over the misc ranges for the compile units in the module.
for (const RangeSpanList &List : TheCU->getRangeLists()) {
// Emit our symbol so we can find the beginning of the range.
- Asm->OutStreamer.EmitLabel(List.getSym());
+ Asm->OutStreamer->EmitLabel(List.getSym());
for (const RangeSpan &Range : List.getRanges()) {
const MCSymbol *Begin = Range.getStart();
@@ -1805,14 +1805,14 @@ void DwarfDebug::emitDebugRanges() {
Asm->EmitLabelDifference(Begin, Base, Size);
Asm->EmitLabelDifference(End, Base, Size);
} else {
- Asm->OutStreamer.EmitSymbolValue(Begin, Size);
- Asm->OutStreamer.EmitSymbolValue(End, Size);
+ Asm->OutStreamer->EmitSymbolValue(Begin, Size);
+ Asm->OutStreamer->EmitSymbolValue(End, Size);
}
}
// And terminate the list with two 0 values.
- Asm->OutStreamer.EmitIntValue(0, Size);
- Asm->OutStreamer.EmitIntValue(0, Size);
+ Asm->OutStreamer->EmitIntValue(0, Size);
+ Asm->OutStreamer->EmitIntValue(0, Size);
}
}
}
@@ -1866,9 +1866,9 @@ void DwarfDebug::emitDebugAbbrevDWO() {
void DwarfDebug::emitDebugLineDWO() {
assert(useSplitDwarf() && "No split dwarf?");
- Asm->OutStreamer.SwitchSection(
+ Asm->OutStreamer->SwitchSection(
Asm->getObjFileLowering().getDwarfLineDWOSection());
- SplitTypeUnitFileTable.Emit(Asm->OutStreamer);
+ SplitTypeUnitFileTable.Emit(*Asm->OutStreamer);
}
// Emit the .debug_str.dwo section for separated dwarf. This contains the
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp
index 29a163b8f06..50dbb41c07c 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp
@@ -51,7 +51,7 @@ void DwarfFile::emitUnits(bool UseOffsets) {
for (const auto &TheU : CUs) {
DIE &Die = TheU->getUnitDie();
const MCSection *USection = TheU->getSection();
- Asm->OutStreamer.SwitchSection(USection);
+ Asm->OutStreamer->SwitchSection(USection);
TheU->emitHeader(UseOffsets);
@@ -124,7 +124,7 @@ void DwarfFile::emitAbbrevs(const MCSection *Section) {
// Check to see if it is worth the effort.
if (!Abbreviations.empty()) {
// Start the debug abbrev section.
- Asm->OutStreamer.SwitchSection(Section);
+ Asm->OutStreamer->SwitchSection(Section);
Asm->emitDwarfAbbrevs(Abbreviations);
}
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
index 165ef16dfbc..ee224f8b4d9 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
@@ -38,7 +38,7 @@ void DwarfStringPool::emit(AsmPrinter &Asm, const MCSection *StrSection,
return;
// Start the dwarf str section.
- Asm.OutStreamer.SwitchSection(StrSection);
+ Asm.OutStreamer->SwitchSection(StrSection);
// Get all of the string pool entries and put them in an array by their ID so
// we can sort them.
@@ -50,20 +50,20 @@ void DwarfStringPool::emit(AsmPrinter &Asm, const MCSection *StrSection,
for (const auto &Entry : Entries) {
// Emit a label for reference from debug information entries.
- Asm.OutStreamer.EmitLabel(Entry->getValue().first);
+ Asm.OutStreamer->EmitLabel(Entry->getValue().first);
// Emit the string itself with a terminating null byte.
- Asm.OutStreamer.EmitBytes(
+ Asm.OutStreamer->EmitBytes(
StringRef(Entry->getKeyData(), Entry->getKeyLength() + 1));
}
// If we've got an offset section go ahead and emit that now as well.
if (OffsetSection) {
- Asm.OutStreamer.SwitchSection(OffsetSection);
+ Asm.OutStreamer->SwitchSection(OffsetSection);
unsigned offset = 0;
unsigned size = 4; // FIXME: DWARF64 is 8.
for (const auto &Entry : Entries) {
- Asm.OutStreamer.EmitIntValue(offset, size);
+ Asm.OutStreamer->EmitIntValue(offset, size);
offset += Entry->getKeyLength() + 1;
}
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index 6e00ed82e09..b721077594c 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -1494,12 +1494,12 @@ DIE *DwarfUnit::getOrCreateStaticMemberDIE(const MDDerivedType *DT) {
void DwarfUnit::emitHeader(bool UseOffsets) {
// Emit size of content not including length itself
- Asm->OutStreamer.AddComment("Length of Unit");
+ Asm->OutStreamer->AddComment("Length of Unit");
Asm->EmitInt32(getHeaderSize() + UnitDie.getSize());
- Asm->OutStreamer.AddComment("DWARF version number");
+ Asm->OutStreamer->AddComment("DWARF version number");
Asm->EmitInt16(DD->getDwarfVersion());
- Asm->OutStreamer.AddComment("Offset Into Abbrev. Section");
+ Asm->OutStreamer->AddComment("Offset Into Abbrev. Section");
// We share one abbreviations table across all units so it's always at the
// start of the section. Use a relocatable offset where needed to ensure
@@ -1510,7 +1510,7 @@ void DwarfUnit::emitHeader(bool UseOffsets) {
else
Asm->EmitInt32(0);
- Asm->OutStreamer.AddComment("Address Size (in bytes)");
+ Asm->OutStreamer->AddComment("Address Size (in bytes)");
Asm->EmitInt8(Asm->getDataLayout().getPointerSize());
}
@@ -1521,12 +1521,12 @@ void DwarfUnit::initSection(const MCSection *Section) {
void DwarfTypeUnit::emitHeader(bool UseOffsets) {
DwarfUnit::emitHeader(UseOffsets);
- Asm->OutStreamer.AddComment("Type Signature");
- Asm->OutStreamer.EmitIntValue(TypeSignature, sizeof(TypeSignature));
- Asm->OutStreamer.AddComment("Type DIE Offset");
+ Asm->OutStreamer->AddComment("Type Signature");
+ Asm->OutStreamer->EmitIntValue(TypeSignature, sizeof(TypeSignature));
+ Asm->OutStreamer->AddComment("Type DIE Offset");
// In a skeleton type unit there is no type DIE so emit a zero offset.
- Asm->OutStreamer.EmitIntValue(Ty ? Ty->getOffset() : 0,
- sizeof(Ty->getOffset()));
+ Asm->OutStreamer->EmitIntValue(Ty ? Ty->getOffset() : 0,
+ sizeof(Ty->getOffset()));
}
bool DwarfTypeUnit::isDwoUnit() const {
diff --git a/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp b/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp
index 6f64d8f790a..1ae5b578124 100644
--- a/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp
@@ -434,15 +434,15 @@ void EHStreamer::emitExceptionTable() {
// Sometimes we want not to emit the data into separate section (e.g. ARM
// EHABI). In this case LSDASection will be NULL.
if (LSDASection)
- Asm->OutStreamer.SwitchSection(LSDASection);
+ Asm->OutStreamer->SwitchSection(LSDASection);
Asm->EmitAlignment(2);
// Emit the LSDA.
MCSymbol *GCCETSym =
Asm->OutContext.GetOrCreateSymbol(Twine("GCC_except_table")+
Twine(Asm->getFunctionNumber()));
- Asm->OutStreamer.EmitLabel(GCCETSym);
- Asm->OutStreamer.EmitLabel(Asm->getCurExceptionSym());
+ Asm->OutStreamer->EmitLabel(GCCETSym);
+ Asm->OutStreamer->EmitLabel(Asm->getCurExceptionSym());
// Emit the LSDA header.
Asm->EmitEncodingByte(dwarf::DW_EH_PE_omit, "@LPStart");
@@ -486,7 +486,7 @@ void EHStreamer::emitExceptionTable() {
SizeAlign = 0;
}
- bool VerboseAsm = Asm->OutStreamer.isVerboseAsm();
+ bool VerboseAsm = Asm->OutStreamer->isVerboseAsm();
// SjLj Exception handling
if (IsSJLJ) {
@@ -504,8 +504,8 @@ void EHStreamer::emitExceptionTable() {
// Offset of the landing pad, counted in 16-byte bundles relative to the
// @LPStart address.
if (VerboseAsm) {
- Asm->OutStreamer.AddComment(">> Call Site " + Twine(idx) + " <<");
- Asm->OutStreamer.AddComment(" On exception at call site "+Twine(idx));
+ Asm->OutStreamer->AddComment(">> Call Site " + Twine(idx) + " <<");
+ Asm->OutStreamer->AddComment(" On exception at call site "+Twine(idx));
}
Asm->EmitULEB128(idx);
@@ -514,10 +514,10 @@ void EHStreamer::emitExceptionTable() {
// the action table), and 0 indicates that there are no actions.
if (VerboseAsm) {
if (S.Action == 0)
- Asm->OutStreamer.AddComment(" Action: cleanup");
+ Asm->OutStreamer->AddComment(" Action: cleanup");
else
- Asm->OutStreamer.AddComment(" Action: " +
- Twine((S.Action - 1) / 2 + 1));
+ Asm->OutStreamer->AddComment(" Action: " +
+ Twine((S.Action - 1) / 2 + 1));
}
Asm->EmitULEB128(S.Action);
}
@@ -566,24 +566,24 @@ void EHStreamer::emitExceptionTable() {
// number of 16-byte bundles. The first call site is counted relative to
// the start of the procedure fragment.
if (VerboseAsm)
- Asm->OutStreamer.AddComment(">> Call Site " + Twine(++Entry) + " <<");
+ Asm->OutStreamer->AddComment(">> Call Site " + Twine(++Entry) + " <<");
Asm->EmitLabelDifference(BeginLabel, EHFuncBeginSym, 4);
if (VerboseAsm)
- Asm->OutStreamer.AddComment(Twine(" Call between ") +
- BeginLabel->getName() + " and " +
- EndLabel->getName());
+ Asm->OutStreamer->AddComment(Twine(" Call between ") +
+ BeginLabel->getName() + " and " +
+ EndLabel->getName());
Asm->EmitLabelDifference(EndLabel, BeginLabel, 4);
// Offset of the landing pad, counted in 16-byte bundles relative to the
// @LPStart address.
if (!S.LPad) {
if (VerboseAsm)
- Asm->OutStreamer.AddComment(" has no landing pad");
- Asm->OutStreamer.EmitIntValue(0, 4/*size*/);
+ Asm->OutStreamer->AddComment(" has no landing pad");
+ Asm->OutStreamer->EmitIntValue(0, 4/*size*/);
} else {
if (VerboseAsm)
- Asm->OutStreamer.AddComment(Twine(" jumps to ") +
- S.LPad->LandingPadLabel->getName());
+ Asm->OutStreamer->AddComment(Twine(" jumps to ") +
+ S.LPad->LandingPadLabel->getName());
Asm->EmitLabelDifference(S.LPad->LandingPadLabel, EHFuncBeginSym, 4);
}
@@ -592,10 +592,10 @@ void EHStreamer::emitExceptionTable() {
// the action table), and 0 indicates that there are no actions.
if (VerboseAsm) {
if (S.Action == 0)
- Asm->OutStreamer.AddComment(" On action: cleanup");
+ Asm->OutStreamer->AddComment(" On action: cleanup");
else
- Asm->OutStreamer.AddComment(" On action: " +
- Twine((S.Action - 1) / 2 + 1));
+ Asm->OutStreamer->AddComment(" On action: " +
+ Twine((S.Action - 1) / 2 + 1));
}
Asm->EmitULEB128(S.Action);
}
@@ -609,7 +609,7 @@ void EHStreamer::emitExceptionTable() {
if (VerboseAsm) {
// Emit comments that decode the action table.
- Asm->OutStreamer.AddComment(">> Action Record " + Twine(++Entry) + " <<");
+ Asm->OutStreamer->AddComment(">> Action Record " + Twine(++Entry) + " <<");
}
// Type Filter
@@ -618,13 +618,13 @@ void EHStreamer::emitExceptionTable() {
// type of the catch clauses or the types in the exception specification.
if (VerboseAsm) {
if (Action.ValueForTypeID > 0)
- Asm->OutStreamer.AddComment(" Catch TypeInfo " +
- Twine(Action.ValueForTypeID));
+ Asm->OutStreamer->AddComment(" Catch TypeInfo " +
+ Twine(Action.ValueForTypeID));
else if (Action.ValueForTypeID < 0)
- Asm->OutStreamer.AddComment(" Filter TypeInfo " +
- Twine(Action.ValueForTypeID));
+ Asm->OutStreamer->AddComment(" Filter TypeInfo " +
+ Twine(Action.ValueForTypeID));
else
- Asm->OutStreamer.AddComment(" Cleanup");
+ Asm->OutStreamer->AddComment(" Cleanup");
}
Asm->EmitSLEB128(Action.ValueForTypeID);
@@ -634,10 +634,10 @@ void EHStreamer::emitExceptionTable() {
// or 0 if there is no next action record.
if (VerboseAsm) {
if (Action.NextAction == 0) {
- Asm->OutStreamer.AddComment(" No further actions");
+ Asm->OutStreamer->AddComment(" No further actions");
} else {
unsigned NextAction = Entry + (Action.NextAction + 1) / 2;
- Asm->OutStreamer.AddComment(" Continue to action "+Twine(NextAction));
+ Asm->OutStreamer->AddComment(" Continue to action "+Twine(NextAction));
}
}
Asm->EmitSLEB128(Action.NextAction);
@@ -652,13 +652,13 @@ void EHStreamer::emitTypeInfos(unsigned TTypeEncoding) {
const std::vector<const GlobalValue *> &TypeInfos = MMI->getTypeInfos();
const std::vector<unsigned> &FilterIds = MMI->getFilterIds();
- bool VerboseAsm = Asm->OutStreamer.isVerboseAsm();
+ bool VerboseAsm = Asm->OutStreamer->isVerboseAsm();
int Entry = 0;
// Emit the Catch TypeInfos.
if (VerboseAsm && !TypeInfos.empty()) {
- Asm->OutStreamer.AddComment(">> Catch TypeInfos <<");
- Asm->OutStreamer.AddBlankLine();
+ Asm->OutStreamer->AddComment(">> Catch TypeInfos <<");
+ Asm->OutStreamer->AddBlankLine();
Entry = TypeInfos.size();
}
@@ -666,14 +666,14 @@ void EHStreamer::emitTypeInfos(unsigned TTypeEncoding) {
I = TypeInfos.rbegin(), E = TypeInfos.rend(); I != E; ++I) {
const GlobalValue *GV = *I;
if (VerboseAsm)
- Asm->OutStreamer.AddComment("TypeInfo " + Twine(Entry--));
+ Asm->OutStreamer->AddComment("TypeInfo " + Twine(Entry--));
Asm->EmitTTypeReference(GV, TTypeEncoding);
}
// Emit the Exception Specifications.
if (VerboseAsm && !FilterIds.empty()) {
- Asm->OutStreamer.AddComment(">> Filter TypeInfos <<");
- Asm->OutStreamer.AddBlankLine();
+ Asm->OutStreamer->AddComment(">> Filter TypeInfos <<");
+ Asm->OutStreamer->AddBlankLine();
Entry = 0;
}
for (std::vector<unsigned>::const_iterator
@@ -682,7 +682,7 @@ void EHStreamer::emitTypeInfos(unsigned TTypeEncoding) {
if (VerboseAsm) {
--Entry;
if (isFilterEHSelector(TypeID))
- Asm->OutStreamer.AddComment("FilterInfo " + Twine(Entry));
+ Asm->OutStreamer->AddComment("FilterInfo " + Twine(Entry));
}
Asm->EmitULEB128(TypeID);
diff --git a/llvm/lib/CodeGen/AsmPrinter/ErlangGCPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/ErlangGCPrinter.cpp
index 97a3234c28f..eb9e4c10daf 100644
--- a/llvm/lib/CodeGen/AsmPrinter/ErlangGCPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/ErlangGCPrinter.cpp
@@ -47,11 +47,11 @@ void llvm::linkErlangGCPrinter() {}
void ErlangGCPrinter::finishAssembly(Module &M, GCModuleInfo &Info,
AsmPrinter &AP) {
- MCStreamer &OS = AP.OutStreamer;
+ MCStreamer &OS = *AP.OutStreamer;
unsigned IntPtrSize = AP.TM.getDataLayout()->getPointerSize();
// Put this in a custom .note section.
- AP.OutStreamer.SwitchSection(
+ OS.SwitchSection(
AP.getObjFileLowering().getContext().getELFSection(".note.gc",
ELF::SHT_PROGBITS, 0));
diff --git a/llvm/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
index 76d6a065815..c49e7a1b799 100644
--- a/llvm/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
@@ -62,16 +62,16 @@ static void EmitCamlGlobal(const Module &M, AsmPrinter &AP, const char *Id) {
MCSymbol *Sym = AP.OutContext.GetOrCreateSymbol(TmpStr);
- AP.OutStreamer.EmitSymbolAttribute(Sym, MCSA_Global);
- AP.OutStreamer.EmitLabel(Sym);
+ AP.OutStreamer->EmitSymbolAttribute(Sym, MCSA_Global);
+ AP.OutStreamer->EmitLabel(Sym);
}
void OcamlGCMetadataPrinter::beginAssembly(Module &M, GCModuleInfo &Info,
AsmPrinter &AP) {
- AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getTextSection());
+ AP.OutStreamer->SwitchSection(AP.getObjFileLowering().getTextSection());
EmitCamlGlobal(M, AP, "code_begin");
- AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getDataSection());
+ AP.OutStreamer->SwitchSection(AP.getObjFileLowering().getDataSection());
EmitCamlGlobal(M, AP, "data_begin");
}
@@ -95,16 +95,16 @@ void OcamlGCMetadataPrinter::finishAssembly(Module &M, GCModuleInfo &Info,
AsmPrinter &AP) {
unsigned IntPtrSize = AP.TM.getDataLayout()->getPointerSize();
- AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getTextSection());
+ AP.OutStreamer->SwitchSection(AP.getObjFileLowering().getTextSection());
EmitCamlGlobal(M, AP, "code_end");
- AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getDataSection());
+ AP.OutStreamer->SwitchSection(AP.getObjFileLowering().getDataSection());
EmitCamlGlobal(M, AP, "data_end");
// FIXME: Why does ocaml emit this??
- AP.OutStreamer.EmitIntValue(0, IntPtrSize);
+ AP.OutStreamer->EmitIntValue(0, IntPtrSize);
- AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getDataSection());
+ AP.OutStreamer->SwitchSection(AP.getObjFileLowering().getDataSection());
EmitCamlGlobal(M, AP, "frametable");
int NumDescriptors = 0;
@@ -146,9 +146,9 @@ void OcamlGCMetadataPrinter::finishAssembly(Module &M, GCModuleInfo &Info,
Twine(uintptr_t(&FI)) + ")");
}
- AP.OutStreamer.AddComment("live roots for " +
- Twine(FI.getFunction().getName()));
- AP.OutStreamer.AddBlankLine();
+ AP.OutStreamer->AddComment("live roots for " +
+ Twine(FI.getFunction().getName()));
+ AP.OutStreamer->AddBlankLine();
for (GCFunctionInfo::iterator J = FI.begin(), JE = FI.end(); J != JE; ++J) {
size_t LiveCount = FI.live_size(J);
@@ -160,7 +160,7 @@ void OcamlGCMetadataPrinter::finishAssembly(Module &M, GCModuleInfo &Info,
Twine(LiveCount) + " >= 65536.");
}
- AP.OutStreamer.EmitSymbolValue(J->Label, IntPtrSize);
+ AP.OutStreamer->EmitSymbolValue(J->Label, IntPtrSize);
AP.EmitInt16(FrameSize);
AP.EmitInt16(LiveCount);
diff --git a/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp b/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp
index be15989e5f6..b89ca011648 100644
--- a/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp
@@ -83,7 +83,7 @@ void Win64Exception::beginFunction(const MachineFunction *MF) {
GlobalValue::getRealLinkageName(F->getName()));
// Emit a symbol assignment.
- Asm->OutStreamer.EmitAssignment(
+ Asm->OutStreamer->EmitAssignment(
HandlerTypeParentFrameOffset,
MCConstantExpr::Create(I->second, Asm->OutContext));
}
@@ -92,14 +92,14 @@ void Win64Exception::beginFunction(const MachineFunction *MF) {
if (!shouldEmitPersonality && !shouldEmitMoves)
return;
- Asm->OutStreamer.EmitWinCFIStartProc(Asm->CurrentFnSym);
+ Asm->OutStreamer->EmitWinCFIStartProc(Asm->CurrentFnSym);
if (!shouldEmitPersonality)
return;
const MCSymbol *PersHandlerSym =
TLOF.getCFIPersonalitySymbol(Per, *Asm->Mang, Asm->TM, MMI);
- Asm->OutStreamer.EmitWinEHHandler(PersHandlerSym, true, true);
+ Asm->OutStreamer->EmitWinEHHandler(PersHandlerSym, true, true);
}
/// endFunction - Gather and emit post-function exception information.
@@ -117,10 +117,10 @@ void Win64Exception::endFunction(const MachineFunction *MF) {
MMI->TidyLandingPads();
if (shouldEmitPersonality) {
- Asm->OutStreamer.PushSection();
+ Asm->OutStreamer->PushSection();
// Emit an UNWIND_INFO struct describing the prologue.
- Asm->OutStreamer.EmitWinEHHandlerData();
+ Asm->OutStreamer->EmitWinEHHandlerData();
// Emit the tables appropriate to the personality function in use. If we
// don't recognize the personality, assume it uses an Itanium-style LSDA.
@@ -131,9 +131,9 @@ void Win64Exception::endFunction(const MachineFunction *MF) {
else
emitExceptionTable();
- Asm->OutStreamer.PopSection();
+ Asm->OutStreamer->PopSection();
}
- Asm->OutStreamer.EmitWinCFIEndProc();
+ Asm->OutStreamer->EmitWinCFIEndProc();
}
const MCExpr *Win64Exception::createImageRel32(const MCSymbol *Value) {
@@ -208,7 +208,7 @@ void Win64Exception::emitCSpecificHandlerTable() {
continue; // Ignore gaps.
NumEntries += CSE.LPad->SEHHandlers.size();
}
- Asm->OutStreamer.EmitIntValue(NumEntries, 4);
+ Asm->OutStreamer->EmitIntValue(NumEntries, 4);
// If there are no actions, we don't need to iterate again.
if (NumEntries == 0)
@@ -241,25 +241,25 @@ void Win64Exception::emitCSpecificHandlerTable() {
// Emit an entry for each action.
for (SEHHandler Handler : LPad->SEHHandlers) {
- Asm->OutStreamer.EmitValue(Begin, 4);
- Asm->OutStreamer.EmitValue(End, 4);
+ Asm->OutStreamer->EmitValue(Begin, 4);
+ Asm->OutStreamer->EmitValue(End, 4);
// Emit the filter or finally function pointer, if present. Otherwise,
// emit '1' to indicate a catch-all.
const Function *F = Handler.FilterOrFinally;
if (F)
- Asm->OutStreamer.EmitValue(createImageRel32(Asm->getSymbol(F)), 4);
+ Asm->OutStreamer->EmitValue(createImageRel32(Asm->getSymbol(F)), 4);
else
- Asm->OutStreamer.EmitIntValue(1, 4);
+ Asm->OutStreamer->EmitIntValue(1, 4);
// Emit the recovery address, if present. Otherwise, this must be a
// finally.
const BlockAddress *BA = Handler.RecoverBA;
if (BA)
- Asm->OutStreamer.EmitValue(
+ Asm->OutStreamer->EmitValue(
createImageRel32(Asm->GetBlockAddressSymbol(BA)), 4);
else
- Asm->OutStreamer.EmitIntValue(0, 4);
+ Asm->OutStreamer->EmitIntValue(0, 4);
}
}
}
@@ -267,7 +267,7 @@ void Win64Exception::emitCSpecificHandlerTable() {
void Win64Exception::emitCXXFrameHandler3Table(const MachineFunction *MF) {
const Function *F = MF->getFunction();
const Function *ParentF = MMI->getWinEHParent(F);
- auto &OS = Asm->OutStreamer;
+ auto &OS = *Asm->OutStreamer;
WinEHFuncInfo &FuncInfo = MMI->getWinEHFuncInfo(ParentF);
StringRef ParentLinkageName =
diff --git a/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp b/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp
index a8f17c6e81f..ff217813eeb 100644
--- a/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp
@@ -95,7 +95,7 @@ void WinCodeViewLineTables::maybeRecordLocation(DebugLoc DL,
FileNameRegistry.add(Filename);
MCSymbol *MCL = Asm->MMI->getContext().CreateTempSymbol();
- Asm->OutStreamer.EmitLabel(MCL);
+ Asm->OutStreamer->EmitLabel(MCL);
CurFn->Instrs.push_back(MCL);
InstrInfo[MCL] = InstrInfoTy(Filename, DL.getLine());
}
@@ -120,7 +120,7 @@ void WinCodeViewLineTables::endModule() {
return;
assert(Asm != nullptr);
- Asm->OutStreamer.SwitchSection(
+ Asm->OutStreamer->SwitchSection(
Asm->getObjFileLowering().getCOFFDebugSymbolsSection());
Asm->EmitInt32(COFF::DEBUG_SECTION_MAGIC);
@@ -135,7 +135,7 @@ void WinCodeViewLineTables::endModule() {
emitDebugInfoForFunction(VisitedFunctions[I]);
// This subsection holds a file index to offset in string table table.
- Asm->OutStreamer.AddComment("File index to string table offset subsection");
+ Asm->OutStreamer->AddComment("File index to string table offset subsection");
Asm->EmitInt32(COFF::DEBUG_INDEX_SUBSECTION);
size_t NumFilenames = FileNameRegistry.Infos.size();
Asm->EmitInt32(8 * NumFilenames);
@@ -148,7 +148,7 @@ void WinCodeViewLineTables::endModule() {
}
// This subsection holds the string table.
- Asm->OutStreamer.AddComment("String table");
+ Asm->OutStreamer->AddComment("String table");
Asm->EmitInt32(COFF::DEBUG_STRING_TABLE_SUBSECTION);
Asm->EmitInt32(FileNameRegistry.LastOffset);
// The payload starts with a null character.
@@ -156,12 +156,12 @@ void WinCodeViewLineTables::endModule() {
for (size_t I = 0, E = FileNameRegistry.Filenames.size(); I != E; ++I) {
// Just emit unique filenames one by one, separated by a null character.
- Asm->OutStreamer.EmitBytes(FileNameRegistry.Filenames[I]);
+ Asm->OutStreamer->EmitBytes(FileNameRegistry.Filenames[I]);
Asm->EmitInt8(0);
}
// No more subsections. Fill with zeros to align the end of the section by 4.
- Asm->OutStreamer.EmitFill((-FileNameRegistry.LastOffset) % 4, 0);
+ Asm->OutStreamer->EmitFill((-FileNameRegistry.LastOffset) % 4, 0);
clear();
}
@@ -203,39 +203,39 @@ void WinCodeViewLineTables::emitDebugInfoForFunction(const Function *GV) {
// Emit a symbol subsection, required by VS2012+ to find function boundaries.
MCSymbol *SymbolsBegin = Asm->MMI->getContext().CreateTempSymbol(),
*SymbolsEnd = Asm->MMI->getContext().CreateTempSymbol();
- Asm->OutStreamer.AddComment("Symbol subsection for " + Twine(FuncName));
+ Asm->OutStreamer->AddComment("Symbol subsection for " + Twine(FuncName));
Asm->EmitInt32(COFF::DEBUG_SYMBOL_SUBSECTION);
- EmitLabelDiff(Asm->OutStreamer, SymbolsBegin, SymbolsEnd);
- Asm->OutStreamer.EmitLabel(SymbolsBegin);
+ EmitLabelDiff(*Asm->OutStreamer, SymbolsBegin, SymbolsEnd);
+ Asm->OutStreamer->EmitLabel(SymbolsBegin);
{
MCSymbol *ProcSegmentBegin = Asm->MMI->getContext().CreateTempSymbol(),
*ProcSegmentEnd = Asm->MMI->getContext().CreateTempSymbol();
- EmitLabelDiff(Asm->OutStreamer, ProcSegmentBegin, ProcSegmentEnd, 2);
- Asm->OutStreamer.EmitLabel(ProcSegmentBegin);
+ EmitLabelDiff(*Asm->OutStreamer, ProcSegmentBegin, ProcSegmentEnd, 2);
+ Asm->OutStreamer->EmitLabel(ProcSegmentBegin);
Asm->EmitInt16(COFF::DEBUG_SYMBOL_TYPE_PROC_START);
// Some bytes of this segment don't seem to be required for basic debugging,
// so just fill them with zeroes.
- Asm->OutStreamer.EmitFill(12, 0);
+ Asm->OutStreamer->EmitFill(12, 0);
// This is the important bit that tells the debugger where the function
// code is located and what's its size:
- EmitLabelDiff(Asm->OutStreamer, Fn, FI.End);
- Asm->OutStreamer.EmitFill(12, 0);
- Asm->OutStreamer.EmitCOFFSecRel32(Fn);
- Asm->OutStreamer.EmitCOFFSectionIndex(Fn);
+ EmitLabelDiff(*Asm->OutStreamer, Fn, FI.End);
+ Asm->OutStreamer->EmitFill(12, 0);
+ Asm->OutStreamer->EmitCOFFSecRel32(Fn);
+ Asm->OutStreamer->EmitCOFFSectionIndex(Fn);
Asm->EmitInt8(0);
// Emit the function display name as a null-terminated string.
- Asm->OutStreamer.EmitBytes(FuncName);
+ Asm->OutStreamer->EmitBytes(FuncName);
Asm->EmitInt8(0);
- Asm->OutStreamer.EmitLabel(ProcSegmentEnd);
+ Asm->OutStreamer->EmitLabel(ProcSegmentEnd);
// We're done with this function.
Asm->EmitInt16(0x0002);
Asm->EmitInt16(COFF::DEBUG_SYMBOL_TYPE_PROC_END);
}
- Asm->OutStreamer.EmitLabel(SymbolsEnd);
+ Asm->OutStreamer->EmitLabel(SymbolsEnd);
// Every subsection must be aligned to a 4-byte boundary.
- Asm->OutStreamer.EmitFill((-FuncName.size()) % 4, 0);
+ Asm->OutStreamer->EmitFill((-FuncName.size()) % 4, 0);
// PCs/Instructions are grouped into segments sharing the same filename.
// Pre-calculate the lengths (in instructions) of these segments and store
@@ -254,21 +254,21 @@ void WinCodeViewLineTables::emitDebugInfoForFunction(const Function *GV) {
FilenameSegmentLengths[LastSegmentEnd] = FI.Instrs.size() - LastSegmentEnd;
// Emit a line table subsection, requred to do PC-to-file:line lookup.
- Asm->OutStreamer.AddComment("Line table subsection for " + Twine(FuncName));
+ Asm->OutStreamer->AddComment("Line table subsection for " + Twine(FuncName));
Asm->EmitInt32(COFF::DEBUG_LINE_TABLE_SUBSECTION);
MCSymbol *LineTableBegin = Asm->MMI->getContext().CreateTempSymbol(),
*LineTableEnd = Asm->MMI->getContext().CreateTempSymbol();
- EmitLabelDiff(Asm->OutStreamer, LineTableBegin, LineTableEnd);
- Asm->OutStreamer.EmitLabel(LineTableBegin);
+ EmitLabelDiff(*Asm->OutStreamer, LineTableBegin, LineTableEnd);
+ Asm->OutStreamer->EmitLabel(LineTableBegin);
// Identify the function this subsection is for.
- Asm->OutStreamer.EmitCOFFSecRel32(Fn);
- Asm->OutStreamer.EmitCOFFSectionIndex(Fn);
+ Asm->OutStreamer->EmitCOFFSecRel32(Fn);
+ Asm->OutStreamer->EmitCOFFSectionIndex(Fn);
// Insert padding after a 16-bit section index.
Asm->EmitInt16(0);
// Length of the function's code, in bytes.
- EmitLabelDiff(Asm->OutStreamer, Fn, FI.End);
+ EmitLabelDiff(*Asm->OutStreamer, Fn, FI.End);
// PC-to-linenumber lookup table:
MCSymbol *FileSegmentEnd = nullptr;
@@ -279,17 +279,17 @@ void WinCodeViewLineTables::emitDebugInfoForFunction(const Function *GV) {
if (FilenameSegmentLengths.count(J)) {
// We came to a beginning of a new filename segment.
if (FileSegmentEnd)
- Asm->OutStreamer.EmitLabel(FileSegmentEnd);
+ Asm->OutStreamer->EmitLabel(FileSegmentEnd);
StringRef CurFilename = InstrInfo[FI.Instrs[J]].Filename;
assert(FileNameRegistry.Infos.count(CurFilename));
size_t IndexInStringTable =
FileNameRegistry.Infos[CurFilename].FilenameID;
// Each segment starts with the offset of the filename
// in the string table.
- Asm->OutStreamer.AddComment(
+ Asm->OutStreamer->AddComment(
"Segment for file '" + Twine(CurFilename) + "' begins");
MCSymbol *FileSegmentBegin = Asm->MMI->getContext().CreateTempSymbol();
- Asm->OutStreamer.EmitLabel(FileSegmentBegin);
+ Asm->OutStreamer->EmitLabel(FileSegmentBegin);
Asm->EmitInt32(8 * IndexInStringTable);
// Number of PC records in the lookup table.
@@ -299,17 +299,17 @@ void WinCodeViewLineTables::emitDebugInfoForFunction(const Function *GV) {
// Full size of the segment for this filename, including the prev two
// records.
FileSegmentEnd = Asm->MMI->getContext().CreateTempSymbol();
- EmitLabelDiff(Asm->OutStreamer, FileSegmentBegin, FileSegmentEnd);
+ EmitLabelDiff(*Asm->OutStreamer, FileSegmentBegin, FileSegmentEnd);
}
// The first PC with the given linenumber and the linenumber itself.
- EmitLabelDiff(Asm->OutStreamer, Fn, Instr);
+ EmitLabelDiff(*Asm->OutStreamer, Fn, Instr);
Asm->EmitInt32(InstrInfo[Instr].LineNumber);
}
if (FileSegmentEnd)
- Asm->OutStreamer.EmitLabel(FileSegmentEnd);
- Asm->OutStreamer.EmitLabel(LineTableEnd);
+ Asm->OutStreamer->EmitLabel(FileSegmentEnd);
+ Asm->OutStreamer->EmitLabel(LineTableEnd);
}
void WinCodeViewLineTables::beginFunction(const MachineFunction *MF) {
OpenPOWER on IntegriCloud