diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2012-01-07 22:42:19 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2012-01-07 22:42:19 +0000 |
commit | 547be2699c547b79a7735858a64921d8ccf180f7 (patch) | |
tree | 616d1b084764043625272e37932b36dd5eeb54ac | |
parent | 86132a721d7671f382e0c88c0233ec92186daaf4 (diff) | |
download | external_llvm-547be2699c547b79a7735858a64921d8ccf180f7.zip external_llvm-547be2699c547b79a7735858a64921d8ccf180f7.tar.gz external_llvm-547be2699c547b79a7735858a64921d8ccf180f7.tar.bz2 |
Don't print a label before .cfi_startproc when we don't need to. This makes
the produce assembly when using CFI just a bit more readable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147743 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/MC/MCObjectStreamer.h | 1 | ||||
-rw-r--r-- | include/llvm/MC/MCStreamer.h | 4 | ||||
-rw-r--r-- | lib/MC/MCAsmStreamer.cpp | 10 | ||||
-rw-r--r-- | lib/MC/MCObjectStreamer.cpp | 4 | ||||
-rw-r--r-- | lib/MC/MCStreamer.cpp | 14 | ||||
-rw-r--r-- | test/CodeGen/ARM/debug-info-sreg2.ll | 6 | ||||
-rw-r--r-- | test/CodeGen/X86/dbg-merge-loc-entry.ll | 2 | ||||
-rw-r--r-- | test/CodeGen/X86/empty-functions.ll | 2 | ||||
-rw-r--r-- | test/CodeGen/X86/pr11202.ll | 4 | ||||
-rw-r--r-- | test/CodeGen/X86/tail-dup-addr.ll | 2 |
10 files changed, 30 insertions, 19 deletions
diff --git a/include/llvm/MC/MCObjectStreamer.h b/include/llvm/MC/MCObjectStreamer.h index deed1ca..dc7ddcf 100644 --- a/include/llvm/MC/MCObjectStreamer.h +++ b/include/llvm/MC/MCObjectStreamer.h @@ -34,6 +34,7 @@ class MCObjectStreamer : public MCStreamer { MCSectionData *CurSectionData; virtual void EmitInstToData(const MCInst &Inst) = 0; + virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame); protected: MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB, diff --git a/include/llvm/MC/MCStreamer.h b/include/llvm/MC/MCStreamer.h index e227c48..8c4ad2d 100644 --- a/include/llvm/MC/MCStreamer.h +++ b/include/llvm/MC/MCStreamer.h @@ -94,6 +94,8 @@ namespace llvm { const MCExpr *ForceExpAbs(const MCExpr* Expr); + void RecordProcStart(MCDwarfFrameInfo &Frame); + virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame); void EmitFrames(bool usingCFI); MCWin64EHUnwindInfo *getCurrentW64UnwindInfo(){return CurrentW64UnwindInfo;} @@ -536,7 +538,7 @@ namespace llvm { virtual void EmitCompactUnwindEncoding(uint32_t CompactUnwindEncoding); virtual void EmitCFISections(bool EH, bool Debug); - virtual void EmitCFIStartProc(); + void EmitCFIStartProc(); virtual void EmitCFIEndProc(); virtual void EmitCFIDefCfa(int64_t Register, int64_t Offset); virtual void EmitCFIDefCfaOffset(int64_t Offset); diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp index ca2f10e..d70db24 100644 --- a/lib/MC/MCAsmStreamer.cpp +++ b/lib/MC/MCAsmStreamer.cpp @@ -61,6 +61,7 @@ private: bool needsSet(const MCExpr *Value); void EmitRegisterName(int64_t Register); + virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame); public: MCAsmStreamer(MCContext &Context, formatted_raw_ostream &os, @@ -209,7 +210,6 @@ public: StringRef FileName); virtual void EmitCFISections(bool EH, bool Debug); - virtual void EmitCFIStartProc(); virtual void EmitCFIEndProc(); virtual void EmitCFIDefCfa(int64_t Register, int64_t Offset); virtual void EmitCFIDefCfaOffset(int64_t Offset); @@ -841,11 +841,11 @@ void MCAsmStreamer::EmitCFISections(bool EH, bool Debug) { EmitEOL(); } -void MCAsmStreamer::EmitCFIStartProc() { - MCStreamer::EmitCFIStartProc(); - - if (!UseCFI) +void MCAsmStreamer::EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame) { + if (!UseCFI) { + RecordProcStart(Frame); return; + } OS << "\t.cfi_startproc"; EmitEOL(); diff --git a/lib/MC/MCObjectStreamer.cpp b/lib/MC/MCObjectStreamer.cpp index 76c853c..ffe3362 100644 --- a/lib/MC/MCObjectStreamer.cpp +++ b/lib/MC/MCObjectStreamer.cpp @@ -105,6 +105,10 @@ void MCObjectStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size, DF->getContents().resize(DF->getContents().size() + Size, 0); } +void MCObjectStreamer::EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame) { + RecordProcStart(Frame); +} + void MCObjectStreamer::EmitLabel(MCSymbol *Symbol) { MCStreamer::EmitLabel(Symbol); diff --git a/lib/MC/MCStreamer.cpp b/lib/MC/MCStreamer.cpp index ce9de9d..145489a 100644 --- a/lib/MC/MCStreamer.cpp +++ b/lib/MC/MCStreamer.cpp @@ -276,8 +276,17 @@ void MCStreamer::EmitCFIStartProc() { report_fatal_error("Starting a frame before finishing the previous one!"); MCDwarfFrameInfo Frame; - Frame.Function = LastSymbol; + EmitCFIStartProcImpl(Frame); + + FrameInfos.push_back(Frame); + RegionIndicator = Code; +} +void MCStreamer::EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame) { +} + +void MCStreamer::RecordProcStart(MCDwarfFrameInfo &Frame) { + Frame.Function = LastSymbol; // If the function is externally visible, we need to create a local // symbol to avoid relocations. StringRef Prefix = getContext().getAsmInfo().getPrivateGlobalPrefix(); @@ -287,9 +296,6 @@ void MCStreamer::EmitCFIStartProc() { Frame.Begin = getContext().CreateTempSymbol(); EmitLabel(Frame.Begin); } - - FrameInfos.push_back(Frame); - RegionIndicator = Code; } void MCStreamer::EmitCFIEndProc() { diff --git a/test/CodeGen/ARM/debug-info-sreg2.ll b/test/CodeGen/ARM/debug-info-sreg2.ll index 3972e68..703850d 100644 --- a/test/CodeGen/ARM/debug-info-sreg2.ll +++ b/test/CodeGen/ARM/debug-info-sreg2.ll @@ -4,11 +4,11 @@ target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32- target triple = "thumbv7-apple-macosx10.6.7" ;CHECK: Ldebug_loc0: +;CHECK-NEXT: .long Ltmp0 ;CHECK-NEXT: .long Ltmp1 -;CHECK-NEXT: .long Ltmp2 -;CHECK-NEXT: Lset[[N:[0-9]+]] = Ltmp10-Ltmp9 @ Loc expr size +;CHECK-NEXT: Lset[[N:[0-9]+]] = Ltmp9-Ltmp8 @ Loc expr size ;CHECK-NEXT: .short Lset[[N]] -;CHECK-NEXT: Ltmp9: +;CHECK-NEXT: Ltmp8: ;CHECK-NEXT: .byte 144 @ DW_OP_regx for S register define void @_Z3foov() optsize ssp { diff --git a/test/CodeGen/X86/dbg-merge-loc-entry.ll b/test/CodeGen/X86/dbg-merge-loc-entry.ll index afe1729..a624b82 100644 --- a/test/CodeGen/X86/dbg-merge-loc-entry.ll +++ b/test/CodeGen/X86/dbg-merge-loc-entry.ll @@ -10,7 +10,7 @@ target triple = "x86_64-apple-darwin8" ;CHECK-NEXT: .short Lset ;CHECK-NEXT: Ltmp ;CHECK-NEXT: .byte 85 ## DW_OP_reg5 -;CHECK-NEXT: Ltmp7 +;CHECK-NEXT: Ltmp6 ;CHECK-NEXT: .quad 0 ;CHECK-NEXT: .quad 0 diff --git a/test/CodeGen/X86/empty-functions.ll b/test/CodeGen/X86/empty-functions.ll index 874c53a..41dabd2 100644 --- a/test/CodeGen/X86/empty-functions.ll +++ b/test/CodeGen/X86/empty-functions.ll @@ -6,14 +6,12 @@ entry: unreachable } ; CHECK-NO-FP: _func: -; CHECK-NO-FP-NEXT: : ; CHECK-NO-FP-NEXT: .cfi_startproc ; CHECK-NO-FP: nop ; CHECK-NO-FP-NEXT: : ; CHECK-NO-FP-NEXT: .cfi_endproc ; CHECK-FP: _func: -; CHECK-FP-NEXT: : ; CHECK-FP-NEXT: .cfi_startproc ; CHECK-FP-NEXT: : ; CHECK-FP-NEXT: pushq %rbp diff --git a/test/CodeGen/X86/pr11202.ll b/test/CodeGen/X86/pr11202.ll index 2b26a69..13070d1 100644 --- a/test/CodeGen/X86/pr11202.ll +++ b/test/CodeGen/X86/pr11202.ll @@ -15,5 +15,5 @@ l2: ; preds = %l1 br label %l1 } -; CHECK: .Ltmp1: # Address of block that was removed by CodeGen -; CHECK: .quad .Ltmp1 +; CHECK: .Ltmp0: # Address of block that was removed by CodeGen +; CHECK: .quad .Ltmp0 diff --git a/test/CodeGen/X86/tail-dup-addr.ll b/test/CodeGen/X86/tail-dup-addr.ll index c5a105c..c68a8c6 100644 --- a/test/CodeGen/X86/tail-dup-addr.ll +++ b/test/CodeGen/X86/tail-dup-addr.ll @@ -2,8 +2,8 @@ ; Test that we don't drop a block that has its address taken. +; CHECK: Ltmp0: ## Block address taken ; CHECK: Ltmp1: ## Block address taken -; CHECK: Ltmp2: ## Block address taken @a = common global i32 0, align 4 @p = common global i8* null, align 8 |