From 5399d2502acaf96fe8420e61913e77f0b23650ff Mon Sep 17 00:00:00 2001 From: Pedro Artigas Date: Wed, 12 Dec 2012 22:59:46 +0000 Subject: Make the MCStreamer have a reset method and call that after finalization of the asm printer, also changed MCContext to a single reset only method for simplicity as requested on the list git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170041 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCStreamer.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/MC/MCStreamer.cpp') diff --git a/lib/MC/MCStreamer.cpp b/lib/MC/MCStreamer.cpp index 96d6d691d2..047ab636ab 100644 --- a/lib/MC/MCStreamer.cpp +++ b/lib/MC/MCStreamer.cpp @@ -34,6 +34,19 @@ MCStreamer::~MCStreamer() { delete W64UnwindInfos[i]; } +void MCStreamer::reset() { + for (unsigned i = 0; i < getNumW64UnwindInfos(); ++i) + delete W64UnwindInfos[i]; + EmitEHFrame = true; + EmitDebugFrame = false; + CurrentW64UnwindInfo = 0; + LastSymbol = 0; + AutoInitSections = false; + const MCSection *section = NULL; + SectionStack.clear(); + SectionStack.push_back(std::make_pair(section, section)); +} + const MCExpr *MCStreamer::BuildSymbolDiff(MCContext &Context, const MCSymbol *A, const MCSymbol *B) { -- cgit v1.2.3-18-g5258 From 2c3a4641a7785da78839caf574277df9cd93b52c Mon Sep 17 00:00:00 2001 From: Reed Kotler Date: Sun, 16 Dec 2012 04:00:45 +0000 Subject: 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170279 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCStreamer.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/MC/MCStreamer.cpp') diff --git a/lib/MC/MCStreamer.cpp b/lib/MC/MCStreamer.cpp index 047ab636ab..6f0ada277c 100644 --- a/lib/MC/MCStreamer.cpp +++ b/lib/MC/MCStreamer.cpp @@ -195,6 +195,13 @@ void MCStreamer::EmitLabel(MCSymbol *Symbol) { 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(); -- cgit v1.2.3-18-g5258 From b9d1005e96681b5c8cc1ed959fa129de62933020 Mon Sep 17 00:00:00 2001 From: Pedro Artigas Date: Fri, 4 Jan 2013 18:04:42 +0000 Subject: small fixes to enable the reuse of the pass manager across multiple modules git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171475 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCStreamer.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/MC/MCStreamer.cpp') diff --git a/lib/MC/MCStreamer.cpp b/lib/MC/MCStreamer.cpp index 6f0ada277c..7dffc3e21b 100644 --- a/lib/MC/MCStreamer.cpp +++ b/lib/MC/MCStreamer.cpp @@ -41,7 +41,6 @@ void MCStreamer::reset() { EmitDebugFrame = false; CurrentW64UnwindInfo = 0; LastSymbol = 0; - AutoInitSections = false; const MCSection *section = NULL; SectionStack.clear(); SectionStack.push_back(std::make_pair(section, section)); -- cgit v1.2.3-18-g5258 From 1ced208be9cab0f994c5df9000da36bc313b2507 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Wed, 9 Jan 2013 03:52:05 +0000 Subject: Last in the series of removing unnecessary '0' arguments for address space. Reordered the EmitULEB128IntValue arguments to make this easier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171949 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCStreamer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/MC/MCStreamer.cpp') diff --git a/lib/MC/MCStreamer.cpp b/lib/MC/MCStreamer.cpp index 7dffc3e21b..00ebde3c40 100644 --- a/lib/MC/MCStreamer.cpp +++ b/lib/MC/MCStreamer.cpp @@ -104,8 +104,8 @@ void MCStreamer::EmitIntValue(uint64_t Value, unsigned Size, /// EmitULEB128Value - Special case of EmitULEB128Value that avoids the /// client having to pass in a MCExpr for constant integers. -void MCStreamer::EmitULEB128IntValue(uint64_t Value, unsigned AddrSpace, - unsigned Padding) { +void MCStreamer::EmitULEB128IntValue(uint64_t Value, unsigned Padding, + unsigned AddrSpace) { SmallString<128> Tmp; raw_svector_ostream OSE(Tmp); encodeULEB128(Value, OSE, Padding); -- cgit v1.2.3-18-g5258 From 5da3665cc501ed8928e63678254357214ec0b9eb Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Thu, 31 Jan 2013 23:29:57 +0000 Subject: Give the MCStreamer class hierarchy LLVM RTTI facilities for use with isa<> and dyn_cast<>. In several places, code is already hacking around the absence of this, and there seem to be several interfaces that might be lifted and/or devirtualized using this. This change was based on a discussion with Jim Grosbach about how best to handle testing for specific MCStreamer subclasses. He said that this was the correct end state, and everything else was too hacky so I decided to just make it so. No functionality should be changed here, this is just threading the kind through all the constructors and setting up the classof overloads. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174113 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCStreamer.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lib/MC/MCStreamer.cpp') diff --git a/lib/MC/MCStreamer.cpp b/lib/MC/MCStreamer.cpp index 00ebde3c40..e92569b0cc 100644 --- a/lib/MC/MCStreamer.cpp +++ b/lib/MC/MCStreamer.cpp @@ -21,10 +21,9 @@ #include using namespace llvm; -MCStreamer::MCStreamer(MCContext &Ctx) - : Context(Ctx), EmitEHFrame(true), EmitDebugFrame(false), - CurrentW64UnwindInfo(0), LastSymbol(0), - AutoInitSections(false) { +MCStreamer::MCStreamer(StreamerKind Kind, MCContext &Ctx) + : Kind(Kind), Context(Ctx), EmitEHFrame(true), EmitDebugFrame(false), + CurrentW64UnwindInfo(0), LastSymbol(0), AutoInitSections(false) { const MCSection *section = NULL; SectionStack.push_back(std::make_pair(section, section)); } -- cgit v1.2.3-18-g5258 From dc08bfbd565ba6540be698bba551b2039661299d Mon Sep 17 00:00:00 2001 From: Jack Carter Date: Tue, 12 Feb 2013 21:29:39 +0000 Subject: This patch just fixes up various llvm formatting violations such as tabs, blanks at eol and long lines. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175007 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCStreamer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/MC/MCStreamer.cpp') diff --git a/lib/MC/MCStreamer.cpp b/lib/MC/MCStreamer.cpp index e92569b0cc..7d79d62830 100644 --- a/lib/MC/MCStreamer.cpp +++ b/lib/MC/MCStreamer.cpp @@ -42,7 +42,7 @@ void MCStreamer::reset() { LastSymbol = 0; const MCSection *section = NULL; SectionStack.clear(); - SectionStack.push_back(std::make_pair(section, section)); + SectionStack.push_back(std::make_pair(section, section)); } const MCExpr *MCStreamer::BuildSymbolDiff(MCContext &Context, @@ -104,7 +104,7 @@ void MCStreamer::EmitIntValue(uint64_t Value, unsigned Size, /// EmitULEB128Value - Special case of EmitULEB128Value that avoids the /// client having to pass in a MCExpr for constant integers. void MCStreamer::EmitULEB128IntValue(uint64_t Value, unsigned Padding, - unsigned AddrSpace) { + unsigned AddrSpace) { SmallString<128> Tmp; raw_svector_ostream OSE(Tmp); encodeULEB128(Value, OSE, Padding); -- cgit v1.2.3-18-g5258 From 77afbdce53aa740777486b0cc4e9df151ae65468 Mon Sep 17 00:00:00 2001 From: Jack Carter Date: Tue, 19 Feb 2013 21:57:35 +0000 Subject: ELF symbol table field st_other support, excluding visibility bits. Generic STO handling at the Target level. The st_other field of the ELF symbol table is one byte in size. The first 2 bytes are used for generic visibility and are currently handled by llvm. The other six bits are processor specific and need to be set at the target level. A couple of notes: The new static methods for accessing and setting the "other" flags in include/llvm/MC/MCELF.h match the style guide and not the other methods in the file. I don't like the inconsistency, but feel I should follow the prescribed lowerUpper() convention. STO_ value definitions are not specified in gnu land as consistently as the STT_ and STB_ fields. Probably because the latter were defined in a standards doc and the former defined partially in code. I have stuck with the full byte definition of the flags. Contributer: Zoran Jovanovic git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175561 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCStreamer.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/MC/MCStreamer.cpp') diff --git a/lib/MC/MCStreamer.cpp b/lib/MC/MCStreamer.cpp index 7d79d62830..9857f7bb08 100644 --- a/lib/MC/MCStreamer.cpp +++ b/lib/MC/MCStreamer.cpp @@ -620,3 +620,8 @@ void MCStreamer::Finish() { FinishImpl(); } + +MCSymbolData &MCStreamer::getOrCreateSymbolData(MCSymbol *Symbol) { + report_fatal_error("Not supported!"); + return *(static_cast (NULL)); +} -- cgit v1.2.3-18-g5258 From 3de61b4c0144748e4b9157e2c22fe4ea685981a2 Mon Sep 17 00:00:00 2001 From: Manman Ren Date: Thu, 7 Mar 2013 01:42:00 +0000 Subject: Debug Info: store the files and directories for each compile unit. We now emit a line table for each compile unit. To reduce the prologue size of each line table, the files and directories used by each compile unit are stored in std::map > instead of std::vector< >. The prologue for a lto'ed image can be as big as 93K. Duplicating 93K for each compile unit causes a huge increase of debug info. With this patch, each prologue will only emit the files required by the compile unit. rdar://problem/13342023 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176605 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCStreamer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/MC/MCStreamer.cpp') diff --git a/lib/MC/MCStreamer.cpp b/lib/MC/MCStreamer.cpp index 9857f7bb08..51ef415542 100644 --- a/lib/MC/MCStreamer.cpp +++ b/lib/MC/MCStreamer.cpp @@ -157,8 +157,8 @@ void MCStreamer::EmitFill(uint64_t NumBytes, uint8_t FillValue, bool MCStreamer::EmitDwarfFileDirective(unsigned FileNo, StringRef Directory, - StringRef Filename) { - return getContext().GetDwarfFile(Directory, Filename, FileNo) == 0; + StringRef Filename, unsigned CUID) { + return getContext().GetDwarfFile(Directory, Filename, FileNo, CUID) == 0; } void MCStreamer::EmitDwarfLocDirective(unsigned FileNo, unsigned Line, -- cgit v1.2.3-18-g5258