[llvm-commits] [llvm] r80649 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.h lib/Target/ARM/ARMConstantPoolValue.cpp lib/Target/ARM/ARMConstantPoolValue.h lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp test/CodeGen/ARM/2009-08-31-LSDA-Name.ll

Evan Cheng evan.cheng at apple.com
Tue Sep 1 13:54:22 PDT 2009


On Sep 1, 2009, at 1:39 PM, Jim Grosbach wrote:

>
> On Sep 1, 2009, at 10:23 AM, Jim Grosbach wrote:
>
>>
>> On Sep 1, 2009, at 9:57 AM, Evan Cheng wrote:
>>
>>>
>>> On Sep 1, 2009, at 7:58 AM, Jim Grosbach wrote:
>>>
>>>> O
>>>>>
>>>>>
>>>>> Is this necessary? DwarfException should be using SubprogramCount,
>>>>> no?
>>>>
>>>> I'd turn the question around. Why is DwarfException adding its own
>>>> function counter when one is already available? Is there a reason
>>>> we need two that are doing the same thing?
>>>
>>> These counters should stay private within the class. It's
>>> implementation detail, not to be exposed publicly. DwarfException
>>> and AsmPrinter counter do not have to be the same, right?
>>
>> I could use FunctionNumber in the ARM AsmPrinter, and then use
>> SubprogramCount in the DwarfException printer. That makes me nervous,
>> though, as there's no guarantee, beyond details of the  
>> implementation,
>> that those two values will always stay in sync. It would introduce an
>> additional level of coupling between the two that I'd prefer to  
>> avoid.
>>
>> Note that the SubprogramCount is not visible to the containing
>> AsmPrinter, either. In the ARM AsmPrinter, the DwarfException is
>> opaque. Exposing that value to the rest of the AsmPrinter would be
>> more significant changes than exposing the FunctionNumber.
>>
>> I want to make sure that both bits of code pulled the information  
>> from
>> the same place. Exposing the FunctionNumber seems the way to do that.
>>
>
> Just to clarify and make sure we're on the same page...
>
> I do agree that exposing getFunctionNumber() is not a perfect  
> solution. I just think relying on the SubprogramCount staying in  
> sync with the FunctionNumber is even less attractive.
>
> I would prefer to have a single source for that information rather  
> than duplicating the counter. I really don't have any strong  
> feelings about where that belongs. Exposing getFunctionNumber() was  
> simply the least intrusive mechanism. Perhaps there's an appropriate  
> place for a private API that both the AsmPrinter and the DwarfWriter  
> can use?
>
> If you have a preference for an alternative, I'm glad to revisit and  
> work things differently.

Can you give an example of what the .s looks like? I don't think I  
understand why the function number is needed.

Evan

