Skip to content
  1. Oct 14, 2016
  2. Jul 19, 2016
  3. Jun 22, 2016
    • Peter Collingbourne's avatar
      IR: Allow metadata attachments on declarations, and fix lazy loaded metadata issue with globals. · 21521891
      Peter Collingbourne authored
      This change is motivated by an upcoming change to the metadata representation
      used for CFI. The indirect function call checker needs type information for
      external function declarations in order to correctly generate jump table
      entries for such declarations. We currently associate such type information
      with declarations using a global metadata node, but I plan [1] to move all
      such metadata to global object attachments.
      
      In bitcode, metadata attachments for function declarations appear in the
      global metadata block. This seems reasonable to me because I expect metadata
      attachments on declarations to be uncommon. In the long term I'd also expect
      this to be the case for CFI, because we'd want to use some specialized bitcode
      format for this metadata that could be read as part of the ThinLTO thin-link
      phase, which would mean that it would not appear in the global metadata block.
      
      To solve the lazy loaded metadata issue I was seeing with D20147, I use the
      same bitcode representation for metadata attachments for global variables as I
      do for function declarations. Since there's a use case for metadata attachments
      in the global metadata block, we might as well use that representation for
      global variables as well, at least until we have a mechanism for lazy loading
      global variables.
      
      In the assembly format, the metadata attachments appear after the "declare"
      keyword in order to avoid a parsing ambiguity.
      
      [1] http://lists.llvm.org/pipermail/llvm-dev/2016-June/100462.html
      
      Differential Revision: http://reviews.llvm.org/D21052
      
      llvm-svn: 273336
      21521891
  4. Jun 14, 2016
    • Peter Collingbourne's avatar
      IR: Introduce local_unnamed_addr attribute. · 96efdd61
      Peter Collingbourne authored
      If a local_unnamed_addr attribute is attached to a global, the address
      is known to be insignificant within the module. It is distinct from the
      existing unnamed_addr attribute in that it only describes a local property
      of the module rather than a global property of the symbol.
      
      This attribute is intended to be used by the code generator and LTO to allow
      the linker to decide whether the global needs to be in the symbol table. It is
      possible to exclude a global from the symbol table if three things are true:
      - This attribute is present on every instance of the global (which means that
        the normal rule that the global must have a unique address can be broken without
        being observable by the program by performing comparisons against the global's
        address)
      - The global has linkonce_odr linkage (which means that each linkage unit must have
        its own copy of the global if it requires one, and the copy in each linkage unit
        must be the same)
      - It is a constant or a function (which means that the program cannot observe that
        the unique-address rule has been broken by writing to the global)
      
      Although this attribute could in principle be computed from the module
      contents, LTO clients (i.e. linkers) will normally need to be able to compute
      this property as part of symbol resolution, and it would be inefficient to
      materialize every module just to compute it.
      
      See:
      http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160509/356401.html
      http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160516/356738.html
      for earlier discussion.
      
      Part of the fix for PR27553.
      
      Differential Revision: http://reviews.llvm.org/D20348
      
      llvm-svn: 272709
      96efdd61
  5. Jun 01, 2016
  6. May 18, 2016
  7. Apr 06, 2016
  8. Feb 29, 2016
  9. Dec 04, 2015
    • Manman Ren's avatar
      [CXX TLS calling convention] Add CXX TLS calling convention. · 19c7bbe3
      Manman Ren authored
      This commit adds a new target-independent calling convention for C++ TLS
      access functions. It aims to minimize overhead in the caller by perserving as
      many registers as possible.
      
      The target-specific implementation for X86-64 is defined as following:
        Arguments are passed as for the default C calling convention
        The same applies for the return value(s)
        The callee preserves all GPRs - except RAX and RDI
      
      The access function makes C-style TLS function calls in the entry and exit
      block, C-style TLS functions save a lot more registers than normal calls.
      The added calling convention ties into the existing implementation of the
      C-style TLS functions, so we can't simply use existing calling conventions
      such as preserve_mostcc.
      
      rdar://9001553
      
      llvm-svn: 254737
      19c7bbe3
  10. Sep 12, 2015
  11. Jun 17, 2015
    • David Majnemer's avatar
      Move the personality function from LandingPadInst to Function · 7fddeccb
      David Majnemer authored
      The personality routine currently lives in the LandingPadInst.
      
      This isn't desirable because:
      - All LandingPadInsts in the same function must have the same
        personality routine.  This means that each LandingPadInst beyond the
        first has an operand which produces no additional information.
      
      - There is ongoing work to introduce EH IR constructs other than
        LandingPadInst.  Moving the personality routine off of any one
        particular Instruction and onto the parent function seems a lot better
        than have N different places a personality function can sneak onto an
        exceptional function.
      
      Differential Revision: http://reviews.llvm.org/D10429
      
      llvm-svn: 239940
      7fddeccb
  12. Feb 04, 2015
  13. Dec 03, 2014
    • Peter Collingbourne's avatar
      Prologue support · 51d2de7b
      Peter Collingbourne authored
      Patch by Ben Gamari!
      
      This redefines the `prefix` attribute introduced previously and
      introduces a `prologue` attribute.  There are a two primary usecases
      that these attributes aim to serve,
      
        1. Function prologue sigils
      
        2. Function hot-patching: Enable the user to insert `nop` operations
           at the beginning of the function which can later be safely replaced
           with a call to some instrumentation facility
      
        3. Runtime metadata: Allow a compiler to insert data for use by the
           runtime during execution. GHC is one example of a compiler that
           needs this functionality for its tables-next-to-code functionality.
      
      Previously `prefix` served cases (1) and (2) quite well by allowing the user
      to introduce arbitrary data at the entrypoint but before the function
      body. Case (3), however, was poorly handled by this approach as it
      required that prefix data was valid executable code.
      
      Here we redefine the notion of prefix data to instead be data which
      occurs immediately before the function entrypoint (i.e. the symbol
      address). Since prefix data now occurs before the function entrypoint,
      there is no need for the data to be valid code.
      
      The previous notion of prefix data now goes under the name "prologue
      data" to emphasize its duality with the function epilogue.
      
      The intention here is to handle cases (1) and (2) with prologue data and
      case (3) with prefix data.
      
      References
      ----------
      
      This idea arose out of discussions[1] with Reid Kleckner in response to a
      proposal to introduce the notion of symbol offsets to enable handling of
      case (3).
      
      [1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-May/073235.html
      
      Test Plan: testsuite
      
      Differential Revision: http://reviews.llvm.org/D6454
      
      llvm-svn: 223189
      51d2de7b
  14. Sep 18, 2014
  15. May 10, 2014
    • Reid Kleckner's avatar
      Revert "[ms-cxxabi] Add a new calling convention that swaps 'this' and 'sret'" · c487d73f
      Reid Kleckner authored
      This reverts commit r200561.
      
      This calling convention was an attempt to match the MSVC C++ ABI for
      methods that return structures by value.  This solution didn't scale,
      because it would have required splitting every CC available on Windows
      into two: one for methods and one for free functions.
      
      Now that we can put sret on the second arg (r208453), and Clang does
      that (r208458), revert this hack.
      
      llvm-svn: 208459
      c487d73f
  16. Mar 14, 2014
    • Rafael Espindola's avatar
      Remove the linker_private and linker_private_weak linkages. · 2fb5bc33
      Rafael Espindola authored
      These linkages were introduced some time ago, but it was never very
      clear what exactly their semantics were or what they should be used
      for. Some investigation found these uses:
      
      * utf-16 strings in clang.
      * non-unnamed_addr strings produced by the sanitizers.
      
      It turns out they were just working around a more fundamental problem.
      For some sections a MachO linker needs a symbol in order to split the
      section into atoms, and llvm had no idea that was the case. I fixed
      that in r201700 and it is now safe to use the private linkage. When
      the object ends up in a section that requires symbols, llvm will use a
      'l' prefix instead of a 'L' prefix and things just work.
      
      With that, these linkages were already dead, but there was a potential
      future user in the objc metadata information. I am still looking at
      CGObjcMac.cpp, but at this point I am convinced that linker_private
      and linker_private_weak are not what they need.
      
      The objc uses are currently split in
      
      * Regular symbols (no '\01' prefix). LLVM already directly provides
      whatever semantics they need.
      * Uses of a private name (start with "\01L" or "\01l") and private
      linkage. We can drop the "\01L" and "\01l" prefixes as soon as llvm
      agrees with clang on L being ok or not for a given section. I have two
      patches in code review for this.
      * Uses of private name and weak linkage.
      
      The last case is the one that one could think would fit one of these
      linkages. That is not the case. The semantics are
      
      * the linker will merge these symbol by *name*.
      * the linker will hide them in the final DSO.
      
      Given that the merging is done by name, any of the private (or
      internal) linkages would be a bad match. They allow llvm to rename the
      symbols, and that is really not what we want. From the llvm point of
      view, these objects should really be (linkonce|weak)(_odr)?.
      
      For now, just keeping the "\01l" prefix is probably the best for these
      symbols. If we one day want to have a more direct support in llvm,
      IMHO what we should add is not a linkage, it is just a hidden_symbol
      attribute. It would be applicable to multiple linkages. For example,
      on weak it would produce the current behavior we have for objc
      metadata. On internal, it would be equivalent to private (and we
      should then remove private).
      
      llvm-svn: 203866
      2fb5bc33
  17. Mar 13, 2014
  18. Jan 31, 2014
    • Reid Kleckner's avatar
      [ms-cxxabi] Add a new calling convention that swaps 'this' and 'sret' · 1c843228
      Reid Kleckner authored
      MSVC always places the 'this' parameter for a method first.  The
      implicit 'sret' pointer for methods always comes second.  We already
      implement this for __thiscall by putting sret parameters on the stack,
      but __cdecl methods require putting both parameters on the stack in
      opposite order.
      
      Using a special calling convention allows frontends to keep the sret
      parameter first, which avoids breaking lots of assumptions in LLVM and
      Clang.
      
      Fixes PR15768 with the corresponding change in Clang.
      
      Reviewers: ributzka, majnemer
      
      Differential Revision: http://llvm-reviews.chandlerc.com/D2663
      
      llvm-svn: 200561
      1c843228
  19. Jan 17, 2014
    • Juergen Ributzka's avatar
      Add two new calling conventions for runtime calls · e6250130
      Juergen Ributzka authored
      This patch adds two new target-independent calling conventions for runtime
      calls - PreserveMost and PreserveAll.
      The target-specific implementation for X86-64 is defined as following:
        - Arguments are passed as for the default C calling convention
        - The same applies for the return value(s)
        - PreserveMost preserves all GPRs - except R11
        - PreserveAll preserves all GPRs and all XMMs/YMMs - except R11
      
      Reviewed by Lang and Philip
      
      llvm-svn: 199508
      e6250130
  20. Jan 14, 2014
    • Nico Rieck's avatar
      Decouple dllexport/dllimport from linkage · 7157bb76
      Nico Rieck authored
      Representing dllexport/dllimport as distinct linkage types prevents using
      these attributes on templates and inline functions.
      
      Instead of introducing further mixed linkage types to include linkonce and
      weak ODR, the old import/export linkage types are replaced with a new
      separate visibility-like specifier:
      
        define available_externally dllimport void @f() {}
        @Var = dllexport global i32 1, align 4
      
      Linkage for dllexported globals and functions is now equal to their linkage
      without dllexport. Imported globals and functions must be either
      declarations with external linkage, or definitions with
      AvailableExternallyLinkage.
      
      llvm-svn: 199218
      7157bb76
    • Nico Rieck's avatar
      Revert "Decouple dllexport/dllimport from linkage" · 9d2e0df0
      Nico Rieck authored
      Revert this for now until I fix an issue in Clang with it.
      
      This reverts commit r199204.
      
      llvm-svn: 199207
      9d2e0df0
    • Nico Rieck's avatar
      Decouple dllexport/dllimport from linkage · e43aaf79
      Nico Rieck authored
      Representing dllexport/dllimport as distinct linkage types prevents using
      these attributes on templates and inline functions.
      
      Instead of introducing further mixed linkage types to include linkonce and
      weak ODR, the old import/export linkage types are replaced with a new
      separate visibility-like specifier:
      
        define available_externally dllimport void @f() {}
        @Var = dllexport global i32 1, align 4
      
      Linkage for dllexported globals and functions is now equal to their linkage
      without dllexport. Imported globals and functions must be either
      declarations with external linkage, or definitions with
      AvailableExternallyLinkage.
      
      llvm-svn: 199204
      e43aaf79
  21. Jan 11, 2014
  22. Sep 16, 2013
  23. Jan 11, 2013
  24. Nov 20, 2012
  25. Oct 15, 2012
  26. Oct 12, 2012
  27. Jun 28, 2012
Loading