mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-10 02:36:06 +00:00
Update the JIT exception writer to better mimic the codegen exception writer.
Also skip indirect encoding for platforms that ask for one: we direclty write an address, not a pointer to the address. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54987 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
23f35bc3ae
commit
2d450ebe18
@ -66,7 +66,8 @@ JITDwarfEmitter::EmitFrameMoves(intptr_t BaseLabelPtr,
|
|||||||
unsigned PointerSize = TD->getPointerSize();
|
unsigned PointerSize = TD->getPointerSize();
|
||||||
int stackGrowth = stackGrowthDirection == TargetFrameInfo::StackGrowsUp ?
|
int stackGrowth = stackGrowthDirection == TargetFrameInfo::StackGrowsUp ?
|
||||||
PointerSize : -PointerSize;
|
PointerSize : -PointerSize;
|
||||||
bool IsLocal = BaseLabelPtr;
|
bool IsLocal = false;
|
||||||
|
unsigned BaseLabelID = 0;
|
||||||
|
|
||||||
for (unsigned i = 0, N = Moves.size(); i < N; ++i) {
|
for (unsigned i = 0, N = Moves.size(); i < N; ++i) {
|
||||||
const MachineMove &Move = Moves[i];
|
const MachineMove &Move = Moves[i];
|
||||||
@ -86,7 +87,7 @@ JITDwarfEmitter::EmitFrameMoves(intptr_t BaseLabelPtr,
|
|||||||
const MachineLocation &Src = Move.getSource();
|
const MachineLocation &Src = Move.getSource();
|
||||||
|
|
||||||
// Advance row if new location.
|
// Advance row if new location.
|
||||||
if (BaseLabelPtr && LabelID && (BaseLabelPtr != LabelPtr || !IsLocal)) {
|
if (BaseLabelPtr && LabelID && (BaseLabelID != LabelID || !IsLocal)) {
|
||||||
MCE->emitByte(dwarf::DW_CFA_advance_loc4);
|
MCE->emitByte(dwarf::DW_CFA_advance_loc4);
|
||||||
if (PointerSize == 8) {
|
if (PointerSize == 8) {
|
||||||
MCE->emitInt64(LabelPtr - BaseLabelPtr);
|
MCE->emitInt64(LabelPtr - BaseLabelPtr);
|
||||||
@ -94,6 +95,7 @@ JITDwarfEmitter::EmitFrameMoves(intptr_t BaseLabelPtr,
|
|||||||
MCE->emitInt32(LabelPtr - BaseLabelPtr);
|
MCE->emitInt32(LabelPtr - BaseLabelPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BaseLabelID = LabelID;
|
||||||
BaseLabelPtr = LabelPtr;
|
BaseLabelPtr = LabelPtr;
|
||||||
IsLocal = true;
|
IsLocal = true;
|
||||||
}
|
}
|
||||||
@ -541,12 +543,9 @@ JITDwarfEmitter::EmitCommonEHFrame(const Function* Personality) const {
|
|||||||
if (Personality) {
|
if (Personality) {
|
||||||
MCE->emitULEB128Bytes(7);
|
MCE->emitULEB128Bytes(7);
|
||||||
|
|
||||||
if (needsIndirectEncoding)
|
// Direct encoding, because we use the function pointer.
|
||||||
MCE->emitByte(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4 |
|
MCE->emitByte(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4);
|
||||||
dwarf::DW_EH_PE_indirect);
|
|
||||||
else
|
|
||||||
MCE->emitByte(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4);
|
|
||||||
|
|
||||||
if (PointerSize == 8)
|
if (PointerSize == 8)
|
||||||
MCE->emitInt64((intptr_t)Jit.getPointerToGlobal(Personality) -
|
MCE->emitInt64((intptr_t)Jit.getPointerToGlobal(Personality) -
|
||||||
MCE->getCurrentPCValue());
|
MCE->getCurrentPCValue());
|
||||||
@ -554,12 +553,12 @@ JITDwarfEmitter::EmitCommonEHFrame(const Function* Personality) const {
|
|||||||
MCE->emitInt32((intptr_t)Jit.getPointerToGlobal(Personality) -
|
MCE->emitInt32((intptr_t)Jit.getPointerToGlobal(Personality) -
|
||||||
MCE->getCurrentPCValue());
|
MCE->getCurrentPCValue());
|
||||||
|
|
||||||
MCE->emitULEB128Bytes(dwarf::DW_EH_PE_pcrel);
|
MCE->emitULEB128Bytes(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4);
|
||||||
MCE->emitULEB128Bytes(dwarf::DW_EH_PE_pcrel);
|
MCE->emitULEB128Bytes(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MCE->emitULEB128Bytes(1);
|
MCE->emitULEB128Bytes(1);
|
||||||
MCE->emitULEB128Bytes(dwarf::DW_EH_PE_pcrel);
|
MCE->emitULEB128Bytes(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<MachineMove> Moves;
|
std::vector<MachineMove> Moves;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user