Remove support for not using .loc directives.

Clang itself was not using this. The only way to access it was via llc.

llvm-svn: 200862
This commit is contained in:
Rafael Espindola 2014-02-05 18:00:21 +00:00
parent 29d5999eb7
commit b4eec1daa1
19 changed files with 62 additions and 126 deletions

View File

@ -43,6 +43,10 @@ Non-comprehensive list of changes in this release
* Clang can now successfully self-host itself on Linux/Sparc64 and on
FreeBSD/Sparc64.
* LLVM now assumes the assembler supports ``.loc`` for generating debug line
numbers. The old support for printing the debug line info directly was only
used by ``llc`` and has been removed.
.. NOTE
For small 1-3 sentence descriptions, just add an entry at the end of
this list. If your description won't fit comfortably in one bullet

View File

@ -85,9 +85,6 @@ FileType("filetype", cl::init(TargetMachine::CGFT_AssemblyFile),
"Emit nothing, for performance testing"),
clEnumValEnd));
cl::opt<bool> DisableDotLoc("disable-dot-loc", cl::Hidden,
cl::desc("Do not use .loc entries"));
cl::opt<bool> DisableCFI("disable-cfi", cl::Hidden,
cl::desc("Do not use .cfi_* directives"));

View File

@ -737,11 +737,10 @@ MCStreamer *createNullStreamer(MCContext &Ctx);
/// \param ShowInst - Whether to show the MCInst representation inline with
/// the assembly.
MCStreamer *createAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS,
bool isVerboseAsm, bool useLoc, bool useCFI,
bool useDwarfDirectory,
MCInstPrinter *InstPrint = 0,
MCCodeEmitter *CE = 0, MCAsmBackend *TAB = 0,
bool ShowInst = false);
bool isVerboseAsm, bool useCFI,
bool useDwarfDirectory, MCInstPrinter *InstPrint,
MCCodeEmitter *CE, MCAsmBackend *TAB,
bool ShowInst);
/// createMachOStreamer - Create a machine code streamer which will generate
/// Mach-O format object files.

View File

