aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/MC/MCContext.h
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2010-08-24 20:32:42 +0000
committerKevin Enderby <enderby@apple.com>2010-08-24 20:32:42 +0000
commitc1840b3da25222680b51f853697a871fedda51d5 (patch)
tree3e8ead8c25c2fc13a34f9fea476aa8def72545cb /include/llvm/MC/MCContext.h
parenta15a1336478ffe16f3165c99e5c0e434eb6c53a2 (diff)
First bit of support for the dwarf .loc directive. This patch updates the
needed parsing for the .loc directive and saves the current info from that into the context. The next patch will take the current loc info after an instruction is assembled and save that info into a vector for each section for use to build the line number tables. The patch after that will encode the info from those vectors into the output file as the dwarf line tables. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111956 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/MC/MCContext.h')
-rw-r--r--include/llvm/MC/MCContext.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/llvm/MC/MCContext.h b/include/llvm/MC/MCContext.h
index 17e79fb1e9..6686950b72 100644
--- a/include/llvm/MC/MCContext.h
+++ b/include/llvm/MC/MCContext.h
@@ -11,6 +11,7 @@
#define LLVM_MC_MCCONTEXT_H
#include "llvm/MC/SectionKind.h"
+#include "llvm/MC/MCDwarf.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Support/Allocator.h"
@@ -24,6 +25,7 @@ namespace llvm {
class MCSymbol;
class MCLabel;
class MCDwarfFile;
+ class MCDwarfLoc;
class StringRef;
class Twine;
class MCSectionMachO;
@@ -69,6 +71,10 @@ namespace llvm {
std::vector<MCDwarfFile *> MCDwarfFiles;
std::vector<StringRef> MCDwarfDirs;
+ /// The current dwarf line information from the last dwarf .loc directive.
+ MCDwarfLoc CurrentDwarfLoc;
+ bool DwarfLocSeen;
+
/// Allocator - Allocator object used for creating machine code objects.
///
/// We use a bump pointer allocator to avoid the need to track all allocated
@@ -149,6 +155,8 @@ namespace llvm {
/// GetDwarfFile - creates an entry in the dwarf file and directory tables.
unsigned GetDwarfFile(StringRef FileName, unsigned FileNumber);
+ bool ValidateDwarfFileNumber(unsigned FileNumber);
+
const std::vector<MCDwarfFile *> &getMCDwarfFiles() {
return MCDwarfFiles;
}
@@ -156,6 +164,19 @@ namespace llvm {
return MCDwarfDirs;
}
+ /// setCurrentDwarfLoc - saves the information from the currently parsed
+ /// dwarf .loc directive and sets DwarfLocSeen. When the next instruction /// is assembled an entry in the line number table with this information and
+ /// the address of the instruction will be created.
+ void setCurrentDwarfLoc(unsigned FileNum, unsigned Line, unsigned Column,
+ unsigned Flags, unsigned Isa) {
+ CurrentDwarfLoc.setFileNum(FileNum);
+ CurrentDwarfLoc.setLine(Line);
+ CurrentDwarfLoc.setColumn(Column);
+ CurrentDwarfLoc.setFlags(Flags);
+ CurrentDwarfLoc.setIsa(Isa);
+ DwarfLocSeen = true;
+ }
+
/// @}
char *getSecureLogFile() { return SecureLogFile; }