summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorUlrich Weigand <ulrich.weigand@de.ibm.com>2013-06-12 14:46:54 +0000
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2013-06-12 14:46:54 +0000
commitc1f4a4b2640dfc871bacacef53a95f1c96a9fe48 (patch)
tree84ce0cd217002b91b3517997bbd0c8030738f270 /include
parent55d529fd8a0931999d96829b0e9f0df55d43f85d (diff)
downloadllvm-c1f4a4b2640dfc871bacacef53a95f1c96a9fe48.tar.gz
llvm-c1f4a4b2640dfc871bacacef53a95f1c96a9fe48.tar.bz2
llvm-c1f4a4b2640dfc871bacacef53a95f1c96a9fe48.tar.xz
[MC/DWARF] Support .debug_frame / .debug_line code alignment factors
I've been comparing the object file output of LLVM's integrated assembler against the external assembler on PowerPC, and one area where differences still remain are in DWARF sections. In particular, the GNU assembler generates .debug_frame and .debug_line sections using a code alignment factor of 4, since all PowerPC instructions have size 4 and must be aligned to a multiple of 4. However, current MC code hard-codes a code alignment factor of 1. This patch changes this by adding a "minimum instruction alignment" data element to MCAsmInfo and using this as code alignment factor. This requires passing a MCContext into MCDwarfLineAddr::Encode and MCDwarfLineAddr::EncodeAdvanceLoc. Note that one caller, MCDwarfLineAddr::Write, didn't actually have that information available. However, it turns out that this routine is in fact never used in the whole code base, so the patch simply removes it. If it turns out to be needed again at a later time, it could be re-added with an updated interface. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183834 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/MC/MCAsmInfo.h7
-rw-r--r--include/llvm/MC/MCDwarf.h11
2 files changed, 11 insertions, 7 deletions
diff --git a/include/llvm/MC/MCAsmInfo.h b/include/llvm/MC/MCAsmInfo.h
index 72d325f79c..781a9d010b 100644
--- a/include/llvm/MC/MCAsmInfo.h
+++ b/include/llvm/MC/MCAsmInfo.h
@@ -89,6 +89,10 @@ namespace llvm {
/// which is needed to compute the size of an inline asm.
unsigned MaxInstLength; // Defaults to 4.
+ /// MinInstAlignment - Every possible instruction length is a multiple of
+ /// this value. Factored out in .debug_frame and .debug_line.
+ unsigned MinInstAlignment; // Defaults to 1.
+
/// PCSymbol - The symbol used to represent the current PC. Used in PC
/// relative expressions.
const char *PCSymbol; // Defaults to "$".
@@ -429,6 +433,9 @@ namespace llvm {
unsigned getMaxInstLength() const {
return MaxInstLength;
}
+ unsigned getMinInstAlignment() const {
+ return MinInstAlignment;
+ }
const char *getPCSymbol() const {
return PCSymbol;
}
diff --git a/include/llvm/MC/MCDwarf.h b/include/llvm/MC/MCDwarf.h
index 1a392e8755..3ece2626a0 100644
--- a/include/llvm/MC/MCDwarf.h
+++ b/include/llvm/MC/MCDwarf.h
@@ -24,7 +24,6 @@
namespace llvm {
class MCContext;
- class MCObjectWriter;
class MCSection;
class MCStreamer;
class MCSymbol;
@@ -229,15 +228,12 @@ namespace llvm {
class MCDwarfLineAddr {
public:
/// Utility function to encode a Dwarf pair of LineDelta and AddrDeltas.
- static void Encode(int64_t LineDelta, uint64_t AddrDelta, raw_ostream &OS);
+ static void Encode(MCContext &Context, int64_t LineDelta,
+ uint64_t AddrDelta, raw_ostream &OS);
/// Utility function to emit the encoding to a streamer.
static void Emit(MCStreamer *MCOS,
int64_t LineDelta,uint64_t AddrDelta);
-
- /// Utility function to write the encoding to an object writer.
- static void Write(MCObjectWriter *OW,
- int64_t LineDelta, uint64_t AddrDelta);
};
class MCGenDwarfInfo {
@@ -418,7 +414,8 @@ namespace llvm {
static void Emit(MCStreamer &streamer, bool usingCFI,
bool isEH);
static void EmitAdvanceLoc(MCStreamer &Streamer, uint64_t AddrDelta);
- static void EncodeAdvanceLoc(uint64_t AddrDelta, raw_ostream &OS);
+ static void EncodeAdvanceLoc(MCContext &Context, uint64_t AddrDelta,
+ raw_ostream &OS);
};
} // end namespace llvm