@ -50,9 +50,8 @@ namespace llvm {
class raw_ostream;
class formatted_raw_ostream;
MCStreamer *createAsmStreamer(MCContext &Ctx,
formatted_raw_ostream &OS, bool isVerboseAsm,
bool useLoc, bool useCFI,
MCStreamer *createAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS,
bool isVerboseAsm, bool useCFI,
bool useDwarfDirectory,
MCInstPrinter *InstPrint, MCCodeEmitter *CE,
MCAsmBackend *TAB, bool ShowInst);
@ -132,7 +131,6 @@ namespace llvm {
typedef MCStreamer *(*AsmStreamerCtorTy)(MCContext &Ctx,
formatted_raw_ostream &OS,
bool isVerboseAsm,
bool useLoc,
bool useCFI,
bool useDwarfDirectory,
MCInstPrinter *InstPrint,
@ -432,7 +430,6 @@ namespace llvm {
MCStreamer *createAsmStreamer(MCContext &Ctx,
formatted_raw_ostream &OS,
bool isVerboseAsm,
bool useLoc,
bool useCFI,
bool useDwarfDirectory,
MCInstPrinter *InstPrint,
@ -440,10 +437,10 @@ namespace llvm {
MCAsmBackend *TAB,
bool ShowInst) const {
if (AsmStreamerCtorFn)
return AsmStreamerCtorFn(Ctx, OS, isVerboseAsm, useLoc, useCFI,
return AsmStreamerCtorFn(Ctx, OS, isVerboseAsm, useCFI,
useDwarfDirectory, InstPrint, CE, TAB,
ShowInst);
return llvm::createAsmStreamer(Ctx, OS, isVerboseAsm, useLoc, useCFI,
return llvm::createAsmStreamer(Ctx, OS, isVerboseAsm, useCFI,
useDwarfDirectory, InstPrint, CE, TAB,
ShowInst);
}

View File

@ -85,7 +85,6 @@ protected: // Can only create subclasses.
unsigned MCRelaxAll : 1;
unsigned MCNoExecStack : 1;
unsigned MCSaveTempLabels : 1;
unsigned MCUseLoc : 1;
unsigned MCUseCFI : 1;
unsigned MCUseDwarfDirectory : 1;
unsigned RequireStructuredCFG : 1;
@ -182,12 +181,6 @@ public:
/// setMCNoExecStack - Set whether an executabel stack is not needed.
void setMCNoExecStack(bool Value) { MCNoExecStack = Value; }
/// hasMCUseLoc - Check whether we should use dwarf's .loc directive.
bool hasMCUseLoc() const { return MCUseLoc; }
/// setMCUseLoc - Set whether all we should use dwarf's .loc directive.
void setMCUseLoc(bool Value) { MCUseLoc = Value; }
/// hasMCUseCFI - Check whether we should use dwarf's .cfi_* directives.
bool hasMCUseCFI() const { return MCUseCFI; }

View File

@ -765,9 +765,6 @@ void AsmPrinter::EmitFunctionBody() {
if (isVerbose()) emitKill(II, *this);
break;
default:
if (!TM.hasMCUseLoc())
MCLineEntry::Make(&OutStreamer, getCurrentSection());
EmitInstruction(II);
break;
}

View File

@ -688,12 +688,12 @@ DIE *DwarfDebug::constructScopeDIE(DwarfCompileUnit *TheCU,
// as well.
unsigned DwarfDebug::getOrCreateSourceID(StringRef FileName, StringRef DirName,
unsigned CUID) {
// If we use .loc in assembly, we can't separate .file entries according to
// If we print assembly, we can't separate .file entries according to
// compile units. Thus all files will belong to the default compile unit.
// FIXME: add a better feature test than hasRawTextSupport. Even better,
// extend .file to support this.
if (Asm->TM.hasMCUseLoc() && Asm->OutStreamer.hasRawTextSupport())
if (Asm->OutStreamer.hasRawTextSupport())
CUID = 0;
// If FE did not provide a file name, then assume stdin.
@ -766,10 +766,9 @@ DwarfCompileUnit *DwarfDebug::constructDwarfCompileUnit(DICompileUnit DIUnit) {
Asm->OutStreamer.getContext().setMCLineTableSymbol(LineTableStartSym,
NewCU->getUniqueID());
// Use a single line table if we are using .loc and generating assembly.
// Use a single line table if we are generating assembly.
bool UseTheFirstCU =
(Asm->TM.hasMCUseLoc() && Asm->OutStreamer.hasRawTextSupport()) ||
(NewCU->getUniqueID() == 0);
Asm->OutStreamer.hasRawTextSupport() || (NewCU->getUniqueID() == 0);
if (!useSplitDwarf()) {
// DW_AT_stmt_list is a offset of line number information for this
@ -1551,8 +1550,8 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
LexicalScope *FnScope = LScopes.getCurrentFunctionScope();
DwarfCompileUnit *TheCU = SPMap.lookup(FnScope->getScopeNode());
assert(TheCU && "Unable to find compile unit!");
if (Asm->TM.hasMCUseLoc() && Asm->OutStreamer.hasRawTextSupport())
// Use a single line table if we are using .loc and generating assembly.
if (Asm->OutStreamer.hasRawTextSupport())
// Use a single line table if we are generating assembly.
Asm->OutStreamer.getContext().setDwarfCompileUnitID(0);
else
Asm->OutStreamer.getContext().setDwarfCompileUnitID(TheCU->getUniqueID());

View File

@ -185,7 +185,6 @@ bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
TargetCPU);
MCStreamer *S = getTarget().createAsmStreamer(*Context, Out,
getVerboseAsm(),
hasMCUseLoc(),
hasMCUseCFI(),
hasMCUseDwarfDirectory(),
InstPrinter,

View File

@ -50,7 +50,6 @@ private:
unsigned IsVerboseAsm : 1;
unsigned ShowInst : 1;
unsigned UseLoc : 1;
unsigned UseCFI : 1;
unsigned UseDwarfDirectory : 1;
@ -67,13 +66,13 @@ private:
public:
MCAsmStreamer(MCContext &Context, formatted_raw_ostream &os,
bool isVerboseAsm, bool useLoc, bool useCFI,
bool useDwarfDirectory, MCInstPrinter *printer,
MCCodeEmitter *emitter, MCAsmBackend *asmbackend, bool showInst)
bool isVerboseAsm, bool useCFI, bool useDwarfDirectory,
MCInstPrinter *printer, MCCodeEmitter *emitter,
MCAsmBackend *asmbackend, bool showInst)
: MCStreamer(Context), OS(os), MAI(Context.getAsmInfo()),
InstPrinter(printer), Emitter(emitter), AsmBackend(asmbackend),
CommentStream(CommentToEmit), IsVerboseAsm(isVerboseAsm),
ShowInst(showInst), UseLoc(useLoc), UseCFI(useCFI),
ShowInst(showInst), UseCFI(useCFI),
UseDwarfDirectory(useDwarfDirectory) {
if (InstPrinter && IsVerboseAsm)
InstPrinter->setCommentStream(CommentStream);
@ -863,17 +862,16 @@ bool MCAsmStreamer::EmitDwarfFileDirective(unsigned FileNo, StringRef Directory,
return EmitDwarfFileDirective(FileNo, "", FullPathName, CUID);
}
if (UseLoc) {
OS << "\t.file\t" << FileNo << ' ';
if (!Directory.empty()) {
PrintQuotedString(Directory, OS);
OS << ' ';
}
PrintQuotedString(Filename, OS);
EmitEOL();
// All .file will belong to a single CUID.
CUID = 0;
OS << "\t.file\t" << FileNo << ' ';
if (!Directory.empty()) {
PrintQuotedString(Directory, OS);
OS << ' ';
}
PrintQuotedString(Filename, OS);
EmitEOL();
// All .file will belong to a single CUID.
CUID = 0;
return this->MCStreamer::EmitDwarfFileDirective(FileNo, Directory, Filename,
CUID);
}
@ -885,9 +883,6 @@ void MCAsmStreamer::EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
StringRef FileName) {
this->MCStreamer::EmitDwarfLocDirective(FileNo, Line, Column, Flags,
Isa, Discriminator, FileName);
if (!UseLoc)
return;
OS << "\t.loc\t" << FileNo << " " << Line << " " << Column;
if (Flags & DWARF2_FLAG_BASIC_BLOCK)
OS << " basic_block";
@ -1395,15 +1390,9 @@ void MCAsmStreamer::EmitRawTextImpl(StringRef String) {
}
void MCAsmStreamer::FinishImpl() {
// FIXME: This header is duplicated with MCObjectStreamer
// Dump out the dwarf file & directory tables and line tables.
const MCSymbol *LineSectionSymbol = NULL;
if (getContext().hasDwarfFiles() && !UseLoc)
LineSectionSymbol = MCDwarfFileTable::Emit(this);
// If we are generating dwarf for assembly source files dump out the sections.
if (getContext().getGenDwarfForAssembly())
MCGenDwarfInfo::Emit(this, LineSectionSymbol);
MCGenDwarfInfo::Emit(this, NULL);
if (!UseCFI)
EmitFrames(AsmBackend.get(), false);
@ -1411,10 +1400,10 @@ void MCAsmStreamer::FinishImpl() {
MCStreamer *llvm::createAsmStreamer(MCContext &Context,
formatted_raw_ostream &OS,
bool isVerboseAsm, bool useLoc, bool useCFI,
bool isVerboseAsm, bool useCFI,
bool useDwarfDirectory, MCInstPrinter *IP,
MCCodeEmitter *CE, MCAsmBackend *MAB,
bool ShowInst) {
return new MCAsmStreamer(Context, OS, isVerboseAsm, useLoc,
useCFI, useDwarfDirectory, IP, CE, MAB, ShowInst);
return new MCAsmStreamer(Context, OS, isVerboseAsm, useCFI, useDwarfDirectory,
IP, CE, MAB, ShowInst);
}

View File

@ -1293,13 +1293,13 @@ void ARMELFStreamer::emitUnwindRaw(int64_t Offset,
namespace llvm {
MCStreamer *createMCAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS,
bool isVerboseAsm, bool useLoc, bool useCFI,
bool isVerboseAsm, bool useCFI,
bool useDwarfDirectory,
MCInstPrinter *InstPrint, MCCodeEmitter *CE,
MCAsmBackend *TAB, bool ShowInst) {
MCStreamer *S =
llvm::createAsmStreamer(Ctx, OS, isVerboseAsm, useLoc, useCFI,
useDwarfDirectory, InstPrint, CE, TAB, ShowInst);
llvm::createAsmStreamer(Ctx, OS, isVerboseAsm, useCFI, useDwarfDirectory,
InstPrint, CE, TAB, ShowInst);
new ARMTargetAsmStreamer(*S, OS, *InstPrint, isVerboseAsm);
return S;
}

View File

@ -46,7 +46,7 @@ namespace ARM_MC {
}
MCStreamer *createMCAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS,
bool isVerboseAsm, bool useLoc, bool useCFI,
bool isVerboseAsm, bool useCFI,
bool useDwarfDirectory,
MCInstPrinter *InstPrint, MCCodeEmitter *CE,
MCAsmBackend *TAB, bool ShowInst);

View File

@ -140,12 +140,12 @@ static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
static MCStreamer *
createMCAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS,
bool isVerboseAsm, bool useLoc, bool useCFI,
bool useDwarfDirectory, MCInstPrinter *InstPrint,
MCCodeEmitter *CE, MCAsmBackend *TAB, bool ShowInst) {
bool isVerboseAsm, bool useCFI, bool useDwarfDirectory,
MCInstPrinter *InstPrint, MCCodeEmitter *CE,
MCAsmBackend *TAB, bool ShowInst) {
MCStreamer *S =
llvm::createAsmStreamer(Ctx, OS, isVerboseAsm, useLoc, useCFI,
useDwarfDirectory, InstPrint, CE, TAB, ShowInst);
llvm::createAsmStreamer(Ctx, OS, isVerboseAsm, useCFI, useDwarfDirectory,
InstPrint, CE, TAB, ShowInst);
new MipsTargetAsmStreamer(*S, OS);
return S;
}

View File

@ -175,13 +175,13 @@ static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
static MCStreamer *
createMCAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS,
bool isVerboseAsm, bool useLoc, bool useCFI,
bool useDwarfDirectory, MCInstPrinter *InstPrint,
MCCodeEmitter *CE, MCAsmBackend *TAB, bool ShowInst) {
bool isVerboseAsm, bool useCFI, bool useDwarfDirectory,
MCInstPrinter *InstPrint, MCCodeEmitter *CE,
MCAsmBackend *TAB, bool ShowInst) {
MCStreamer *S =
llvm::createAsmStreamer(Ctx, OS, isVerboseAsm, useLoc, useCFI,
useDwarfDirectory, InstPrint, CE, TAB, ShowInst);
llvm::createAsmStreamer(Ctx, OS, isVerboseAsm, useCFI, useDwarfDirectory,
InstPrint, CE, TAB, ShowInst);
new PPCTargetAsmStreamer(*S, OS);
return S;
}

View File

@ -133,13 +133,13 @@ static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
static MCStreamer *
createMCAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS,
bool isVerboseAsm, bool useLoc, bool useCFI,
bool useDwarfDirectory, MCInstPrinter *InstPrint,
MCCodeEmitter *CE, MCAsmBackend *TAB, bool ShowInst) {
bool isVerboseAsm, bool useCFI, bool useDwarfDirectory,
MCInstPrinter *InstPrint, MCCodeEmitter *CE,
MCAsmBackend *TAB, bool ShowInst) {
MCStreamer *S =
llvm::createAsmStreamer(Ctx, OS, isVerboseAsm, useLoc, useCFI,
useDwarfDirectory, InstPrint, CE, TAB, ShowInst);
llvm::createAsmStreamer(Ctx, OS, isVerboseAsm, useCFI, useDwarfDirectory,
InstPrint, CE, TAB, ShowInst);
new SparcTargetAsmStreamer(*S, OS);
return S;
}

View File

@ -52,7 +52,6 @@ TargetMachine::TargetMachine(const Target &T,
MCRelaxAll(false),
MCNoExecStack(false),
MCSaveTempLabels(false),
MCUseLoc(true),
MCUseCFI(true),
MCUseDwarfDirectory(false),
RequireStructuredCFG(false),

View File

@ -128,12 +128,12 @@ void XCoreTargetAsmStreamer::emitCCBottomFunction(StringRef Name) {
static MCStreamer *
createXCoreMCAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS,
bool isVerboseAsm, bool useLoc, bool useCFI,
bool useDwarfDirectory, MCInstPrinter *InstPrint,
MCCodeEmitter *CE, MCAsmBackend *TAB, bool ShowInst) {
bool isVerboseAsm, bool useCFI, bool useDwarfDirectory,
MCInstPrinter *InstPrint, MCCodeEmitter *CE,
MCAsmBackend *TAB, bool ShowInst) {
MCStreamer *S =
llvm::createAsmStreamer(Ctx, OS, isVerboseAsm, useLoc, useCFI,
useDwarfDirectory, InstPrint, CE, TAB, ShowInst);
llvm::createAsmStreamer(Ctx, OS, isVerboseAsm, useCFI, useDwarfDirectory,
InstPrint, CE, TAB, ShowInst);
new XCoreTargetAsmStreamer(*S, OS);
return S;
}

View File

@ -1,27 +0,0 @@
; RUN: llc < %s -disable-dot-loc -mtriple=x86_64-apple-darwin -O0 | FileCheck %s
define void @foo() nounwind ssp {
entry:
ret void, !dbg !5
}
!llvm.dbg.cu = !{!2}
!llvm.module.flags = !{!10}
!7 = metadata !{metadata !0}
!0 = metadata !{i32 786478, metadata !9, metadata !1, metadata !"foo", metadata !"foo", metadata !"", i32 3, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void ()* @foo, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
!1 = metadata !{i32 786473, metadata !9} ; [ DW_TAG_file_type ]
!2 = metadata !{i32 786449, metadata !9, i32 12, metadata !"clang version 2.9 (trunk 120563)", i1 false, metadata !"", i32 0, metadata !8, metadata !8, metadata !7, null, null, metadata !""} ; [ DW_TAG_compile_unit ]
!3 = metadata !{i32 786453, metadata !9, metadata !1, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!4 = metadata !{null}
!5 = metadata !{i32 5, i32 1, metadata !6, null}
!6 = metadata !{i32 786443, metadata !9, metadata !0, i32 3, i32 16, i32 0} ; [ DW_TAG_lexical_block ]
!8 = metadata !{i32 0}
!9 = metadata !{metadata !"e.c", metadata !"/private/tmp"}
; CHECK: .subsections_via_symbols
; CHECK-NEXT: __debug_line
; CHECK-NEXT: Lline_table_start0
; CHECK-NEXT: Ltmp{{[0-9]}} = (Ltmp
!10 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}

View File

@ -288,9 +288,6 @@ static int compileModule(char **argv, LLVMContext &Context) {
assert(mod && "Should have exited after outputting help!");
TargetMachine &Target = *target.get();
if (DisableDotLoc)
Target.setMCUseLoc(false);
if (DisableCFI)
Target.setMCUseCFI(false);
@ -300,11 +297,6 @@ static int compileModule(char **argv, LLVMContext &Context) {
if (GenerateSoftFloatCalls)
FloatABIForCalls = FloatABI::Soft;
// Disable .loc support for older OS X versions.
if (TheTriple.isMacOSX() &&
TheTriple.isMacOSXVersionLT(10, 6))
Target.setMCUseLoc(false);
// Figure out where we are going to send the output.
OwningPtr<tool_output_file> Out
(GetOutputStream(TheTarget->getName(), TheTriple.getOS(), argv[0]));

View File

@ -435,11 +435,9 @@ int main(int argc, char **argv) {
MAB = TheTarget->createMCAsmBackend(*MRI, TripleName, MCPU);
}
bool UseCFI = !DisableCFI;
Str.reset(TheTarget->createAsmStreamer(Ctx, FOS, /*asmverbose*/true,
/*useLoc*/ true,
UseCFI,
/*useDwarfDirectory*/ true,
IP, CE, MAB, ShowInst));
Str.reset(TheTarget->createAsmStreamer(
Ctx, FOS, /*asmverbose*/ true, UseCFI,
/*useDwarfDirectory*/ true, IP, CE, MAB, ShowInst));
} else if (FileType == OFT_Null) {
Str.reset(createNullStreamer(Ctx));