mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-26 05:25:47 +00:00
Remove LastOffset from the asm parser.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129378 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -448,6 +448,7 @@ namespace llvm {
|
|||||||
virtual bool EmitCFIRestoreState();
|
virtual bool EmitCFIRestoreState();
|
||||||
void EmitCFISameValue(int64_t Register);
|
void EmitCFISameValue(int64_t Register);
|
||||||
void EmitCFIRelOffset(int64_t Register, int64_t Offset);
|
void EmitCFIRelOffset(int64_t Register, int64_t Offset);
|
||||||
|
void EmitCFIAdjustCfaOffset(int64_t Adjustment);
|
||||||
|
|
||||||
/// EmitInstruction - Emit the given @p Instruction into the current
|
/// EmitInstruction - Emit the given @p Instruction into the current
|
||||||
/// section.
|
/// section.
|
||||||
|
@@ -523,6 +523,7 @@ void FrameEmitterImpl::EmitCFIInstruction(MCStreamer &Streamer,
|
|||||||
case MCCFIInstruction::RelMove: {
|
case MCCFIInstruction::RelMove: {
|
||||||
const MachineLocation &Dst = Instr.getDestination();
|
const MachineLocation &Dst = Instr.getDestination();
|
||||||
const MachineLocation &Src = Instr.getSource();
|
const MachineLocation &Src = Instr.getSource();
|
||||||
|
const bool IsRelative = Instr.getOperation() == MCCFIInstruction::RelMove;
|
||||||
|
|
||||||
// If advancing cfa.
|
// If advancing cfa.
|
||||||
if (Dst.isReg() && Dst.getReg() == MachineLocation::VirtualFP) {
|
if (Dst.isReg() && Dst.getReg() == MachineLocation::VirtualFP) {
|
||||||
@@ -535,7 +536,11 @@ void FrameEmitterImpl::EmitCFIInstruction(MCStreamer &Streamer,
|
|||||||
Streamer.EmitULEB128IntValue(Src.getReg());
|
Streamer.EmitULEB128IntValue(Src.getReg());
|
||||||
}
|
}
|
||||||
|
|
||||||
CFAOffset = -Src.getOffset();
|
if (IsRelative)
|
||||||
|
CFAOffset += Src.getOffset();
|
||||||
|
else
|
||||||
|
CFAOffset = -Src.getOffset();
|
||||||
|
|
||||||
Streamer.EmitULEB128IntValue(CFAOffset, 1);
|
Streamer.EmitULEB128IntValue(CFAOffset, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -549,7 +554,6 @@ void FrameEmitterImpl::EmitCFIInstruction(MCStreamer &Streamer,
|
|||||||
|
|
||||||
unsigned Reg = Src.getReg();
|
unsigned Reg = Src.getReg();
|
||||||
|
|
||||||
const bool IsRelative = Instr.getOperation() == MCCFIInstruction::RelMove;
|
|
||||||
int Offset = Dst.getOffset();
|
int Offset = Dst.getOffset();
|
||||||
if (IsRelative)
|
if (IsRelative)
|
||||||
Offset -= CFAOffset;
|
Offset -= CFAOffset;
|
||||||
|
@@ -81,11 +81,6 @@ private:
|
|||||||
MCAsmParserExtension *GenericParser;
|
MCAsmParserExtension *GenericParser;
|
||||||
MCAsmParserExtension *PlatformParser;
|
MCAsmParserExtension *PlatformParser;
|
||||||
|
|
||||||
// FIXME: This is not the best place to store this. To handle a (for example)
|
|
||||||
// .cfi_rel_offset before a .cfi_def_cfa_offset we need to know the initial
|
|
||||||
// frame state.
|
|
||||||
int64_t LastOffset;
|
|
||||||
|
|
||||||
/// This is the current buffer index we're lexing from as managed by the
|
/// This is the current buffer index we're lexing from as managed by the
|
||||||
/// SourceMgr object.
|
/// SourceMgr object.
|
||||||
int CurBuffer;
|
int CurBuffer;
|
||||||
@@ -145,14 +140,6 @@ public:
|
|||||||
|
|
||||||
/// }
|
/// }
|
||||||
|
|
||||||
int64_t adjustLastOffset(int64_t Adjustment) {
|
|
||||||
LastOffset += Adjustment;
|
|
||||||
return LastOffset;
|
|
||||||
}
|
|
||||||
void setLastOffset(int64_t Offset) {
|
|
||||||
LastOffset = Offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CheckForValidSection();
|
void CheckForValidSection();
|
||||||
|
|
||||||
@@ -337,7 +324,7 @@ enum { DEFAULT_ADDRSPACE = 0 };
|
|||||||
AsmParser::AsmParser(const Target &T, SourceMgr &_SM, MCContext &_Ctx,
|
AsmParser::AsmParser(const Target &T, SourceMgr &_SM, MCContext &_Ctx,
|
||||||
MCStreamer &_Out, const MCAsmInfo &_MAI)
|
MCStreamer &_Out, const MCAsmInfo &_MAI)
|
||||||
: Lexer(_MAI), Ctx(_Ctx), Out(_Out), SrcMgr(_SM),
|
: Lexer(_MAI), Ctx(_Ctx), Out(_Out), SrcMgr(_SM),
|
||||||
GenericParser(new GenericAsmParser), PlatformParser(0), LastOffset(0),
|
GenericParser(new GenericAsmParser), PlatformParser(0),
|
||||||
CurBuffer(0), MacrosEnabled(true) {
|
CurBuffer(0), MacrosEnabled(true) {
|
||||||
Lexer.setBuffer(SrcMgr.getMemoryBuffer(CurBuffer));
|
Lexer.setBuffer(SrcMgr.getMemoryBuffer(CurBuffer));
|
||||||
|
|
||||||
@@ -2334,8 +2321,6 @@ bool GenericAsmParser::ParseDirectiveCFIDefCfaOffset(StringRef,
|
|||||||
if (getParser().ParseAbsoluteExpression(Offset))
|
if (getParser().ParseAbsoluteExpression(Offset))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
getParser().setLastOffset(Offset);
|
|
||||||
|
|
||||||
return getStreamer().EmitCFIDefCfaOffset(Offset);
|
return getStreamer().EmitCFIDefCfaOffset(Offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2347,9 +2332,8 @@ bool GenericAsmParser::ParseDirectiveCFIAdjustCfaOffset(StringRef,
|
|||||||
if (getParser().ParseAbsoluteExpression(Adjustment))
|
if (getParser().ParseAbsoluteExpression(Adjustment))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int64_t Offset = getParser().adjustLastOffset(Adjustment);
|
getStreamer().EmitCFIAdjustCfaOffset(Adjustment);
|
||||||
|
return false;
|
||||||
return getStreamer().EmitCFIDefCfaOffset(Offset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ParseDirectiveCFIDefCfaRegister
|
/// ParseDirectiveCFIDefCfaRegister
|
||||||
|
@@ -197,6 +197,17 @@ bool MCStreamer::EmitCFIDefCfaOffset(int64_t Offset) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MCStreamer::EmitCFIAdjustCfaOffset(int64_t Adjustment) {
|
||||||
|
EnsureValidFrame();
|
||||||
|
MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo();
|
||||||
|
MCSymbol *Label = getContext().CreateTempSymbol();
|
||||||
|
EmitLabel(Label);
|
||||||
|
MachineLocation Dest(MachineLocation::VirtualFP);
|
||||||
|
MachineLocation Source(MachineLocation::VirtualFP, Adjustment);
|
||||||
|
MCCFIInstruction Instruction(MCCFIInstruction::RelMove, Label, Dest, Source);
|
||||||
|
CurFrame->Instructions.push_back(Instruction);
|
||||||
|
}
|
||||||
|
|
||||||
bool MCStreamer::EmitCFIDefCfaRegister(int64_t Register) {
|
bool MCStreamer::EmitCFIDefCfaRegister(int64_t Register) {
|
||||||
EnsureValidFrame();
|
EnsureValidFrame();
|
||||||
MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo();
|
MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo();
|
||||||
|
Reference in New Issue
Block a user