>
> -j
>
>
>
>>
>>> Evan
>>>
>>>>
>>>> The constant pool entry is part of the ARM AsmPrinter, which has
>>>> the getFunctionNumber() directly. It's the most straightforward
>>>> solution for the Dwarf writer to use the same interface to output
>>>> the table itself.
>>>>
>>>>>
>>>>>
>>>>>> /// IncrementFunctionNumber - Increase Function Number.
>>>>>> AsmPrinters should
>>>>>> /// not normally call this, as the counter is automatically
>>>>>> bumped by
>>>>>> /// SetupMachineFunction.
>>>>>>
>>>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp
>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=80649&r1=80648&r2=80649&view=diff
>>>>>>
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> = 
>>>>>> = 
>>>>>> =================================================================
>>>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp  
>>>>>> (original)
>>>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Mon Aug
>>>>>> 31 20:57:56 2009
>>>>>> @@ -25,9 +25,11 @@
>>>>>> #include "llvm/Target/TargetOptions.h"
>>>>>> #include "llvm/Target/TargetRegisterInfo.h"
>>>>>> #include "llvm/Support/Dwarf.h"
>>>>>> +#include "llvm/Support/Mangler.h"
>>>>>> #include "llvm/Support/Timer.h"
>>>>>> #include "llvm/Support/raw_ostream.h"
>>>>>> #include "llvm/ADT/StringExtras.h"
>>>>>> +#include <sstream>
>>>>>> using namespace llvm;
>>>>>>
>>>>>> static TimerGroup &getDwarfTimerGroup() {
>>>>>> @@ -599,9 +601,12 @@
>>>>>>
>>>>>> EmitLabel("exception", SubprogramCount);
>>>>>> if (MAI->getExceptionHandlingType() == ExceptionHandling::SjLj) {
>>>>>> -    std::string SjLjName = "_lsda_";
>>>>>> -    SjLjName += MF->getFunction()->getName().str();
>>>>>> -    EmitLabel(SjLjName.c_str(), 0);
>>>>>> +    std::stringstream out;
>>>>>> +    out << Asm->getFunctionNumber();
>>>>>
>>>>> SubprogramCount?
>>>>>
>>>>>> +    std::string LSDAName =
>>>>>> +      Asm->Mang->makeNameProper(std::string("LSDA_") +  
>>>>>> out.str(),
>>>>>> +                                Mangler::Private);
>>>>>> +    EmitLabel(LSDAName.c_str(), 0, false);
>>>>>
>>>>> Rather than making arbitrary change Dwarf::PrintLabelName and
>>>>> Dwarf::EmitLabel to accommodate this, why not just do
>>>>> out <<  LSDAName << 0 << ":\n";
>>>>
>>>> Simply consistency that labels get printed via EmitLabel. No strong
>>>> preference either way. I'll change it.
>>>>
>>>>>
>>>>> Evan
>>>>>
>>>>>> }
>>>>>>
>>>>>> // Emit the header.
>>>>>>
>>>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp?rev=80649&r1=80648&r2=80649&view=diff
>>>>>>
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> = 
>>>>>> = 
>>>>>> =================================================================
>>>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp (original)
>>>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Mon Aug 31
>>>>>> 20:57:56 2009
>>>>>> @@ -43,21 +43,27 @@
>>>>>>
>>>>>> /// PrintLabelName - Print label name in form used by Dwarf  
>>>>>> writer.
>>>>>> ///
>>>>>> -void Dwarf::PrintLabelName(const char *Tag, unsigned Number)
>>>>>> const {
>>>>>> -  O << MAI->getPrivateGlobalPrefix() << Tag;
>>>>>> +void Dwarf::PrintLabelName(const char *Tag, unsigned Number,
>>>>>> +                           bool ForcePrivate) const {
>>>>>> +  if (ForcePrivate)
>>>>>> +    O << MAI->getPrivateGlobalPrefix();
>>>>>> +  O << Tag;
>>>>>> if (Number) O << Number;
>>>>>> }
>>>>>> void Dwarf::PrintLabelName(const char *Tag, unsigned Number,
>>>>>> -                           const char *Suffix) const {
>>>>>> -  O << MAI->getPrivateGlobalPrefix() << Tag;
>>>>>> +                           const char *Suffix, bool
>>>>>> ForcePrivate) const {
>>>>>> +  if (ForcePrivate)
>>>>>> +    O << MAI->getPrivateGlobalPrefix();
>>>>>> +  O << Tag;
>>>>>> if (Number) O << Number;
>>>>>> O << Suffix;
>>>>>> }
>>>>>>
>>>>>> /// EmitLabel - Emit location label for internal use by Dwarf.
>>>>>> ///
>>>>>> -void Dwarf::EmitLabel(const char *Tag, unsigned Number) const {
>>>>>> -  PrintLabelName(Tag, Number);
>>>>>> +void Dwarf::EmitLabel(const char *Tag, unsigned Number,
>>>>>> +                      bool ForcePrivate) const {
>>>>>> +  PrintLabelName(Tag, Number, ForcePrivate);
>>>>>> O << ":\n";
>>>>>> }
>>>>>>
>>>>>>
>>>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h
>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h?rev=80649&r1=80648&r2=80649&view=diff
>>>>>>
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> = 
>>>>>> = 
>>>>>> =================================================================
>>>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h (original)
>>>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h Mon Aug 31
>>>>>> 20:57:56 2009
>>>>>> @@ -100,16 +100,18 @@
>>>>>> void PrintLabelName(const DWLabel &Label) const {
>>>>>>  PrintLabelName(Label.getTag(), Label.getNumber());
>>>>>> }
>>>>>> -    void PrintLabelName(const char *Tag, unsigned Number) const;
>>>>>> void PrintLabelName(const char *Tag, unsigned Number,
>>>>>> -                        const char *Suffix) const;
>>>>>> +                        bool ForcePrivate = true) const;
>>>>>> +    void PrintLabelName(const char *Tag, unsigned Number,
>>>>>> +                        const char *Suffix, bool ForcePrivate =
>>>>>> true) const;
>>>>>>
>>>>>> /// EmitLabel - Emit location label for internal use by Dwarf.
>>>>>> ///
>>>>>> void EmitLabel(const DWLabel &Label) const {
>>>>>>  EmitLabel(Label.getTag(), Label.getNumber());
>>>>>> }
>>>>>> -    void EmitLabel(const char *Tag, unsigned Number) const;
>>>>>> +    void EmitLabel(const char *Tag, unsigned Number,
>>>>>> +                   bool ForcePrivate = true) const;
>>>>>>
>>>>>> /// EmitReference - Emit a reference to a label.
>>>>>> ///
>>>>>>
>>>>>> Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp
>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp?rev=80649&r1=80648&r2=80649&view=diff
>>>>>>
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> = 
>>>>>> = 
>>>>>> =================================================================
>>>>>> --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp (original)
>>>>>> +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp Mon Aug 31
>>>>>> 20:57:56 2009
>>>>>> @@ -20,11 +20,12 @@
>>>>>> using namespace llvm;
>>>>>>
>>>>>> ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv,
>>>>>> unsigned id,
>>>>>> +                                           ARMCP::ARMCPKind K,
>>>>>>                                       unsigned char PCAdj,
>>>>>>                                       const char *Modif,
>>>>>>                                       bool AddCA)
>>>>>> : MachineConstantPoolValue((const Type*)gv->getType()),
>>>>>> -    GV(gv), S(NULL), LabelId(id), PCAdjust(PCAdj),
>>>>>> +    GV(gv), S(NULL), LabelId(id), Kind(K), PCAdjust(PCAdj),
>>>>>> Modifier(Modif), AddCurrentAddress(AddCA) {}
>>>>>>
>>>>>> ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C,
>>>>>> @@ -33,12 +34,12 @@
>>>>>>                                       const char *Modif,
>>>>>>                                       bool AddCA)
>>>>>> : MachineConstantPoolValue((const Type*)Type::getInt32Ty(C)),
>>>>>> -    GV(NULL), S(strdup(s)), LabelId(id), PCAdjust(PCAdj),
>>>>>> +    GV(NULL), S(strdup(s)), LabelId(id), Kind(ARMCP::CPValue),
>>>>>> PCAdjust(PCAdj),
>>>>>> Modifier(Modif), AddCurrentAddress(AddCA) {}
>>>>>>
>>>>>> ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, const
>>>>>> char *Modif)
>>>>>> : MachineConstantPoolValue((const Type*)Type::getInt32Ty(gv-
>>>>>>> getContext())),
>>>>>> -    GV(gv), S(NULL), LabelId(0), PCAdjust(0),
>>>>>> +    GV(gv), S(NULL), Kind(ARMCP::CPValue), LabelId(0), PCAdjust
>>>>>> (0),
>>>>>> Modifier(Modif) {}
>>>>>>
>>>>>> int ARMConstantPoolValue::getExistingMachineCPValue
>>>>>> (MachineConstantPool *CP,
>>>>>>
>>>>>> Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h
>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h?rev=80649&r1=80648&r2=80649&view=diff
>>>>>>
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> = 
>>>>>> = 
>>>>>> =================================================================
>>>>>> --- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h (original)
>>>>>> +++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h Mon Aug 31
>>>>>> 20:57:56 2009
>>>>>> @@ -21,12 +21,20 @@
>>>>>> class GlobalValue;
>>>>>> class LLVMContext;
>>>>>>
>>>>>> +namespace ARMCP {
>>>>>> +  enum ARMCPKind {
>>>>>> +    CPValue,
>>>>>> +    CPLSDA
>>>>>> +  };
>>>>>> +}
>>>>>> +
>>>>>> /// ARMConstantPoolValue - ARM specific constantpool value. This
>>>>>> is used to
>>>>>> /// represent PC relative displacement between the address of the
>>>>>> load
>>>>>> /// instruction and the global value being loaded, i.e. (&GV- 
>>>>>> (LPIC
>>>>>> +8)).
>>>>>> class ARMConstantPoolValue : public MachineConstantPoolValue {
>>>>>> GlobalValue *GV;         // GlobalValue being loaded.
>>>>>> const char *S;           // ExtSymbol being loaded.
>>>>>> +  ARMCP::ARMCPKind Kind;   // Value or LSDA?
>>>>>> unsigned LabelId;        // Label id of the load.
>>>>>> unsigned char PCAdjust;  // Extra adjustment if constantpool is
>>>>>> pc relative.
>>>>>>                       // 8 for ARM, 4 for Thumb.
>>>>>> @@ -35,6 +43,7 @@
>>>>>>
>>>>>> public:
>>>>>> ARMConstantPoolValue(GlobalValue *gv, unsigned id,
>>>>>> +                       ARMCP::ARMCPKind Kind = ARMCP::CPValue,
>>>>>>                   unsigned char PCAdj = 0, const char *Modifier
>>>>>> = NULL,
>>>>>>                   bool AddCurrentAddress = false);
>>>>>> ARMConstantPoolValue(LLVMContext &C, const char *s, unsigned id,
>>>>>> @@ -52,6 +61,7 @@
>>>>>> bool mustAddCurrentAddress() const { return AddCurrentAddress; }
>>>>>> unsigned getLabelId() const { return LabelId; }
>>>>>> unsigned char getPCAdjustment() const { return PCAdjust; }
>>>>>> +  bool isLSDA() { return Kind == ARMCP::CPLSDA; }
>>>>>>
>>>>>> virtual unsigned getRelocationInfo() const {
>>>>>> // FIXME: This is conservatively claiming that these entries
>>>>>> require a
>>>>>>
>>>>>> Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=80649&r1=80648&r2=80649&view=diff
>>>>>>
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> = 
>>>>>> = 
>>>>>> =================================================================
>>>>>> --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
>>>>>> +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Aug 31
>>>>>> 20:57:56 2009
>>>>>> @@ -40,6 +40,7 @@
>>>>>> #include "llvm/ADT/VectorExtras.h"
>>>>>> #include "llvm/Support/ErrorHandling.h"
>>>>>> #include "llvm/Support/MathExtras.h"
>>>>>> +#include <sstream>
>>>>>> using namespace llvm;
>>>>>>
>>>>>> static bool CC_ARM_APCS_Custom_f64(unsigned &ValNo, EVT &ValVT,
>>>>>> EVT &LocVT,
>>>>>> @@ -969,7 +970,8 @@
>>>>>> // tBX takes a register source operand.
>>>>>> if (isARMFunc && Subtarget->isThumb1Only() && !Subtarget-
>>>>>>> hasV5TOps()) {
>>>>>>  ARMConstantPoolValue *CPV = new ARMConstantPoolValue(GV,
>>>>>> -
>>>>>> ARMPCLabelIndex, 4);
>>>>>> +
>>>>>> ARMPCLabelIndex,
>>>>>> +
>>>>>> ARMCP::CPValue, 4);
>>>>>>  SDValue CPAddr = DAG.getTargetConstantPool(CPV, getPointerTy
>>>>>> (), 4);
>>>>>>  CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
>>>>>>  Callee = DAG.getLoad(getPointerTy(), dl,
>>>>>> @@ -1166,7 +1168,7 @@
>>>>>> unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8;
>>>>>> ARMConstantPoolValue *CPV =
>>>>>> new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex,
>>>>>> -                             PCAdj, "tlsgd", true);
>>>>>> +                             ARMCP::CPValue, PCAdj, "tlsgd",
>>>>>> true);
>>>>>> SDValue Argument = DAG.getTargetConstantPool(CPV, PtrVT, 4);
>>>>>> Argument = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Argument);
>>>>>> Argument = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), Argument,
>>>>>> NULL, 0);
>>>>>> @@ -1208,7 +1210,7 @@
>>>>>> unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8;
>>>>>> ARMConstantPoolValue *CPV =
>>>>>>  new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex,
>>>>>> -                               PCAdj, "gottpoff", true);
>>>>>> +                               ARMCP::CPValue, PCAdj,
>>>>>> "gottpoff", true);
>>>>>> Offset = DAG.getTargetConstantPool(CPV, PtrVT, 4);
>>>>>> Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset);
>>>>>> Offset = DAG.getLoad(PtrVT, dl, Chain, Offset, NULL, 0);
>>>>>> @@ -1284,7 +1286,7 @@
>>>>>> else {
>>>>>> unsigned PCAdj = (RelocM != Reloc::PIC_) ? 0 : (Subtarget-
>>>>>>> isThumb()?4:8);
>>>>>> ARMConstantPoolValue *CPV =
>>>>>> -      new ARMConstantPoolValue(GV, ARMPCLabelIndex, PCAdj);
>>>>>> +      new ARMConstantPoolValue(GV, ARMPCLabelIndex,
>>>>>> ARMCP::CPValue, PCAdj);
>>>>>> CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4);
>>>>>> }
>>>>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
>>>>>> @@ -1375,10 +1377,6 @@
>>>>>> return DAG.getNode(ARMISD::THREAD_POINTER, dl, PtrVT);
>>>>>> }
>>>>>> case Intrinsic::eh_sjlj_lsda: {
>>>>>> -    // blah. horrible, horrible hack with the forced magic name.
>>>>>> -    // really need to clean this up. It belongs in the target-
>>>>>> independent
>>>>>> -    // layer somehow that doesn't require the coupling with the
>>>>>> asm
>>>>>> -    // printer.
>>>>>> MachineFunction &MF = DAG.getMachineFunction();
>>>>>> EVT PtrVT = getPointerTy();
>>>>>> DebugLoc dl = Op.getDebugLoc();
>>>>>> @@ -1386,13 +1384,9 @@
>>>>>> SDValue CPAddr;
>>>>>> unsigned PCAdj = (RelocM != Reloc::PIC_)
>>>>>>  ? 0 : (Subtarget->isThumb() ? 4 : 8);
>>>>>> -    // Save off the LSDA name for the AsmPrinter to use when
>>>>>> it's time
>>>>>> -    // to emit the table
>>>>>> -    std::string LSDAName = "L_lsda_";
>>>>>> -    LSDAName += MF.getFunction()->getName();
>>>>>> ARMConstantPoolValue *CPV =
>>>>>> -      new ARMConstantPoolValue(*DAG.getContext(), LSDAName.c_str
>>>>>> (),
>>>>>> -                               ARMPCLabelIndex, PCAdj);
>>>>>> +      new ARMConstantPoolValue(MF.getFunction(),  
>>>>>> ARMPCLabelIndex,
>>>>>> +                               ARMCP::CPLSDA, PCAdj);
>>>>>> CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4);
>>>>>> CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
>>>>>> SDValue Result =
>>>>>>
>>>>>> 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=80649&r1=80648&r2=80649&view=diff
>>>>>>
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> = 
>>>>>> = 
>>>>>> =================================================================
>>>>>> --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
>>>>>> (original)
>>>>>> +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Mon
>>>>>> Aug 31 20:57:56 2009
>>>>>> @@ -44,6 +44,7 @@
>>>>>> #include "llvm/Support/MathExtras.h"
>>>>>> #include "llvm/Support/FormattedStream.h"
>>>>>> #include <cctype>
>>>>>> +#include <sstream>
>>>>>> using namespace llvm;
>>>>>>
>>>>>> STATISTIC(EmittedInsts, "Number of machine instrs printed");
>>>>>> @@ -159,8 +160,13 @@
>>>>>>  ARMConstantPoolValue *ACPV = static_cast<ARMConstantPoolValue*>
>>>>>> (MCPV);
>>>>>>  GlobalValue *GV = ACPV->getGV();
>>>>>>  std::string Name;
>>>>>> -
>>>>>> -      if (GV) {
>>>>>> +
>>>>>> +      if (ACPV->isLSDA()) {
>>>>>> +        std::stringstream out;
>>>>>> +        out << getFunctionNumber();
>>>>>> +        Name = Mang->makeNameProper(std::string("LSDA_") +
>>>>>> out.str(),
>>>>>> +                                    Mangler::Private);
>>>>>> +      } else if (GV) {
>>>>>>    bool isIndirect = Subtarget->isTargetDarwin() &&
>>>>>>      Subtarget->GVIsIndirectSymbol(GV,
>>>>>>                                    TM.getRelocationModel() ==
>>>>>> Reloc::Static);
>>>>>> @@ -175,9 +181,7 @@
>>>>>>      else
>>>>>>        GVNonLazyPtrs[SymName] = Name;
>>>>>>    }
>>>>>> -      } else if (!strncmp(ACPV->getSymbol(), "L_lsda_", 7))
>>>>>> -        Name = ACPV->getSymbol();
>>>>>> -      else
>>>>>> +      } else
>>>>>>    Name = Mang->makeNameProper(ACPV->getSymbol());
>>>>>>  O << Name;
>>>>>>
>>>>>>
>>>>>> Added: llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll
>>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll?rev=80649&view=auto
>>>>>>
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> =
>>>>>> = 
>>>>>> = 
>>>>>> =================================================================
>>>>>> --- llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll (added)
>>>>>> +++ llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll Mon Aug
>>>>>> 31 20:57:56 2009
>>>>>> @@ -0,0 +1,103 @@
>>>>>> +; RUN: llvm-as < %s | llc -march=arm -f | FileCheck %s
>>>>>> +
>>>>>> +%struct.A = type { i32* }
>>>>>> +
>>>>>> +define arm_apcscc void @"\01-[MyFunction Name:]"() {
>>>>>> +entry:
>>>>>> +  %save_filt.1 = alloca i32                       ; <i32*>
>>>>>> [#uses=2]
>>>>>> +  %save_eptr.0 = alloca i8*                       ; <i8**>
>>>>>> [#uses=2]
>>>>>> +  %a = alloca %struct.A                           ; <%struct.A*>
>>>>>> [#uses=3]
>>>>>> +  %eh_exception = alloca i8*                      ; <i8**>
>>>>>> [#uses=5]
>>>>>> +  %eh_selector = alloca i32                       ; <i32*>
>>>>>> [#uses=3]
>>>>>> +  %"alloca point" = bitcast i32 0 to i32          ; <i32>
>>>>>> [#uses=0]
>>>>>> +  call arm_apcscc  void @_ZN1AC1Ev(%struct.A* %a)
>>>>>> +  invoke arm_apcscc  void @_Z3barv()
>>>>>> +          to label %invcont unwind label %lpad
>>>>>> +
>>>>>> +invcont:                                          ; preds =  
>>>>>> %entry
>>>>>> +  call arm_apcscc  void @_ZN1AD1Ev(%struct.A* %a) nounwind
>>>>>> +  br label %return
>>>>>> +
>>>>>> +bb:                                               ; preds =  
>>>>>> %ppad
>>>>>> +  %eh_select = load i32* %eh_selector             ; <i32>
>>>>>> [#uses=1]
>>>>>> +  store i32 %eh_select, i32* %save_filt.1, align 4
>>>>>> +  %eh_value = load i8** %eh_exception             ; <i8*>
>>>>>> [#uses=1]
>>>>>> +  store i8* %eh_value, i8** %save_eptr.0, align 4
>>>>>> +  call arm_apcscc  void @_ZN1AD1Ev(%struct.A* %a) nounwind
>>>>>> +  %0 = load i8** %save_eptr.0, align 4            ; <i8*>
>>>>>> [#uses=1]
>>>>>> +  store i8* %0, i8** %eh_exception, align 4
>>>>>> +  %1 = load i32* %save_filt.1, align 4            ; <i32>
>>>>>> [#uses=1]
>>>>>> +  store i32 %1, i32* %eh_selector, align 4
>>>>>> +  br label %Unwind
>>>>>> +
>>>>>> +return:                                           ; preds =
>>>>>> %invcont
>>>>>> +  ret void
>>>>>> +
>>>>>> +lpad:                                             ; preds =  
>>>>>> %entry
>>>>>> +  %eh_ptr = call i8* @llvm.eh.exception()         ; <i8*>
>>>>>> [#uses=1]
>>>>>> +  store i8* %eh_ptr, i8** %eh_exception
>>>>>> +  %eh_ptr1 = load i8** %eh_exception              ; <i8*>
>>>>>> [#uses=1]
>>>>>> +  %eh_select2 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32
>>>>>> (i8* %eh_ptr1, i8* bitcast (i32 (...)* @__gxx_personality_sj0 to
>>>>>> i8*), i32 0) ; <i32> [#uses=1]
>>>>>> +  store i32 %eh_select2, i32* %eh_selector
>>>>>> +  br label %ppad
>>>>>> +
>>>>>> +ppad:                                             ; preds =  
>>>>>> %lpad
>>>>>> +  br label %bb
>>>>>> +
>>>>>> +Unwind:                                           ; preds = %bb
>>>>>> +  %eh_ptr3 = load i8** %eh_exception              ; <i8*>
>>>>>> [#uses=1]
>>>>>> +  call arm_apcscc  void @_Unwind_SjLj_Resume(i8* %eh_ptr3)
>>>>>> +  unreachable
>>>>>> +}
>>>>>> +
>>>>>> +define linkonce_odr arm_apcscc void @_ZN1AC1Ev(%struct.A*  
>>>>>> %this) {
>>>>>> +entry:
>>>>>> +  %this_addr = alloca %struct.A*                  ; <
>>>>>> %struct.A**> [#uses=2]
>>>>>> +  %"alloca point" = bitcast i32 0 to i32          ; <i32>
>>>>>> [#uses=0]
>>>>>> +  store %struct.A* %this, %struct.A** %this_addr
>>>>>> +  %0 = call arm_apcscc  i8* @_Znwm(i32 4)         ; <i8*>
>>>>>> [#uses=1]
>>>>>> +  %1 = bitcast i8* %0 to i32*                     ; <i32*>
>>>>>> [#uses=1]
>>>>>> +  %2 = load %struct.A** %this_addr, align 4       ; <%struct.A*>
>>>>>> [#uses=1]
>>>>>> +  %3 = getelementptr inbounds %struct.A* %2, i32 0, i32 0 ;
>>>>>> <i32**> [#uses=1]
>>>>>> +  store i32* %1, i32** %3, align 4
>>>>>> +  br label %return
>>>>>> +
>>>>>> +return:                                           ; preds =  
>>>>>> %entry
>>>>>> +  ret void
>>>>>> +}
>>>>>> +
>>>>>> +declare arm_apcscc i8* @_Znwm(i32)
>>>>>> +
>>>>>> +define linkonce_odr arm_apcscc void @_ZN1AD1Ev(%struct.A* %this)
>>>>>> nounwind {
>>>>>> +entry:
>>>>>> +  %this_addr = alloca %struct.A*                  ; <
>>>>>> %struct.A**> [#uses=2]
>>>>>> +  %"alloca point" = bitcast i32 0 to i32          ; <i32>
>>>>>> [#uses=0]
>>>>>> +  store %struct.A* %this, %struct.A** %this_addr
>>>>>> +  %0 = load %struct.A** %this_addr, align 4       ; <%struct.A*>
>>>>>> [#uses=1]
>>>>>> +  %1 = getelementptr inbounds %struct.A* %0, i32 0, i32 0 ;
>>>>>> <i32**> [#uses=1]
>>>>>> +  %2 = load i32** %1, align 4                     ; <i32*>
>>>>>> [#uses=1]
>>>>>> +  %3 = bitcast i32* %2 to i8*                     ; <i8*>
>>>>>> [#uses=1]
>>>>>> +  call arm_apcscc  void @_ZdlPv(i8* %3) nounwind
>>>>>> +  br label %bb
>>>>>> +
>>>>>> +bb:                                               ; preds =  
>>>>>> %entry
>>>>>> +  br label %return
>>>>>> +
>>>>>> +return:                                           ; preds = %bb
>>>>>> +  ret void
>>>>>> +}
>>>>>> +;CHECK: L_LSDA_1:
>>>>>> +
>>>>>> +declare arm_apcscc void @_ZdlPv(i8*) nounwind
>>>>>> +
>>>>>> +declare arm_apcscc void @_Z3barv()
>>>>>> +
>>>>>> +declare i8* @llvm.eh.exception() nounwind
>>>>>> +
>>>>>> +declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) nounwind
>>>>>> +
>>>>>> +declare i32 @llvm.eh.typeid.for.i32(i8*) nounwind
>>>>>> +
>>>>>> +declare arm_apcscc i32 @__gxx_personality_sj0(...)
>>>>>> +
>>>>>> +declare arm_apcscc void @_Unwind_SjLj_Resume(i8*)
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> 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