Skip to content
  1. Feb 22, 2014
    • Warren Hunt's avatar
      Complete Rewrite of CGRecordLayoutBuilder · fb00c887
      Warren Hunt authored
      CGRecordLayoutBuilder was aging, complex, multi-pass, and shows signs of 
      existing before ASTRecordLayoutBuilder.  It redundantly performed many 
      layout operations that are now performed by ASTRecordLayoutBuilder and 
      asserted that the results were the same.  With the addition of support 
      for the MS-ABI, such as placement of vbptrs, vtordisps, different 
      bitfield layout and a variety of other features, CGRecordLayoutBuilder 
      was growing unwieldy in its redundancy.
      
      This patch re-architects CGRecordLayoutBuilder to not perform any 
      redundant layout but rather, as directly as possible, lower an 
      ASTRecordLayout to an llvm::type.  The new architecture is significantly 
      smaller and simpler than the CGRecordLayoutBuilder and contains fewer 
      ABI-specific code paths.  It's also one pass.
      
      The architecture of the new system is described in the comments. For the 
      most part, the new system simply takes all of the fields and bases from 
      an ASTRecordLayout, sorts them, inserts padding and dumps a record. 
      Bitfields, unions and primary virtual bases make this process a bit more 
      complicated.  See the inline comments.
      
      In addition, this patch updates a few lit tests due to the fact that the 
      new system computes more accurate llvm types than CGRecordLayoutBuilder. 
      Each change is commented individually in the review.
      
      Differential Revision: http://llvm-reviews.chandlerc.com/D2795
      
      llvm-svn: 201907
      fb00c887
  2. Feb 21, 2014
    • Reid Kleckner's avatar
      MS ABI: Include the vfptr offset in memptrs to virtual methods · e4a5220d
      Reid Kleckner authored
      Virtual methods expect 'this' to point to the vfptr containing the
      virtual method, and this extends to virtual member pointer thunks.  The
      relevant vfptr is always at offset zero on entry to the thunk, and no
      this adjustment is needed.
      
      Previously we would not include the vfptr adjustment in the member
      pointer, and we'd look at the vfptr offset when loading from the vftable
      in the thunk.
      
      Fixes PR18917.
      
      llvm-svn: 201835
      e4a5220d
    • David Majnemer's avatar
      Sema: Do not assert when dereferencing member pointer using virtual... · 2b0d66df
      David Majnemer authored
      Sema: Do not assert when dereferencing member pointer using virtual inheritance with an incomplete class type
      
      The MS ABI requires that we determine the vbptr offset if have a
      virtual inheritance model.  Instead, raise an error pointing to the
      diagnostic when this happens.
      
      This fixes PR18583.
      
      Differential Revision: http://llvm-reviews.chandlerc.com/D2842
      
      llvm-svn: 201824
      2b0d66df
  3. Feb 19, 2014
    • Reid Kleckner's avatar
      MS ABI: Let non-virtual method overloads participate in vftable ordering · 6701de2a
      Reid Kleckner authored
      In the Microsoft ABI, the vftable is laid out as if all methods in every
      overload set were declared in reverse order of declaration at the point
      of declaration of the first overload in the set.
      
      Previously we only considered virtual methods in an overload set, but
      MSVC includes non-virtual methods for ordering purposes.
      
      Fixes PR18902.
      
      llvm-svn: 201722
      6701de2a
  4. Feb 18, 2014
  5. Feb 17, 2014
    • Bob Wilson's avatar
      Change PGO instrumentation to compute counts in a separate AST traversal. · bf854f0f
      Bob Wilson authored
      Previously, we made one traversal of the AST prior to codegen to assign
      counters to the ASTs and then propagated the count values during codegen. This
      patch now adds a separate AST traversal prior to codegen for the
      -fprofile-instr-use option to propagate the count values. The counts are then
      saved in a map from which they can be retrieved during codegen.
      
      This new approach has several advantages:
      
      1. It gets rid of a lot of extra PGO-related code that had previously been
      added to codegen.
      
      2. It fixes a serious bug. My original implementation (which was mailed to the
      list but never committed) used 3 counters for every loop. Justin improved it to
      move 2 of those counters into the less-frequently executed breaks and continues,
      but that turned out to produce wrong count values in some cases. The solution
      requires visiting a loop body before the condition so that the count for the
      condition properly includes the break and continue counts. Changing codegen to
      visit a loop body first would be a fairly invasive change, but with a separate
      AST traversal, it is easy to control the order of traversal. I've added a
      testcase (provided by Justin) to make sure this works correctly.
      
      3. It improves the instrumentation overhead, reducing the number of counters for
      a loop from 3 to 1. We no longer need dedicated counters for breaks and
      continues, since we can just use the propagated count values when visiting
      breaks and continues.
      
      To make this work, I needed to make a change to the way we count case
      statements, going back to my original approach of not including the fall-through
      in the counter values. This was necessary because there isn't always an AST node
      that can be used to record the fall-through count. Now case statements are
      handled the same as default statements, with the fall-through paths branching
      over the counter increments.  While I was at it, I also went back to using this
      approach for do-loops -- omitting the fall-through count into the loop body
      simplifies some of the calculations and make them behave the same as other
      loops. Whenever we start using this instrumentation for coverage, we'll need
      to add the fall-through counts into the counter values.
      
      llvm-svn: 201528
      bf854f0f
  6. Feb 16, 2014
  7. Feb 15, 2014
  8. Feb 12, 2014
  9. Feb 08, 2014
  10. Feb 06, 2014
  11. Feb 05, 2014
    • Reid Kleckner's avatar
      MS ABI: Fix mangling of static methods and function references · 09b47d16
      Reid Kleckner authored
      Function references always use $1? like function pointers and never $E?
      like var decl references.  Static methods are mangled like function
      pointers.
      
      llvm-svn: 200869
      09b47d16
    • Reid Kleckner's avatar
      MS ABI: Mangle member pointer template arguments · 96f8f933
      Reid Kleckner authored
      Member pointers are mangled as they would be represented at runtime.
      They can be a single integer literal, single decl, or a tuple with some
      more numbers tossed in.  With Clang today, most of those numbers will be
      zero because we reject pointers to members of virtual bases.
      
      This change required moving VTableContextBase ownership from
      CodeGenVTables to ASTContext, because mangling now depends on vtable
      layout.
      
      I also hoisted the inheritance model helpers up to be inline static
      methods of MSInheritanceAttr.  This makes the AST code that deals with
      member pointers much more readable.
      
      MSVC doesn't appear to have stable manglings of null member pointers:
      - Null data memptrs in function templates have a mangling collision with
        the first field of a non-polymorphic single inheritance class.
      - The mangling of null data memptrs changes if you add casts.
      - Large null function memptrs in class templates crash MSVC.
      
      Clang uses the class template mangling for null data memptrs and the
      function template mangling for null function memptrs to deal with this.
      
      Reviewers: majnemer
      
      Differential Revision: http://llvm-reviews.chandlerc.com/D2695
      
      llvm-svn: 200857
      96f8f933
    • Hans Wennborg's avatar
      Don't mark decls with mismatching exception specs invalid in MS mode (PR18683) · 39a509aa
      Hans Wennborg authored
      We accept these with a warning in MS mode, but we would previously mark them
      invalid, causing us not to emit code for them.
      
      Differential Revision: http://llvm-reviews.chandlerc.com/D2681
      
      llvm-svn: 200815
      39a509aa
    • David Blaikie's avatar
      Further simplify r200797 and add an explanatory comment. · 535083ef
      David Blaikie authored
      llvm-svn: 200805
      535083ef
  12. Feb 04, 2014
  13. Feb 03, 2014
  14. Feb 01, 2014
    • Reid Kleckner's avatar
      [ms-cxxabi] Use inalloca on win32 when passing non-trivial C++ objects · 314ef7ba
      Reid Kleckner authored
      When a non-trivial parameter is present, clang now gathers up all the
      parameters that lack inreg and puts them into a packed struct.  MSVC
      always aligns each parameter to 4 bytes and no more, so this is a pretty
      simple struct to lay out.
      
      On win64, non-trivial records are passed indirectly.  Prior to this
      change, clang was incorrectly using byval on win64.
      
      I'm able to self-host a working clang with this change and additional
      LLVM patches.
      
      Reviewers: rsmith
      
      Differential Revision: http://llvm-reviews.chandlerc.com/D2636
      
      llvm-svn: 200597
      314ef7ba
  15. Jan 31, 2014
  16. Jan 30, 2014
  17. Jan 29, 2014
  18. Jan 27, 2014
  19. Jan 24, 2014
  20. Jan 23, 2014
Loading