Don't print an unused label before .cfi_endproc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147763 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2012-01-09 00:17:29 +00:00
parent 39f227e4dd
commit 1fe9737eb4
8 changed files with 29 additions and 13 deletions

View File

@ -35,6 +35,7 @@ class MCObjectStreamer : public MCStreamer {
virtual void EmitInstToData(const MCInst &Inst) = 0;
virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame);
virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame);
protected:
MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB,

View File

@ -96,6 +96,8 @@ namespace llvm {
void RecordProcStart(MCDwarfFrameInfo &Frame);
virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame);
void RecordProcEnd(MCDwarfFrameInfo &Frame);
virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &CurFrame);
void EmitFrames(bool usingCFI);
MCWin64EHUnwindInfo *getCurrentW64UnwindInfo(){return CurrentW64UnwindInfo;}
@ -539,7 +541,7 @@ namespace llvm {
virtual void EmitCompactUnwindEncoding(uint32_t CompactUnwindEncoding);
virtual void EmitCFISections(bool EH, bool Debug);
void EmitCFIStartProc();
virtual void EmitCFIEndProc();
void EmitCFIEndProc();
virtual void EmitCFIDefCfa(int64_t Register, int64_t Offset);
virtual void EmitCFIDefCfaOffset(int64_t Offset);
virtual void EmitCFIDefCfaRegister(int64_t Register);

View File

@ -62,6 +62,7 @@ private:
void EmitRegisterName(int64_t Register);
virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame);
virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame);
public:
MCAsmStreamer(MCContext &Context, formatted_raw_ostream &os,
@ -210,7 +211,6 @@ public:
StringRef FileName);
virtual void EmitCFISections(bool EH, bool Debug);
virtual void EmitCFIEndProc();
virtual void EmitCFIDefCfa(int64_t Register, int64_t Offset);
virtual void EmitCFIDefCfaOffset(int64_t Offset);
virtual void EmitCFIDefCfaRegister(int64_t Register);
@ -851,11 +851,15 @@ void MCAsmStreamer::EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame) {
EmitEOL();
}
void MCAsmStreamer::EmitCFIEndProc() {
MCStreamer::EmitCFIEndProc();
if (!UseCFI)
void MCAsmStreamer::EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame) {
if (!UseCFI) {
RecordProcEnd(Frame);
return;
}
// Put a dummy non-null value in Frame.End to mark that this frame has been
// closed.
Frame.End = (MCSymbol *) 1;
OS << "\t.cfi_endproc";
EmitEOL();

View File

@ -109,6 +109,10 @@ void MCObjectStreamer::EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame) {
RecordProcStart(Frame);
}
void MCObjectStreamer::EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame) {
RecordProcEnd(Frame);
}
void MCObjectStreamer::EmitLabel(MCSymbol *Symbol) {
MCStreamer::EmitLabel(Symbol);

View File

@ -301,8 +301,15 @@ void MCStreamer::RecordProcStart(MCDwarfFrameInfo &Frame) {
void MCStreamer::EmitCFIEndProc() {
EnsureValidFrame();
MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo();
CurFrame->End = getContext().CreateTempSymbol();
EmitLabel(CurFrame->End);
EmitCFIEndProcImpl(*CurFrame);
}
void MCStreamer::EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame) {
}
void MCStreamer::RecordProcEnd(MCDwarfFrameInfo &Frame) {
Frame.End = getContext().CreateTempSymbol();
EmitLabel(Frame.End);
}
void MCStreamer::EmitCFIDefCfa(int64_t Register, int64_t Offset) {

View File

@ -6,9 +6,9 @@ target triple = "thumbv7-apple-macosx10.6.7"
;CHECK: Ldebug_loc0:
;CHECK-NEXT: .long Ltmp0
;CHECK-NEXT: .long Ltmp1
;CHECK-NEXT: Lset[[N:[0-9]+]] = Ltmp9-Ltmp8 @ Loc expr size
;CHECK-NEXT: Lset[[N:[0-9]+]] = Ltmp8-Ltmp7 @ Loc expr size
;CHECK-NEXT: .short Lset[[N]]
;CHECK-NEXT: Ltmp8:
;CHECK-NEXT: Ltmp7:
;CHECK-NEXT: .byte 144 @ DW_OP_regx for S register
define void @_Z3foov() optsize ssp {

View File

@ -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: Ltmp6
;CHECK-NEXT: Ltmp5
;CHECK-NEXT: .quad 0
;CHECK-NEXT: .quad 0

View File

@ -8,7 +8,6 @@ entry:
; CHECK-NO-FP: _func:
; CHECK-NO-FP-NEXT: .cfi_startproc
; CHECK-NO-FP: nop
; CHECK-NO-FP-NEXT: :
; CHECK-NO-FP-NEXT: .cfi_endproc
; CHECK-FP: _func:
@ -23,5 +22,4 @@ entry:
; CHECK-FP-NEXT: :
; CHECK-FP-NEXT: .cfi_def_cfa_register %rbp
; CHECK-FP-NEXT: nop
; CHECK-FP-NEXT: :
; CHECK-FP-NEXT: .cfi_endproc