mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-26 18:20:39 +00:00
- Temporarily unbreak the build by forcing the TType "absptr", which isn't
correct. But what are you going to do? I'll fix this in the future. - Move another large loop into its own method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77408 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -286,9 +286,8 @@ bool DwarfException::PadLT(const LandingPadInfo *L, const LandingPadInfo *R) {
|
|||||||
|
|
||||||
/// ComputeActionsTable - Compute the actions table and gather the first action
|
/// ComputeActionsTable - Compute the actions table and gather the first action
|
||||||
/// index for each landing pad site.
|
/// index for each landing pad site.
|
||||||
unsigned
|
unsigned DwarfException::
|
||||||
DwarfException::ComputeActionsTable(const SmallVectorImpl<const LandingPadInfo*>
|
ComputeActionsTable(const SmallVectorImpl<const LandingPadInfo*> &LandingPads,
|
||||||
&LandingPads,
|
|
||||||
SmallVectorImpl<ActionEntry> &Actions,
|
SmallVectorImpl<ActionEntry> &Actions,
|
||||||
SmallVectorImpl<unsigned> &FirstActions) {
|
SmallVectorImpl<unsigned> &FirstActions) {
|
||||||
const std::vector<unsigned> &FilterIds = MMI->getFilterIds();
|
const std::vector<unsigned> &FilterIds = MMI->getFilterIds();
|
||||||
@@ -374,50 +373,18 @@ DwarfException::ComputeActionsTable(const SmallVectorImpl<const LandingPadInfo*>
|
|||||||
return SizeActions;
|
return SizeActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DwarfException::EmitExceptionTable() {
|
/// ComputeCallSiteTable - Compute the call-site table. The entry for an invoke
|
||||||
const std::vector<GlobalVariable *> &TypeInfos = MMI->getTypeInfos();
|
/// has a try-range containing the call, a non-zero landing pad and an
|
||||||
const std::vector<unsigned> &FilterIds = MMI->getFilterIds();
|
/// appropriate action. The entry for an ordinary call has a try-range
|
||||||
const std::vector<LandingPadInfo> &PadInfos = MMI->getLandingPads();
|
/// containing the call and zero for the landing pad and the action. Calls
|
||||||
if (PadInfos.empty()) return;
|
/// marked 'nounwind' have no entry and must not be contained in the try-range
|
||||||
|
/// of any entry - they form gaps in the table. Entries must be ordered by
|
||||||
// Sort the landing pads in order of their type ids. This is used to fold
|
/// try-range address.
|
||||||
// duplicate actions.
|
void DwarfException::
|
||||||
SmallVector<const LandingPadInfo *, 64> LandingPads;
|
ComputeCallSiteTable(SmallVectorImpl<CallSiteEntry> &CallSites,
|
||||||
LandingPads.reserve(PadInfos.size());
|
const RangeMapType &PadMap,
|
||||||
|
const SmallVectorImpl<const LandingPadInfo *> &LandingPads,
|
||||||
for (unsigned i = 0, N = PadInfos.size(); i != N; ++i)
|
const SmallVectorImpl<unsigned> &FirstActions) {
|
||||||
LandingPads.push_back(&PadInfos[i]);
|
|
||||||
|
|
||||||
std::sort(LandingPads.begin(), LandingPads.end(), PadLT);
|
|
||||||
|
|
||||||
// Compute the actions table and gather the first action index for each
|
|
||||||
// landing pad site.
|
|
||||||
SmallVector<ActionEntry, 32> Actions;
|
|
||||||
SmallVector<unsigned, 64> FirstActions;
|
|
||||||
unsigned SizeActions = ComputeActionsTable(LandingPads, Actions, FirstActions);
|
|
||||||
|
|
||||||
// Invokes and nounwind calls have entries in PadMap (due to being bracketed
|
|
||||||
// by try-range labels when lowered). Ordinary calls do not, so appropriate
|
|
||||||
// try-ranges for them need be deduced.
|
|
||||||
RangeMapType PadMap;
|
|
||||||
for (unsigned i = 0, N = LandingPads.size(); i != N; ++i) {
|
|
||||||
const LandingPadInfo *LandingPad = LandingPads[i];
|
|
||||||
for (unsigned j = 0, E = LandingPad->BeginLabels.size(); j != E; ++j) {
|
|
||||||
unsigned BeginLabel = LandingPad->BeginLabels[j];
|
|
||||||
assert(!PadMap.count(BeginLabel) && "Duplicate landing pad labels!");
|
|
||||||
PadRange P = { i, j };
|
|
||||||
PadMap[BeginLabel] = P;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compute the call-site table. The entry for an invoke has a try-range
|
|
||||||
// containing the call, a non-zero landing pad and an appropriate action. The
|
|
||||||
// entry for an ordinary call has a try-range containing the call and zero for
|
|
||||||
// the landing pad and the action. Calls marked 'nounwind' have no entry and
|
|
||||||
// must not be contained in the try-range of any entry - they form gaps in the
|
|
||||||
// table. Entries must be ordered by try-range address.
|
|
||||||
SmallVector<CallSiteEntry, 64> CallSites;
|
|
||||||
|
|
||||||
// The end label of the previous invoke or nounwind try-range.
|
// The end label of the previous invoke or nounwind try-range.
|
||||||
unsigned LastLabel = 0;
|
unsigned LastLabel = 0;
|
||||||
|
|
||||||
@@ -501,6 +468,47 @@ void DwarfException::EmitExceptionTable() {
|
|||||||
CallSiteEntry Site = {LastLabel, 0, 0, 0};
|
CallSiteEntry Site = {LastLabel, 0, 0, 0};
|
||||||
CallSites.push_back(Site);
|
CallSites.push_back(Site);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DwarfException::EmitExceptionTable() {
|
||||||
|
const std::vector<GlobalVariable *> &TypeInfos = MMI->getTypeInfos();
|
||||||
|
const std::vector<unsigned> &FilterIds = MMI->getFilterIds();
|
||||||
|
const std::vector<LandingPadInfo> &PadInfos = MMI->getLandingPads();
|
||||||
|
if (PadInfos.empty()) return;
|
||||||
|
|
||||||
|
// Sort the landing pads in order of their type ids. This is used to fold
|
||||||
|
// duplicate actions.
|
||||||
|
SmallVector<const LandingPadInfo *, 64> LandingPads;
|
||||||
|
LandingPads.reserve(PadInfos.size());
|
||||||
|
|
||||||
|
for (unsigned i = 0, N = PadInfos.size(); i != N; ++i)
|
||||||
|
LandingPads.push_back(&PadInfos[i]);
|
||||||
|
|
||||||
|
std::sort(LandingPads.begin(), LandingPads.end(), PadLT);
|
||||||
|
|
||||||
|
// Compute the actions table and gather the first action index for each
|
||||||
|
// landing pad site.
|
||||||
|
SmallVector<ActionEntry, 32> Actions;
|
||||||
|
SmallVector<unsigned, 64> FirstActions;
|
||||||
|
unsigned SizeActions = ComputeActionsTable(LandingPads, Actions, FirstActions);
|
||||||
|
|
||||||
|
// Invokes and nounwind calls have entries in PadMap (due to being bracketed
|
||||||
|
// by try-range labels when lowered). Ordinary calls do not, so appropriate
|
||||||
|
// try-ranges for them need be deduced.
|
||||||
|
RangeMapType PadMap;
|
||||||
|
for (unsigned i = 0, N = LandingPads.size(); i != N; ++i) {
|
||||||
|
const LandingPadInfo *LandingPad = LandingPads[i];
|
||||||
|
for (unsigned j = 0, E = LandingPad->BeginLabels.size(); j != E; ++j) {
|
||||||
|
unsigned BeginLabel = LandingPad->BeginLabels[j];
|
||||||
|
assert(!PadMap.count(BeginLabel) && "Duplicate landing pad labels!");
|
||||||
|
PadRange P = { i, j };
|
||||||
|
PadMap[BeginLabel] = P;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute the call-site table.
|
||||||
|
SmallVector<CallSiteEntry, 64> CallSites;
|
||||||
|
ComputeCallSiteTable(CallSites, PadMap, LandingPads, FirstActions);
|
||||||
|
|
||||||
// Final tallies.
|
// Final tallies.
|
||||||
|
|
||||||
@@ -545,6 +553,7 @@ void DwarfException::EmitExceptionTable() {
|
|||||||
Asm->EmitInt8(dwarf::DW_EH_PE_omit);
|
Asm->EmitInt8(dwarf::DW_EH_PE_omit);
|
||||||
Asm->EOL("LPStart format (DW_EH_PE_omit)");
|
Asm->EOL("LPStart format (DW_EH_PE_omit)");
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (!TypeInfos.empty() || !FilterIds.empty()) {
|
if (!TypeInfos.empty() || !FilterIds.empty()) {
|
||||||
Asm->EmitInt8(TAI->PreferredEHDataFormat(DwarfEncoding::Data, true));
|
Asm->EmitInt8(TAI->PreferredEHDataFormat(DwarfEncoding::Data, true));
|
||||||
// FIXME: The comment here should correspond with what PreferredEHDataFormat
|
// FIXME: The comment here should correspond with what PreferredEHDataFormat
|
||||||
@@ -556,6 +565,10 @@ void DwarfException::EmitExceptionTable() {
|
|||||||
Asm->EmitInt8(dwarf::DW_EH_PE_omit);
|
Asm->EmitInt8(dwarf::DW_EH_PE_omit);
|
||||||
Asm->EOL("TType format (DW_EH_PE_omit)");
|
Asm->EOL("TType format (DW_EH_PE_omit)");
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
Asm->EmitInt8(dwarf::DW_EH_PE_absptr);
|
||||||
|
Asm->EOL("TType format (DW_EH_PE_absptr)");
|
||||||
|
#endif
|
||||||
|
|
||||||
Asm->EmitInt8(dwarf::DW_EH_PE_udata4);
|
Asm->EmitInt8(dwarf::DW_EH_PE_udata4);
|
||||||
Asm->EOL("Call site format (DW_EH_PE_udata4)");
|
Asm->EOL("Call site format (DW_EH_PE_udata4)");
|
||||||
|
|||||||
@@ -143,9 +143,21 @@ class VISIBILITY_HIDDEN DwarfException : public Dwarf {
|
|||||||
|
|
||||||
/// ComputeActionsTable - Compute the actions table and gather the first
|
/// ComputeActionsTable - Compute the actions table and gather the first
|
||||||
/// action index for each landing pad site.
|
/// action index for each landing pad site.
|
||||||
unsigned ComputeActionsTable(const SmallVectorImpl<const LandingPadInfo*> &LP,
|
unsigned ComputeActionsTable(const SmallVectorImpl<const LandingPadInfo*>&LPs,
|
||||||
SmallVectorImpl<ActionEntry> &Actions,
|
SmallVectorImpl<ActionEntry> &Actions,
|
||||||
SmallVectorImpl<unsigned> &FirstActions);
|
SmallVectorImpl<unsigned> &FirstActions);
|
||||||
|
|
||||||
|
/// ComputeCallSiteTable - Compute the call-site table. The entry for an
|
||||||
|
/// invoke has a try-range containing the call, a non-zero landing pad and an
|
||||||
|
/// appropriate action. The entry for an ordinary call has a try-range
|
||||||
|
/// containing the call and zero for the landing pad and the action. Calls
|
||||||
|
/// marked 'nounwind' have no entry and must not be contained in the try-range
|
||||||
|
/// of any entry - they form gaps in the table. Entries must be ordered by
|
||||||
|
/// try-range address.
|
||||||
|
void ComputeCallSiteTable(SmallVectorImpl<CallSiteEntry> &CallSites,
|
||||||
|
const RangeMapType &PadMap,
|
||||||
|
const SmallVectorImpl<const LandingPadInfo *> &LPs,
|
||||||
|
const SmallVectorImpl<unsigned> &FirstActions);
|
||||||
void EmitExceptionTable();
|
void EmitExceptionTable();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user