[llvm-commits] [llvm] r78625 - in /llvm/trunk: docs/ include/llvm/ include/llvm/CodeGen/ include/llvm/Target/ lib/CodeGen/ lib/CodeGen/AsmPrinter/ lib/CodeGen/SelectionDAG/ lib/ExecutionEngine/JIT/ lib/Target/ lib/Target/ARM/ lib/Target/ARM/AsmPrinter/ lib/Target/CellSPU/ lib/Target/PowerPC/ lib/Target/X86/ tools/lto/

Evan Cheng evan.cheng at apple.com
Mon Aug 10 18:19:15 PDT 2009


On Aug 10, 2009, at 6:11 PM, Jim Grosbach wrote:

>
> On Aug 10, 2009, at 5:53 PM, Evan Cheng wrote:
>>
>> Obviously we can throw an exception yet. But how far away are we from
>> being able run ARM C++ and Objc tests?
>>
>
> We can throw OK, and we can unwind stack frames, including the
> associated unwind actions to clean up along the way (calling local
> destructors and such). The files I've been using to do basic testing
> of this have a catch block in a GCC-build module and all the other
> bits that throw and unwind in an LLVM-GCC build module.
>
> We're very close to having the rest of it as well. I'll be looking at
> getting that done tonight and tomorrow.

Ok. I have other inline comments on your patch. Please don't miss  
them. Thanks.

Evan

