[llvm-commits] [llvm] r170279 - in /llvm/trunk: include/llvm/MC/ lib/CodeGen/AsmPrinter/ lib/MC/ lib/Target/Mips/MCTargetDesc/ test/CodeGen/Mips/ tools/lto/
NAKAMURA Takumi
geek4civic at gmail.com
Sat Dec 15 21:04:56 PST 2012
AFAIU, it would be specific on asmstreamer for mips16 as. I didn't
understand why you made each EmitDebugLabel() defined in each
subclass. Would it be sufficient to define default action of
EmitDebugLabel() in MCStreamer as alias of EmitLabel()?
...Takumi
2012/12/16 Reed Kotler <rkotler at mips.com>:
> Author: rkotler
> Date: Sat Dec 15 22:00:45 2012
> New Revision: 170279
>
> URL: http://llvm.org/viewvc/llvm-project?rev=170279&view=rev
> Log:
> This patch is needed to make c++ exceptions work for mips16.
>
> Mips16 is really a processor decoding mode (ala thumb 1) and in the same
> program, mips16 and mips32 functions can exist and can call each other.
>
> If a jal type instruction encounters an address with the lower bit set, then
> the processor switches to mips16 mode (if it is not already in it). If the
> lower bit is not set, then it switches to mips32 mode.
>
> The linker knows which functions are mips16 and which are mips32.
> When relocation is performed on code labels, this lower order bit is
> set if the code label is a mips16 code label.
>
> In general this works just fine, however when creating exception handling
> tables and dwarf, there are cases where you don't want this lower order
> bit added in.
>
> This has been traditionally distinguished in gas assembly source by using a
> different syntax for the label.
>
> lab1: ; this will cause the lower order bit to be added
> lab2=. ; this will not cause the lower order bit to be added
>
> In some cases, it does not matter because in dwarf and debug tables
> the difference of two labels is used and in that case the lower order
> bits subtract each other out.
>
> To fix this, I have added to mcstreamer the notion of a debuglabel.
> The default is for label and debug label to be the same. So calling
> EmitLabel and EmitDebugLabel produce the same result.
>
> For various reasons, there is only one set of labels that needs to be
> modified for the mips exceptions to work. These are the "$eh_func_beginXXX"
> labels.
>
> Mips overrides the debug label suffix from ":" to "=." .
>
> This initial patch fixes exceptions. More changes most likely
> will be needed to DwarfCFException to make all of this work
> for actual debugging. These changes will be to emit debug labels in some
> places where a simple label is emitted now.
>
> Some historical discussion on this from gcc can be found at:
> http://gcc.gnu.org/ml/gcc-patches/2008-08/msg00623.html
> http://gcc.gnu.org/ml/gcc-patches/2008-11/msg01273.html
>
>
> Added:
> llvm/trunk/test/CodeGen/Mips/mips16ex.ll
> Modified:
> llvm/trunk/include/llvm/MC/MCAsmInfo.h
> llvm/trunk/include/llvm/MC/MCELFStreamer.h
> llvm/trunk/include/llvm/MC/MCObjectStreamer.h
> llvm/trunk/include/llvm/MC/MCStreamer.h
> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
> llvm/trunk/lib/MC/MCAsmInfo.cpp
> llvm/trunk/lib/MC/MCAsmStreamer.cpp
> llvm/trunk/lib/MC/MCELFStreamer.cpp
> llvm/trunk/lib/MC/MCMachOStreamer.cpp
> llvm/trunk/lib/MC/MCNullStreamer.cpp
> llvm/trunk/lib/MC/MCObjectStreamer.cpp
> llvm/trunk/lib/MC/MCPureStreamer.cpp
> llvm/trunk/lib/MC/MCStreamer.cpp
> llvm/trunk/lib/MC/WinCOFFStreamer.cpp
> llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp
> llvm/trunk/tools/lto/LTOModule.cpp
>
> Modified: llvm/trunk/include/llvm/MC/MCAsmInfo.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmInfo.h?rev=170279&r1=170278&r2=170279&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/MC/MCAsmInfo.h (original)
> +++ llvm/trunk/include/llvm/MC/MCAsmInfo.h Sat Dec 15 22:00:45 2012
> @@ -102,6 +102,9 @@
> /// LabelSuffix - This is appended to emitted labels.
> const char *LabelSuffix; // Defaults to ":"
>
> + /// LabelSuffix - This is appended to emitted labels.
> + const char *DebugLabelSuffix; // Defaults to ":"
> +
> /// GlobalPrefix - If this is set to a non-empty string, it is prepended
> /// onto all global symbols. This is often used for "_" or ".".
> const char *GlobalPrefix; // Defaults to ""
> @@ -426,6 +429,11 @@
> const char *getLabelSuffix() const {
> return LabelSuffix;
> }
> +
> + const char *getDebugLabelSuffix() const {
> + return DebugLabelSuffix;
> + }
> +
> const char *getGlobalPrefix() const {
> return GlobalPrefix;
> }
>
> Modified: llvm/trunk/include/llvm/MC/MCELFStreamer.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCELFStreamer.h?rev=170279&r1=170278&r2=170279&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/MC/MCELFStreamer.h (original)
> +++ llvm/trunk/include/llvm/MC/MCELFStreamer.h Sat Dec 15 22:00:45 2012
> @@ -47,6 +47,7 @@
> virtual void InitSections();
> virtual void ChangeSection(const MCSection *Section);
> virtual void EmitLabel(MCSymbol *Symbol);
> + virtual void EmitDebugLabel(MCSymbol *Symbol);
> virtual void EmitAssemblerFlag(MCAssemblerFlag Flag);
> virtual void EmitThumbFunc(MCSymbol *Func);
> virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol);
>
> Modified: llvm/trunk/include/llvm/MC/MCObjectStreamer.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCObjectStreamer.h?rev=170279&r1=170278&r2=170279&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/MC/MCObjectStreamer.h (original)
> +++ llvm/trunk/include/llvm/MC/MCObjectStreamer.h Sat Dec 15 22:00:45 2012
> @@ -69,6 +69,7 @@
> /// @{
>
> virtual void EmitLabel(MCSymbol *Symbol);
> + virtual void EmitDebugLabel(MCSymbol *Symbol);
> virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value);
> virtual void EmitValueImpl(const MCExpr *Value, unsigned Size,
> unsigned AddrSpace);
>
> Modified: llvm/trunk/include/llvm/MC/MCStreamer.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=170279&r1=170278&r2=170279&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/MC/MCStreamer.h (original)
> +++ llvm/trunk/include/llvm/MC/MCStreamer.h Sat Dec 15 22:00:45 2012
> @@ -244,6 +244,8 @@
> /// used in an assignment.
> virtual void EmitLabel(MCSymbol *Symbol);
>
> + virtual void EmitDebugLabel(MCSymbol *Symbol);
> +
> virtual void EmitEHSymAttributes(const MCSymbol *Symbol,
> MCSymbol *EHSymbol);
>
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp?rev=170279&r1=170278&r2=170279&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp Sat Dec 15 22:00:45 2012
> @@ -122,8 +122,9 @@
> const MCSymbol *Sym = TLOF.getCFIPersonalitySymbol(Per, Asm->Mang, MMI);
> Asm->OutStreamer.EmitCFIPersonality(Sym, PerEncoding);
>
> - Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_begin",
> - Asm->getFunctionNumber()));
> + Asm->OutStreamer.EmitDebugLabel
> + (Asm->GetTempSymbol("eh_func_begin",
> + Asm->getFunctionNumber()));
>
> // Provide LSDA information.
> if (!shouldEmitLSDA)
>
> Modified: llvm/trunk/lib/MC/MCAsmInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfo.cpp?rev=170279&r1=170278&r2=170279&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCAsmInfo.cpp (original)
> +++ llvm/trunk/lib/MC/MCAsmInfo.cpp Sat Dec 15 22:00:45 2012
> @@ -37,6 +37,7 @@
> CommentColumn = 40;
> CommentString = "#";
> LabelSuffix = ":";
> + DebugLabelSuffix = ":";
> GlobalPrefix = "";
> PrivateGlobalPrefix = ".";
> LinkerPrivateGlobalPrefix = "";
>
> Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=170279&r1=170278&r2=170279&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)
> +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Sat Dec 15 22:00:45 2012
> @@ -135,6 +135,8 @@
> }
>
> virtual void EmitLabel(MCSymbol *Symbol);
> + virtual void EmitDebugLabel(MCSymbol *Symbol);
> +
> virtual void EmitEHSymAttributes(const MCSymbol *Symbol,
> MCSymbol *EHSymbol);
> virtual void EmitAssemblerFlag(MCAssemblerFlag Flag);
> @@ -345,6 +347,14 @@
> EmitEOL();
> }
>
> +void MCAsmStreamer::EmitDebugLabel(MCSymbol *Symbol) {
> + assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
> + MCStreamer::EmitDebugLabel(Symbol);
> +
> + OS << *Symbol << MAI.getDebugLabelSuffix();
> + EmitEOL();
> +}
> +
> void MCAsmStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
> switch (Flag) {
> case MCAF_SyntaxUnified: OS << "\t.syntax unified"; break;
>
> Modified: llvm/trunk/lib/MC/MCELFStreamer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCELFStreamer.cpp?rev=170279&r1=170278&r2=170279&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCELFStreamer.cpp (original)
> +++ llvm/trunk/lib/MC/MCELFStreamer.cpp Sat Dec 15 22:00:45 2012
> @@ -86,6 +86,10 @@
> MCELF::SetType(SD, ELF::STT_TLS);
> }
>
> +void MCELFStreamer::EmitDebugLabel(MCSymbol *Symbol) {
> + EmitLabel(Symbol);
> +}
> +
> void MCELFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
> switch (Flag) {
> case MCAF_SyntaxUnified: return; // no-op here.
>
> Modified: llvm/trunk/lib/MC/MCMachOStreamer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCMachOStreamer.cpp?rev=170279&r1=170278&r2=170279&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCMachOStreamer.cpp (original)
> +++ llvm/trunk/lib/MC/MCMachOStreamer.cpp Sat Dec 15 22:00:45 2012
> @@ -43,6 +43,7 @@
>
> virtual void InitSections();
> virtual void EmitLabel(MCSymbol *Symbol);
> + virtual void EmitDebugLabel(MCSymbol *Symbol);
> virtual void EmitEHSymAttributes(const MCSymbol *Symbol,
> MCSymbol *EHSymbol);
> virtual void EmitAssemblerFlag(MCAssemblerFlag Flag);
> @@ -130,6 +131,9 @@
> SD.setFlags(SD.getFlags() & ~SF_ReferenceTypeMask);
> }
>
> +void MCMachOStreamer::EmitDebugLabel(MCSymbol *Symbol) {
> + EmitLabel(Symbol);
> +}
> void MCMachOStreamer::EmitDataRegion(DataRegionData::KindTy Kind) {
> if (!getAssembler().getBackend().hasDataInCodeSupport())
> return;
>
> Modified: llvm/trunk/lib/MC/MCNullStreamer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCNullStreamer.cpp?rev=170279&r1=170278&r2=170279&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCNullStreamer.cpp (original)
> +++ llvm/trunk/lib/MC/MCNullStreamer.cpp Sat Dec 15 22:00:45 2012
> @@ -35,7 +35,9 @@
> assert(getCurrentSection() && "Cannot emit before setting section!");
> Symbol->setSection(*getCurrentSection());
> }
> -
> + virtual void EmitDebugLabel(MCSymbol *Symbol) {
> + EmitLabel(Symbol);
> + }
> virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) {}
> virtual void EmitThumbFunc(MCSymbol *Func) {}
>
>
> Modified: llvm/trunk/lib/MC/MCObjectStreamer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectStreamer.cpp?rev=170279&r1=170278&r2=170279&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCObjectStreamer.cpp (original)
> +++ llvm/trunk/lib/MC/MCObjectStreamer.cpp Sat Dec 15 22:00:45 2012
> @@ -134,6 +134,10 @@
> SD.setOffset(F->getContents().size());
> }
>
> +void MCObjectStreamer::EmitDebugLabel(MCSymbol *Symbol) {
> + EmitLabel(Symbol);
> +}
> +
> void MCObjectStreamer::EmitULEB128Value(const MCExpr *Value) {
> int64_t IntValue;
> if (Value->EvaluateAsAbsolute(IntValue, getAssembler())) {
>
> Modified: llvm/trunk/lib/MC/MCPureStreamer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCPureStreamer.cpp?rev=170279&r1=170278&r2=170279&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCPureStreamer.cpp (original)
> +++ llvm/trunk/lib/MC/MCPureStreamer.cpp Sat Dec 15 22:00:45 2012
> @@ -37,6 +37,7 @@
>
> virtual void InitSections();
> virtual void EmitLabel(MCSymbol *Symbol);
> + virtual void EmitDebugLabel(MCSymbol *Symbol);
> virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
> uint64_t Size = 0, unsigned ByteAlignment = 0);
> virtual void EmitBytes(StringRef Data, unsigned AddrSpace);
> @@ -134,6 +135,7 @@
> SD.setOffset(F->getContents().size());
> }
>
> +
> void MCPureStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
> uint64_t Size, unsigned ByteAlignment) {
> report_fatal_error("not yet implemented in pure streamer");
>
> Modified: llvm/trunk/lib/MC/MCStreamer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCStreamer.cpp?rev=170279&r1=170278&r2=170279&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCStreamer.cpp (original)
> +++ llvm/trunk/lib/MC/MCStreamer.cpp Sat Dec 15 22:00:45 2012
> @@ -195,6 +195,13 @@
> LastSymbol = Symbol;
> }
>
> +void MCStreamer::EmitDebugLabel(MCSymbol *Symbol) {
> + assert(!Symbol->isVariable() && "Cannot emit a variable symbol!");
> + assert(getCurrentSection() && "Cannot emit before setting section!");
> + Symbol->setSection(*getCurrentSection());
> + LastSymbol = Symbol;
> +}
> +
> void MCStreamer::EmitCompactUnwindEncoding(uint32_t CompactUnwindEncoding) {
> EnsureValidFrame();
> MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo();
>
> Modified: llvm/trunk/lib/MC/WinCOFFStreamer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFStreamer.cpp?rev=170279&r1=170278&r2=170279&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/WinCOFFStreamer.cpp (original)
> +++ llvm/trunk/lib/MC/WinCOFFStreamer.cpp Sat Dec 15 22:00:45 2012
> @@ -51,6 +51,7 @@
>
> virtual void InitSections();
> virtual void EmitLabel(MCSymbol *Symbol);
> + virtual void EmitDebugLabel(MCSymbol *Symbol);
> virtual void EmitAssemblerFlag(MCAssemblerFlag Flag);
> virtual void EmitThumbFunc(MCSymbol *Func);
> virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value);
> @@ -176,6 +177,9 @@
> MCObjectStreamer::EmitLabel(Symbol);
> }
>
> +void WinCOFFStreamer::EmitDebugLabel(MCSymbol *Symbol) {
> + EmitLabel(Symbol);
> +}
> void WinCOFFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
> llvm_unreachable("not implemented");
> }
>
> Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp?rev=170279&r1=170278&r2=170279&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp (original)
> +++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp Sat Dec 15 22:00:45 2012
> @@ -34,7 +34,7 @@
> GPRel32Directive = "\t.gpword\t";
> GPRel64Directive = "\t.gpdword\t";
> WeakRefDirective = "\t.weak\t";
> -
> + DebugLabelSuffix = "=.";
> SupportsDebugInformation = true;
> ExceptionsType = ExceptionHandling::DwarfCFI;
> HasLEB128 = true;
>
> Added: llvm/trunk/test/CodeGen/Mips/mips16ex.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/mips16ex.ll?rev=170279&view=auto
> ==============================================================================
> --- llvm/trunk/test/CodeGen/Mips/mips16ex.ll (added)
> +++ llvm/trunk/test/CodeGen/Mips/mips16ex.ll Sat Dec 15 22:00:45 2012
> @@ -0,0 +1,87 @@
> +; RUN: llc -march=mipsel -mcpu=mips16 -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=16
> +
> +;16: $eh_func_begin0=.
> + at .str = private unnamed_addr constant [7 x i8] c"hello\0A\00", align 1
> + at _ZTIi = external constant i8*
> + at .str1 = private unnamed_addr constant [15 x i8] c"exception %i \0A\00", align 1
> +
> +define i32 @main() {
> +entry:
> + %retval = alloca i32, align 4
> + %exn.slot = alloca i8*
> + %ehselector.slot = alloca i32
> + %e = alloca i32, align 4
> + store i32 0, i32* %retval
> + %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([7 x i8]* @.str, i32 0, i32 0))
> + %exception = call i8* @__cxa_allocate_exception(i32 4) nounwind
> + %0 = bitcast i8* %exception to i32*
> + store i32 20, i32* %0
> + invoke void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null) noreturn
> + to label %unreachable unwind label %lpad
> +
> +lpad: ; preds = %entry
> + %1 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
> + catch i8* bitcast (i8** @_ZTIi to i8*)
> + %2 = extractvalue { i8*, i32 } %1, 0
> + store i8* %2, i8** %exn.slot
> + %3 = extractvalue { i8*, i32 } %1, 1
> + store i32 %3, i32* %ehselector.slot
> + br label %catch.dispatch
> +
> +catch.dispatch: ; preds = %lpad
> + %sel = load i32* %ehselector.slot
> + %4 = call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*)) nounwind
> + %matches = icmp eq i32 %sel, %4
> + br i1 %matches, label %catch, label %eh.resume
> +
> +catch: ; preds = %catch.dispatch
> + %exn = load i8** %exn.slot
> + %5 = call i8* @__cxa_begin_catch(i8* %exn) nounwind
> + %6 = bitcast i8* %5 to i32*
> + %exn.scalar = load i32* %6
> + store i32 %exn.scalar, i32* %e, align 4
> + %7 = load i32* %e, align 4
> + %call2 = invoke i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str1, i32 0, i32 0), i32 %7)
> + to label %invoke.cont unwind label %lpad1
> +
> +invoke.cont: ; preds = %catch
> + call void @__cxa_end_catch() nounwind
> + br label %try.cont
> +
> +try.cont: ; preds = %invoke.cont
> + ret i32 0
> +
> +lpad1: ; preds = %catch
> + %8 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
> + cleanup
> + %9 = extractvalue { i8*, i32 } %8, 0
> + store i8* %9, i8** %exn.slot
> + %10 = extractvalue { i8*, i32 } %8, 1
> + store i32 %10, i32* %ehselector.slot
> + call void @__cxa_end_catch() nounwind
> + br label %eh.resume
> +
> +eh.resume: ; preds = %lpad1, %catch.dispatch
> + %exn3 = load i8** %exn.slot
> + %sel4 = load i32* %ehselector.slot
> + %lpad.val = insertvalue { i8*, i32 } undef, i8* %exn3, 0
> + %lpad.val5 = insertvalue { i8*, i32 } %lpad.val, i32 %sel4, 1
> + resume { i8*, i32 } %lpad.val5
> +
> +unreachable: ; preds = %entry
> + unreachable
> +}
> +
> +declare i32 @printf(i8*, ...)
> +
> +declare i8* @__cxa_allocate_exception(i32)
> +
> +declare i32 @__gxx_personality_v0(...)
> +
> +declare void @__cxa_throw(i8*, i8*, i8*)
> +
> +declare i32 @llvm.eh.typeid.for(i8*) nounwind readnone
> +
> +declare i8* @__cxa_begin_catch(i8*)
> +
> +declare void @__cxa_end_catch()
>
> Modified: llvm/trunk/tools/lto/LTOModule.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOModule.cpp?rev=170279&r1=170278&r2=170279&view=diff
> ==============================================================================
> --- llvm/trunk/tools/lto/LTOModule.cpp (original)
> +++ llvm/trunk/tools/lto/LTOModule.cpp Sat Dec 15 22:00:45 2012
> @@ -745,6 +745,9 @@
> Symbol->setSection(*getCurrentSection());
> markDefined(*Symbol);
> }
> + virtual void EmitDebugLabel(MCSymbol *Symbol) {
> + EmitLabel(Symbol);
> + }
> virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
> // FIXME: should we handle aliases?
> markDefined(*Symbol);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
commit a2ef12c19540ed7702a4d28664c7149f944364f3 (HEAD, emitdebugsymbol)
Author: NAKAMURA Takumi <geek4civic at gmail.com>
Date: Sun Dec 16 13:38:32 2012
MC: EmitDebugLabel() may behave like EmitLabel() by default in most case, except for asmstreamer.
diff --git a/llvm/include/llvm/MC/MCELFStreamer.h b/llvm/include/llvm/MC/MCELFStreamer.h
index 03a57c7..3b0152b 100644
--- a/llvm/include/llvm/MC/MCELFStreamer.h
+++ b/llvm/include/llvm/MC/MCELFStreamer.h
@@ -47,7 +47,6 @@ public:
virtual void InitSections();
virtual void ChangeSection(const MCSection *Section);
virtual void EmitLabel(MCSymbol *Symbol);
- virtual void EmitDebugLabel(MCSymbol *Symbol);
virtual void EmitAssemblerFlag(MCAssemblerFlag Flag);
virtual void EmitThumbFunc(MCSymbol *Func);
virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol);
diff --git a/llvm/include/llvm/MC/MCObjectStreamer.h b/llvm/include/llvm/MC/MCObjectStreamer.h
index df98fea..843304b 100644
--- a/llvm/include/llvm/MC/MCObjectStreamer.h
+++ b/llvm/include/llvm/MC/MCObjectStreamer.h
@@ -69,7 +69,6 @@ public:
/// @{
virtual void EmitLabel(MCSymbol *Symbol);
- virtual void EmitDebugLabel(MCSymbol *Symbol);
virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value);
virtual void EmitValueImpl(const MCExpr *Value, unsigned Size,
unsigned AddrSpace);
diff --git a/llvm/lib/MC/MCELFStreamer.cpp b/llvm/lib/MC/MCELFStreamer.cpp
index 9771ef0..8b9bdb1 100644
--- a/llvm/lib/MC/MCELFStreamer.cpp
+++ b/llvm/lib/MC/MCELFStreamer.cpp
@@ -86,10 +86,6 @@ void MCELFStreamer::EmitLabel(MCSymbol *Symbol) {
MCELF::SetType(SD, ELF::STT_TLS);
}
-void MCELFStreamer::EmitDebugLabel(MCSymbol *Symbol) {
- EmitLabel(Symbol);
-}
-
void MCELFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
switch (Flag) {
case MCAF_SyntaxUnified: return; // no-op here.
diff --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp
index 82ccdd4..f279e74 100644
--- a/llvm/lib/MC/MCMachOStreamer.cpp
+++ b/llvm/lib/MC/MCMachOStreamer.cpp
@@ -43,7 +43,6 @@ public:
virtual void InitSections();
virtual void EmitLabel(MCSymbol *Symbol);
- virtual void EmitDebugLabel(MCSymbol *Symbol);
virtual void EmitEHSymAttributes(const MCSymbol *Symbol,
MCSymbol *EHSymbol);
virtual void EmitAssemblerFlag(MCAssemblerFlag Flag);
@@ -131,9 +130,6 @@ void MCMachOStreamer::EmitLabel(MCSymbol *Symbol) {
SD.setFlags(SD.getFlags() & ~SF_ReferenceTypeMask);
}
-void MCMachOStreamer::EmitDebugLabel(MCSymbol *Symbol) {
- EmitLabel(Symbol);
-}
void MCMachOStreamer::EmitDataRegion(DataRegionData::KindTy Kind) {
if (!getAssembler().getBackend().hasDataInCodeSupport())
return;
diff --git a/llvm/lib/MC/MCNullStreamer.cpp b/llvm/lib/MC/MCNullStreamer.cpp
index bb84c4f..f5ece10 100644
--- a/llvm/lib/MC/MCNullStreamer.cpp
+++ b/llvm/lib/MC/MCNullStreamer.cpp
@@ -35,9 +35,7 @@ namespace {
assert(getCurrentSection() && "Cannot emit before setting section!");
Symbol->setSection(*getCurrentSection());
}
- virtual void EmitDebugLabel(MCSymbol *Symbol) {
- EmitLabel(Symbol);
- }
+
virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) {}
virtual void EmitThumbFunc(MCSymbol *Func) {}
diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp
index 4d6900f..c69d764 100644
--- a/llvm/lib/MC/MCObjectStreamer.cpp
+++ b/llvm/lib/MC/MCObjectStreamer.cpp
@@ -134,10 +134,6 @@ void MCObjectStreamer::EmitLabel(MCSymbol *Symbol) {
SD.setOffset(F->getContents().size());
}
-void MCObjectStreamer::EmitDebugLabel(MCSymbol *Symbol) {
- EmitLabel(Symbol);
-}
-
void MCObjectStreamer::EmitULEB128Value(const MCExpr *Value) {
int64_t IntValue;
if (Value->EvaluateAsAbsolute(IntValue, getAssembler())) {
diff --git a/llvm/lib/MC/MCPureStreamer.cpp b/llvm/lib/MC/MCPureStreamer.cpp
index 5529759..1563bdd 100644
--- a/llvm/lib/MC/MCPureStreamer.cpp
+++ b/llvm/lib/MC/MCPureStreamer.cpp
@@ -134,7 +134,6 @@ void MCPureStreamer::EmitLabel(MCSymbol *Symbol) {
SD.setOffset(F->getContents().size());
}
-
void MCPureStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment) {
report_fatal_error("not yet implemented in pure streamer");
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp
index 6f0ada2..656f8cf 100644
--- a/llvm/lib/MC/MCStreamer.cpp
+++ b/llvm/lib/MC/MCStreamer.cpp
@@ -196,10 +196,7 @@ void MCStreamer::EmitLabel(MCSymbol *Symbol) {
}
void MCStreamer::EmitDebugLabel(MCSymbol *Symbol) {
- assert(!Symbol->isVariable() && "Cannot emit a variable symbol!");
- assert(getCurrentSection() && "Cannot emit before setting section!");
- Symbol->setSection(*getCurrentSection());
- LastSymbol = Symbol;
+ EmitLabel(Symbol);
}
void MCStreamer::EmitCompactUnwindEncoding(uint32_t CompactUnwindEncoding) {
diff --git a/llvm/lib/MC/WinCOFFStreamer.cpp b/llvm/lib/MC/WinCOFFStreamer.cpp
index d12201a..359b388 100644
--- a/llvm/lib/MC/WinCOFFStreamer.cpp
+++ b/llvm/lib/MC/WinCOFFStreamer.cpp
@@ -51,7 +51,6 @@ public:
virtual void InitSections();
virtual void EmitLabel(MCSymbol *Symbol);
- virtual void EmitDebugLabel(MCSymbol *Symbol);
virtual void EmitAssemblerFlag(MCAssemblerFlag Flag);
virtual void EmitThumbFunc(MCSymbol *Func);
virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value);
@@ -177,9 +176,6 @@ void WinCOFFStreamer::EmitLabel(MCSymbol *Symbol) {
MCObjectStreamer::EmitLabel(Symbol);
}
-void WinCOFFStreamer::EmitDebugLabel(MCSymbol *Symbol) {
- EmitLabel(Symbol);
-}
void WinCOFFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
llvm_unreachable("not implemented");
}
diff --git a/llvm/tools/lto/LTOModule.cpp b/llvm/tools/lto/LTOModule.cpp
index 9d2f9c7..a0533db 100644
--- a/llvm/tools/lto/LTOModule.cpp
+++ b/llvm/tools/lto/LTOModule.cpp
@@ -745,9 +745,6 @@ namespace {
Symbol->setSection(*getCurrentSection());
markDefined(*Symbol);
}
- virtual void EmitDebugLabel(MCSymbol *Symbol) {
- EmitLabel(Symbol);
- }
virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
// FIXME: should we handle aliases?
markDefined(*Symbol);
More information about the llvm-commits
mailing list