mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-10-02 17:55:18 +00:00
Parsing and plumbing for .cfi_sections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131117 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
65a2f77b0e
commit
f9efd83166
@ -50,6 +50,9 @@ namespace llvm {
|
|||||||
MCStreamer(const MCStreamer&); // DO NOT IMPLEMENT
|
MCStreamer(const MCStreamer&); // DO NOT IMPLEMENT
|
||||||
MCStreamer &operator=(const MCStreamer&); // DO NOT IMPLEMENT
|
MCStreamer &operator=(const MCStreamer&); // DO NOT IMPLEMENT
|
||||||
|
|
||||||
|
bool EmitEHFrame;
|
||||||
|
bool EmitDebugFrame;
|
||||||
|
|
||||||
std::vector<MCDwarfFrameInfo> FrameInfos;
|
std::vector<MCDwarfFrameInfo> FrameInfos;
|
||||||
MCDwarfFrameInfo *getCurrentFrameInfo();
|
MCDwarfFrameInfo *getCurrentFrameInfo();
|
||||||
void EnsureValidFrame();
|
void EnsureValidFrame();
|
||||||
@ -436,6 +439,7 @@ namespace llvm {
|
|||||||
void EmitDwarfSetLineAddr(int64_t LineDelta, const MCSymbol *Label,
|
void EmitDwarfSetLineAddr(int64_t LineDelta, const MCSymbol *Label,
|
||||||
int PointerSize);
|
int PointerSize);
|
||||||
|
|
||||||
|
virtual void EmitCFISections(bool EH, bool Debug);
|
||||||
virtual void EmitCFIStartProc();
|
virtual void EmitCFIStartProc();
|
||||||
virtual void EmitCFIEndProc();
|
virtual void EmitCFIEndProc();
|
||||||
virtual void EmitCFIDefCfa(int64_t Register, int64_t Offset);
|
virtual void EmitCFIDefCfa(int64_t Register, int64_t Offset);
|
||||||
|
@ -243,6 +243,8 @@ public:
|
|||||||
AddDirectiveHandler<&GenericAsmParser::ParseDirectiveStabs>(".stabs");
|
AddDirectiveHandler<&GenericAsmParser::ParseDirectiveStabs>(".stabs");
|
||||||
|
|
||||||
// CFI directives.
|
// CFI directives.
|
||||||
|
AddDirectiveHandler<&GenericAsmParser::ParseDirectiveCFISections>(
|
||||||
|
".cfi_sections");
|
||||||
AddDirectiveHandler<&GenericAsmParser::ParseDirectiveCFIStartProc>(
|
AddDirectiveHandler<&GenericAsmParser::ParseDirectiveCFIStartProc>(
|
||||||
".cfi_startproc");
|
".cfi_startproc");
|
||||||
AddDirectiveHandler<&GenericAsmParser::ParseDirectiveCFIEndProc>(
|
AddDirectiveHandler<&GenericAsmParser::ParseDirectiveCFIEndProc>(
|
||||||
@ -289,6 +291,7 @@ public:
|
|||||||
bool ParseDirectiveLine(StringRef, SMLoc DirectiveLoc);
|
bool ParseDirectiveLine(StringRef, SMLoc DirectiveLoc);
|
||||||
bool ParseDirectiveLoc(StringRef, SMLoc DirectiveLoc);
|
bool ParseDirectiveLoc(StringRef, SMLoc DirectiveLoc);
|
||||||
bool ParseDirectiveStabs(StringRef, SMLoc DirectiveLoc);
|
bool ParseDirectiveStabs(StringRef, SMLoc DirectiveLoc);
|
||||||
|
bool ParseDirectiveCFISections(StringRef, SMLoc DirectiveLoc);
|
||||||
bool ParseDirectiveCFIStartProc(StringRef, SMLoc DirectiveLoc);
|
bool ParseDirectiveCFIStartProc(StringRef, SMLoc DirectiveLoc);
|
||||||
bool ParseDirectiveCFIEndProc(StringRef, SMLoc DirectiveLoc);
|
bool ParseDirectiveCFIEndProc(StringRef, SMLoc DirectiveLoc);
|
||||||
bool ParseDirectiveCFIDefCfa(StringRef, SMLoc DirectiveLoc);
|
bool ParseDirectiveCFIDefCfa(StringRef, SMLoc DirectiveLoc);
|
||||||
@ -2265,6 +2268,39 @@ bool GenericAsmParser::ParseDirectiveStabs(StringRef Directive,
|
|||||||
return TokError("unsupported directive '" + Directive + "'");
|
return TokError("unsupported directive '" + Directive + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// ParseDirectiveCFISections
|
||||||
|
/// ::= .cfi_sections section [, section]
|
||||||
|
bool GenericAsmParser::ParseDirectiveCFISections(StringRef,
|
||||||
|
SMLoc DirectiveLoc) {
|
||||||
|
StringRef Name;
|
||||||
|
bool EH = false;
|
||||||
|
bool Debug = false;
|
||||||
|
|
||||||
|
if (getParser().ParseIdentifier(Name))
|
||||||
|
return TokError("Expected an identifier");
|
||||||
|
|
||||||
|
if (Name == ".eh_frame")
|
||||||
|
EH = true;
|
||||||
|
else if (Name == ".debug_frame")
|
||||||
|
Debug = true;
|
||||||
|
|
||||||
|
if (getLexer().is(AsmToken::Comma)) {
|
||||||
|
Lex();
|
||||||
|
|
||||||
|
if (getParser().ParseIdentifier(Name))
|
||||||
|
return TokError("Expected an identifier");
|
||||||
|
|
||||||
|
if (Name == ".eh_frame")
|
||||||
|
EH = true;
|
||||||
|
else if (Name == ".debug_frame")
|
||||||
|
Debug = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
getStreamer().EmitCFISections(EH, Debug);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// ParseDirectiveCFIStartProc
|
/// ParseDirectiveCFIStartProc
|
||||||
/// ::= .cfi_startproc
|
/// ::= .cfi_startproc
|
||||||
bool GenericAsmParser::ParseDirectiveCFIStartProc(StringRef,
|
bool GenericAsmParser::ParseDirectiveCFIStartProc(StringRef,
|
||||||
|
@ -20,7 +20,8 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
MCStreamer::MCStreamer(MCContext &Ctx) : Context(Ctx) {
|
MCStreamer::MCStreamer(MCContext &Ctx) : Context(Ctx), EmitEHFrame(true),
|
||||||
|
EmitDebugFrame(false) {
|
||||||
const MCSection *section = NULL;
|
const MCSection *section = NULL;
|
||||||
SectionStack.push_back(std::make_pair(section, section));
|
SectionStack.push_back(std::make_pair(section, section));
|
||||||
}
|
}
|
||||||
@ -176,6 +177,11 @@ void MCStreamer::EmitLabel(MCSymbol *Symbol) {
|
|||||||
LastNonPrivate = Symbol;
|
LastNonPrivate = Symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MCStreamer::EmitCFISections(bool EH, bool Debug) {
|
||||||
|
EmitEHFrame = EH;
|
||||||
|
EmitDebugFrame = Debug;
|
||||||
|
}
|
||||||
|
|
||||||
void MCStreamer::EmitCFIStartProc() {
|
void MCStreamer::EmitCFIStartProc() {
|
||||||
MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo();
|
MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo();
|
||||||
if (CurFrame && !CurFrame->End)
|
if (CurFrame && !CurFrame->End)
|
||||||
|
Loading…
Reference in New Issue
Block a user