>
> -J
>
>>>
>>>
>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=78625&r1=78624&r2=78625&view=diff
>>>
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> = 
>>> ====================================================================
>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original)
>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Mon Aug 10
>>> 19:09:57 2009
>>> @@ -364,6 +364,7 @@
>>> /// try-range address.
>>> void DwarfException::
>>> ComputeCallSiteTable(SmallVectorImpl<CallSiteEntry> &CallSites,
>>> +                     std::map<unsigned,CallSiteEntry*>
>>> &CallSiteIndexMap,
>>
>> Are indices continuous integers? If so, perhaps it would be better to
>> use IndexedMap or at least DenseMap?
>>
>>>                    const RangeMapType &PadMap,
>>>
>>> -  for (unsigned i = 0, e = CallSites.size(); i < e; ++i)
>>> +  unsigned SizeSites;
>>> +  if (TAI->getExceptionHandlingType() == ExceptionHandling::SjLj) {
>>> +    SizeSites = (MF->getMaxCallSiteIndex() - CallSites.size()) *
>>> +      TargetAsmInfo::getULEB128Size(0) * 2;
>>> +  } else
>>> +    SizeSites = CallSites.size() *
>>> +      (SiteStartSize + SiteLengthSize + LandingPadSize);
>>> +  for (unsigned i = 0, e = CallSites.size(); i < e; ++i) {
>>>   SizeSites += TargetAsmInfo::getULEB128Size(CallSites[i].Action);
>>> -
>>> +    if (TAI->getExceptionHandlingType() == ExceptionHandling::SjLj)
>>> +      SizeSites += TargetAsmInfo::getULEB128Size(i);
>>> +      // FIXME: 'i' above should be the landing pad index
>>
>> I don't quite understand this fixme comment.
>>
>>>
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> = 
>>> ====================================================================
>>> --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original)
>>> +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Mon Aug 10 19:09:57
>>> 2009
>>> @@ -1427,9 +1427,12 @@
>>> def Int_eh_sjlj_setjmp : XI<(outs), (ins GPR:$src),
>>>                              AddrModeNone, SizeSpecial,
>>> IndexModeNone,
>>>                              Pseudo, NoItinerary,
>>> -                               "add r0, pc, #4\n\t"
>>> -                               "str r0, [$src, #+4]\n\t"
>>> -                               "mov r0, #0 @ eh_setjmp", "",
>>> +                               "str sp, [$src, #+8] @ eh_setjmp
>>> begin\n\t"
>>> +                               "add ip, pc, #8\n\t"
>>> +                               "str ip, [$src, #+4]\n\t"
>>> +                               "mov r0, #0\n\t"
>>> +                               "add pc, pc, #0\n\t"
>>> +                               "mov r0, #1 @ eh_setjmp end\n\t",  
>>> "",
>>>                              [(set R0, (ARMeh_sjlj_setjmp GPR:
>>> $src))]>;
>>> }
>>>
>>
>> You need to update ARMBaseInstrInfo::GetInstSizeInBytes. It's no
>> longer 12-bytes long.
>>
>> Please add a Thumb2 specific instruction, this obviously is ARM
>> specific only. Please take care not to use "add pc, pc, #0", its
>> semantics is undefined in Thumb2 mode. Also please make sure you use
>> universal syntax for Thumb2.
>>
>> Evan
>>
>>>
>>> Modified: llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp?rev=78625&r1=78624&r2=78625&view=diff
>>>
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> = 
>>> ====================================================================
>>> --- llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp (original)
>>> +++ llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp Mon Aug 10
>>> 19:09:57 2009
>>> @@ -47,6 +47,12 @@
>>> ProtectedDirective = NULL;
>>> HasDotTypeDotSizeDirective = false;
>>> SupportsDebugInformation = true;
>>> +
>>> +  // Exceptions handling
>>> +  ExceptionsType = ExceptionHandling::SjLj;
>>> +  GlobalEHDirective = "\t.globl\t";
>>> +  SupportsWeakOmittedEHFrame = false;
>>> +  AbsoluteEHSectionOffsets = false;
>>> }
>>>
>>> ARMELFTargetAsmInfo::ARMELFTargetAsmInfo() {
>>>
>>> Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=78625&r1=78624&r2=78625&view=diff
>>>
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> = 
>>> ====================================================================
>>> --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp  
>>> (original)
>>> +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Mon Aug
>>> 10 19:09:57 2009
>>> @@ -208,6 +208,8 @@
>>>     } else {
>>>       if (GV)
>>>         Name = Mang->getMangledName(GV);
>>> +        else if (!strncmp(ACPV->getSymbol(), "L_lsda_", 7))
>>> +          Name = ACPV->getSymbol();
>>>       else
>>>         Name = Mang->makeNameProper(ACPV->getSymbol());
>>>     }
>>>
>>> Modified: llvm/trunk/lib/Target/CellSPU/SPUTargetAsmInfo.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUTargetAsmInfo.cpp?rev=78625&r1=78624&r2=78625&view=diff
>>>
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> = 
>>> ====================================================================
>>> --- llvm/trunk/lib/Target/CellSPU/SPUTargetAsmInfo.cpp (original)
>>> +++ llvm/trunk/lib/Target/CellSPU/SPUTargetAsmInfo.cpp Mon Aug 10
>>> 19:09:57 2009
>>> @@ -37,6 +37,6 @@
>>>
>>> // Exception handling is not supported on CellSPU (think about it:
>>> you only
>>> // have 256K for code+data. Would you support exception handling?)
>>> -  SupportsExceptionHandling = false;
>>> +  ExceptionsType = ExceptionHandling::None;
>>> }
>>>
>>>
>>> Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp?rev=78625&r1=78624&r2=78625&view=diff
>>>
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> = 
>>> ====================================================================
>>> --- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp (original)
>>> +++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Mon Aug 10
>>> 19:09:57 2009
>>> @@ -24,8 +24,8 @@
>>> PCSymbol = ".";
>>> CommentString = ";";
>>> UsedDirective = "\t.no_dead_strip\t";
>>> -  SupportsExceptionHandling = true;
>>> -
>>> +  ExceptionsType = ExceptionHandling::Dwarf;
>>> +
>>> GlobalEHDirective = "\t.globl\t";
>>> SupportsWeakOmittedEHFrame = false;
>>> }
>>> @@ -49,7 +49,7 @@
>>>
>>> // Exceptions handling
>>> if (!TM.getSubtargetImpl()->isPPC64())
>>> -    SupportsExceptionHandling = true;
>>> +    ExceptionsType = ExceptionHandling::Dwarf;
>>> AbsoluteEHSectionOffsets = false;
>>> }
>>>
>>>
>>> Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=78625&r1=78624&r2=78625&view=diff
>>>
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> = 
>>> ====================================================================
>>> --- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original)
>>> +++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Mon Aug 10 19:09:57 2009
>>> @@ -72,7 +72,7 @@
>>> HasLEB128 = false;
>>> HasDotLocAndDotFile = false;
>>> SupportsDebugInformation = false;
>>> -  SupportsExceptionHandling = false;
>>> +  ExceptionsType = ExceptionHandling::None;
>>> DwarfRequiresFrameSection = true;
>>> DwarfUsesInlineInfoSection = false;
>>> Is_EHSymbolPrivate = true;
>>>
>>> Modified: llvm/trunk/lib/Target/TargetMachine.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachine.cpp?rev=78625&r1=78624&r2=78625&view=diff
>>>
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> = 
>>> ====================================================================
>>> --- llvm/trunk/lib/Target/TargetMachine.cpp (original)
>>> +++ llvm/trunk/lib/Target/TargetMachine.cpp Mon Aug 10 19:09:57 2009
>>> @@ -33,7 +33,8 @@
>>> FloatABI::ABIType FloatABIType;
>>> bool NoImplicitFloat;
>>> bool NoZerosInBSS;
>>> -  bool ExceptionHandling;
>>> +  bool DwarfExceptionHandling;
>>> +  bool SjLjExceptionHandling;
>>> bool UnwindTablesMandatory;
>>> Reloc::Model RelocationModel;
>>> CodeModel::Model CMModel;
>>> @@ -104,9 +105,14 @@
>>> cl::location(NoZerosInBSS),
>>> cl::init(false));
>>> static cl::opt<bool, true>
>>> -EnableExceptionHandling("enable-eh",
>>> +EnableDwarfExceptionHandling("enable-eh",
>>> cl::desc("Emit DWARF exception handling (default if target
>>> supports)"),
>>> -  cl::location(ExceptionHandling),
>>> +  cl::location(DwarfExceptionHandling),
>>> +  cl::init(false));
>>> +static cl::opt<bool, true>
>>> +EnableSjLjExceptionHandling("enable-sjlj-eh",
>>> +  cl::desc("Emit SJLJ exception handling (default if target
>>> supports)"),
>>> +  cl::location(SjLjExceptionHandling),
>>> cl::init(false));
>>> static cl::opt<bool, true>
>>> EnableUnwindTables("unwind-tables",
>>>
>>> Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=78625&r1=78624&r2=78625&view=diff
>>>
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> = 
>>> ====================================================================
>>> --- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original)
>>> +++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Mon Aug 10
>>> 19:09:57 2009
>>> @@ -77,7 +77,7 @@
>>> DwarfUsesInlineInfoSection = true;
>>>
>>> // Exceptions handling
>>> -  SupportsExceptionHandling = true;
>>> +  ExceptionsType = ExceptionHandling::Dwarf;
>>> GlobalEHDirective = "\t.globl\t";
>>> SupportsWeakOmittedEHFrame = false;
>>> AbsoluteEHSectionOffsets = false;
>>> @@ -99,7 +99,7 @@
>>> SupportsDebugInformation = true;
>>>
>>> // Exceptions handling
>>> -  SupportsExceptionHandling = true;
>>> +  ExceptionsType = ExceptionHandling::Dwarf;
>>> AbsoluteEHSectionOffsets = false;
>>>
>>> // On Linux we must declare when we can use a non-executable stack.
>>>
>>> Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=78625&r1=78624&r2=78625&view=diff
>>>
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> = 
>>> ====================================================================
>>> --- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original)
>>> +++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Mon Aug 10 19:09:57
>>> 2009
>>> @@ -394,9 +394,19 @@
>>>
>>>   Module* mergedModule = _linker.getModule();
>>>
>>> -     // If target supports exception handling then enable it now.
>>> -    if ( _target->getTargetAsmInfo()->doesSupportExceptionHandling
>>> () )
>>> -        llvm::ExceptionHandling = true;
>>> +    // If target supports exception handling then enable it now.
>>> +    switch (_target->getTargetAsmInfo()->getExceptionHandlingType
>>> ()) {
>>> +    case ExceptionHandling::Dwarf:
>>> +      llvm::DwarfExceptionHandling = true;
>>> +      break;
>>> +    case ExceptionHandling::SjLj:
>>> +      llvm::SjLjExceptionHandling = true;
>>> +      break;
>>> +    case ExceptionHandling::None:
>>> +      break;
>>> +    default:
>>> +      assert (0 && "Unknown exception handling model!");
>>> +    }
>>>
>>>   // if options were requested, set them
>>>   if ( !_codegenOptions.empty() )
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list