Skip to content
  1. May 16, 2010
  2. May 15, 2010
    • John McCall's avatar
      Substantially alter the design of the Objective C type AST by introducing · 8b07ec25
      John McCall authored
      ObjCObjectType, which is basically just a pair of
        one of {primitive-id, primitive-Class, user-defined @class}
      with
        a list of protocols.
      An ObjCObjectPointerType is therefore just a pointer which always points to
      one of these types (possibly sugared).  ObjCInterfaceType is now just a kind
      of ObjCObjectType which happens to not carry any protocols.
      
      Alter a rather large number of use sites to use ObjCObjectType instead of
      ObjCInterfaceType.  Store an ObjCInterfaceType as a pointer on the decl rather
      than hashing them in a FoldingSet.  Remove some number of methods that are no
      longer used, at least after this patch.
      
      By simplifying ObjCObjectPointerType, we are now able to easily remove and apply
      pointers to Objective-C types, which is crucial for a certain kind of ObjC++
      metaprogramming common in WebKit.
      
      llvm-svn: 103870
      8b07ec25
    • Douglas Gregor's avatar
      Implement a simple form of the C++ named return value optimization for · 290c93ec
      Douglas Gregor authored
      return statements. We perform NRVO only when all of the return
      statements in the function return the same variable. Fixes some link
      failures in Boost.Interprocess (which is relying on NRVO), and
      probably improves performance for some C++ applications.
      
      llvm-svn: 103867
      290c93ec
    • Douglas Gregor's avatar
      Implement semantic analysis and an AST representation for the named · 6fd1b180
      Douglas Gregor authored
      return value optimization. Sema marks return statements with their
      NRVO candidates (which may or may not end up using the NRVO), then, at
      the end of a function body, computes and marks those variables that
      can be allocated into the return slot.
      
      I've checked this locally with some debugging statements (not
      committed), but there won't be any tests until CodeGen comes along.
      
      llvm-svn: 103865
      6fd1b180
    • Douglas Gregor's avatar
      Recognize when the named return value optimization applies in a · 222cf0ef
      Douglas Gregor authored
      "return" statement and mark the corresponding CXXConstructExpr as
      elidable. Teach CodeGen that eliding a temporary is different from
      eliding an object construction.
      
      This is just a baby step toward NRVO.
      
      llvm-svn: 103849
      222cf0ef
  3. May 14, 2010
  4. May 13, 2010
    • Fariborz Jahanian's avatar
      Objective-C++ Sema. Fix a bug in instantiation of receivers. · 1bd96d13
      Fariborz Jahanian authored
      Completes radar 7963410.
      
      llvm-svn: 103719
      1bd96d13
    • Douglas Gregor's avatar
      Rework when and how vtables are emitted, by tracking where vtables are · 88d292cc
      Douglas Gregor authored
      "used" (e.g., we will refer to the vtable in the generated code) and
      when they are defined (i.e., because we've seen the key function
      definition). Previously, we were effectively tracking "potential
      definitions" rather than uses, so we were a bit too eager about emitting
      vtables for classes without key functions. 
      
      The new scheme:
        - For every use of a vtable, Sema calls MarkVTableUsed() to indicate
        the use. For example, this occurs when calling a virtual member
        function of the class, defining a constructor of that class type,
        dynamic_cast'ing from that type to a derived class, casting
        to/through a virtual base class, etc.
        - For every definition of a vtable, Sema calls MarkVTableUsed() to
        indicate the definition. This happens at the end of the translation
        unit for classes whose key function has been defined (so we can
        delay computation of the key function; see PR6564), and will also
        occur with explicit template instantiation definitions.
       - For every vtable defined/used, we mark all of the virtual member
       functions of that vtable as defined/used, unless we know that the key
       function is in another translation unit. This instantiates virtual
       member functions when needed.
        - At the end of the translation unit, Sema tells CodeGen (via the
        ASTConsumer) which vtables must be defined (CodeGen will define
        them) and which may be used (for which CodeGen will define the
        vtables lazily). 
      
      From a language perspective, both the old and the new schemes are
      permissible: we're allowed to instantiate virtual member functions
      whenever we want per the standard. However, all other C++ compilers
      were more lazy than we were, and our eagerness was both a performance
      issue (we instantiated too much) and a portability problem (we broke
      Boost test cases, which now pass).
      
      Notes:
        (1) There's a ton of churn in the tests, because the order in which
        vtables get emitted to IR has changed. I've tried to isolate some of
        the larger tests from these issues.
        (2) Some diagnostics related to
        implicitly-instantiated/implicitly-defined virtual member functions
        have moved to the point of first use/definition. It's better this
        way.
        (3) I could use a review of the places where we MarkVTableUsed, to
        see if I missed any place where the language effectively requires a
        vtable.
      
      Fixes PR7114 and PR6564.
      
      llvm-svn: 103718
      88d292cc
    • John McCall's avatar
      Rebuild builtin_id * as an ObjCObjectPointerType, where builtin_id is the · 01f21ad9
      John McCall authored
      magic type that 'id' is a pointer to.
      
      llvm-svn: 103708
      01f21ad9
    • John McCall's avatar
      When performing template argument deduction, match Objective C pointers · bb4ea81a
      John McCall authored
      against pointer patterns.
      
      llvm-svn: 103706
      bb4ea81a
    • Chandler Carruth's avatar
      Delete a dead function at sabre's request. · 7100860e
      Chandler Carruth authored
      llvm-svn: 103705
      7100860e
    • Fariborz Jahanian's avatar
      Objective-C++ Sema. Support for conversion of a C++ · cac49a8f
      Fariborz Jahanian authored
      class object used as a receiver to an objective-c
      pointer via a converwsion function. wip.
      
      llvm-svn: 103672
      cac49a8f
    • Chris Lattner's avatar
      improve comments. · 5c02c2af
      Chris Lattner authored
      llvm-svn: 103670
      5c02c2af
  5. May 12, 2010
    • Fariborz Jahanian's avatar
      Objective-C++ Sema - Allow static_cast of one objc pointer to · b0901b79
      Fariborz Jahanian authored
      another.
      
      llvm-svn: 103630
      b0901b79
    • Douglas Gregor's avatar
      Whenever we instantiate a function definition or class, enter a new · 17158425
      Douglas Gregor authored
      potentially-evaluated expression context, to ensure that used
      declarations get properly marked. Fixes PR7123.
      
      llvm-svn: 103624
      17158425
    • Douglas Gregor's avatar
      When we emit an error during the implicit definition of a special · 54818f0c
      Douglas Gregor authored
      member function (default constructor, copy constructor, copy
      assignment operator, destructor), emit a note showing where that
      implicit definition was required.
      
      llvm-svn: 103619
      54818f0c
    • John McCall's avatar
      Improve commentary on the indirect-goto jump scope checker and extract · 42f9f1f1
      John McCall authored
      a convenience routine to find the innermost common ancestor of two scopes.
      
      llvm-svn: 103565
      42f9f1f1
    • John McCall's avatar
      When checking scopes for indirect goto, be more permissive (but still safe) · cf819ab3
      John McCall authored
      about the permitted scopes.  Specifically:
        1) Permit labels and gotos to appear after a prologue of variable initializations.
        2) Permit indirect gotos to jump out of scopes that don't require cleanup.
        3) Diagnose possible attempts to indirect-jump out of scopes that do require
           cleanup.
      This requires a substantial reinvention of the algorithm for checking indirect
      goto.  The current algorithm is Omega(M*N), with M = the number of unique
      scopes being jumped from and N = the number of unique scopes being jumped to,
      with an additional factor that is probably (worst-case) linear in the depth
      of scopes.  Thus the entire thing is likely cubic given some truly bizarre
      ill-formed code;  on well-formed code the additional factor collapses to
      an amortized constant (when amortized over the entire function) and so
      the algorithm is quadratic.  Even this requires every label to appear in
      its own scope, which would be very unusual for indirect-goto code (and
      extremely unlikely for well-formed code);  it is far more likely that
      all labels will be in the same scope and so the algorithm becomes linear.
      For such a marginal feature, I am fairly happy with this result.
      
      (this is using JumpDiagnostic's definition of scope, where successive
      variables in a block appear in their own scope)
      
      llvm-svn: 103536
      cf819ab3
  6. May 11, 2010
  7. May 09, 2010
  8. May 08, 2010
Loading