X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FCodeGen%2FMachineModuleInfo.cpp;h=9943fa9967693d7f7a4e22294c1cdc958a5b1b9f;hb=ee888132754c709de8d2e2c5ef85531a15ed44f2;hp=88d8507425077226197e852d66d48827938ab87c;hpb=14da32a486f31ba695de9080830e6fadf4942d5b;p=oota-llvm.git diff --git a/lib/CodeGen/MachineModuleInfo.cpp b/lib/CodeGen/MachineModuleInfo.cpp index 88d85074250..9943fa99676 100644 --- a/lib/CodeGen/MachineModuleInfo.cpp +++ b/lib/CodeGen/MachineModuleInfo.cpp @@ -1364,6 +1364,12 @@ GlobalVariable *DISerializer::Serialize(DebugInfoDesc *DD) { return GV; } +/// addDescriptor - Directly connect DD with existing GV. +void DISerializer::addDescriptor(DebugInfoDesc *DD, + GlobalVariable *GV) { + DescGlobals[DD] = GV; +} + //===----------------------------------------------------------------------===// /// Verify - Return true if the GlobalVariable appears to be a valid @@ -1476,6 +1482,8 @@ MachineModuleInfo::MachineModuleInfo() , FrameMoves() , LandingPads() , Personalities() +, CallsEHReturn(0) +, CallsUnwindInit(0) { // Always emit "no personality" info Personalities.push_back(NULL); @@ -1523,6 +1531,8 @@ void MachineModuleInfo::EndFunction() { TypeInfos.clear(); FilterIds.clear(); FilterEnds.clear(); + CallsEHReturn = 0; + CallsUnwindInit = 0; } /// getDescFor - Convert a Value to a debug information descriptor. @@ -1722,6 +1732,13 @@ void MachineModuleInfo::addFilterTypeInfo(MachineBasicBlock *LandingPad, LP.TypeIds.push_back(getFilterIDFor(IdsInFilter)); } +/// addCleanup - Add a cleanup action for a landing pad. +/// +void MachineModuleInfo::addCleanup(MachineBasicBlock *LandingPad) { + LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad); + LP.TypeIds.push_back(0); +} + /// TidyLandingPads - Remap landing pad labels and remove any deleted landing /// pads. void MachineModuleInfo::TidyLandingPads() { @@ -1729,22 +1746,18 @@ void MachineModuleInfo::TidyLandingPads() { LandingPadInfo &LandingPad = LandingPads[i]; LandingPad.LandingPadLabel = MappedLabel(LandingPad.LandingPadLabel); - if (!LandingPad.LandingPadBlock) - // Must not have cleanups if no landing pad. - LandingPad.TypeIds.clear(); - // Special case: we *should* emit LPs with null LP MBB. This indicates // "rethrow" case. if (!LandingPad.LandingPadLabel && LandingPad.LandingPadBlock) { LandingPads.erase(LandingPads.begin() + i); continue; } - + for (unsigned j=0; j != LandingPads[i].BeginLabels.size(); ) { unsigned BeginLabel = MappedLabel(LandingPad.BeginLabels[j]); unsigned EndLabel = MappedLabel(LandingPad.EndLabels[j]); - - + + if (!BeginLabel || !EndLabel) { LandingPad.BeginLabels.erase(LandingPad.BeginLabels.begin() + j); LandingPad.EndLabels.erase(LandingPad.EndLabels.begin() + j); @@ -1755,7 +1768,19 @@ void MachineModuleInfo::TidyLandingPads() { LandingPad.EndLabels[j] = EndLabel; ++j; } - + + // Remove landing pads with no try-ranges. + if (!LandingPads[i].BeginLabels.size()) { + LandingPads.erase(LandingPads.begin() + i); + continue; + } + + // If there is no landing pad, ensure that the list of typeids is empty. + // If the only typeid is a cleanup, this is the same as having no typeids. + if (!LandingPad.LandingPadBlock || + (LandingPad.TypeIds.size() == 1 && !LandingPad.TypeIds[0])) + LandingPad.TypeIds.clear(); + ++i; } }