Skip to content
  1. Feb 11, 2014
    • Manman Ren's avatar
      LTO API: add lto_module_create_from_memory_with_path. · 03456a17
      Manman Ren authored
      This function adds an extra path argument to lto_module_create_from_memory.
      The path argument will be passed to makeBuffer to make sure the MemoryBuffer
      has a name and the created module has a module identifier.
      
      This is mainly for emitting warning messages from the linker. When we emit
      warning message on a module, we can use the module identifier.
      
      rdar://15985737
      
      llvm-svn: 201114
      03456a17
  2. Jan 24, 2014
    • Alp Toker's avatar
      Fix known typos · cb402911
      Alp Toker authored
      Sweep the codebase for common typos. Includes some changes to visible function
      names that were misspelt.
      
      llvm-svn: 200018
      cb402911
  3. Jan 23, 2014
    • Juergen Ributzka's avatar
      Add target analysis passes to the codegen pipeline for MCJIT. · 5fe955cb
      Juergen Ributzka authored
      This patch adds the target analysis passes (usually TargetTransformInfo) to the
      codgen pipeline. We also expose now the AddAnalysisPasses method through the C
      API, because the optimizer passes would also benefit from better target-specific
      cost models.
      
      Reviewed by Andrew Kaylor
      
      llvm-svn: 199926
      5fe955cb
  4. Jan 21, 2014
  5. Jan 16, 2014
    • Duncan P. N. Exon Smith's avatar
      LTO: document LTO_API_VERSION for each API · 40fdf5fe
      Duncan P. N. Exon Smith authored
      Adding a doxygen comment for each bit of API to indicate at which
      LTO_API_VERSION each was available, manually gleaned from successive
      git-blames.  A few notes:
      
      - LTO_API_VERSION was set to 3 at its introduction.
      - I've indicated all the API introduced before LTO_API_VERSION was
        around as available "prior to LTO_API_VERSION=3".
      - A number of API changes neglected to bump LTO_API_VERSION.  These I've
        indicated as available at the *next* bump of LTO_API_VERSION.
      
      llvm-svn: 199429
      40fdf5fe
  6. Jan 15, 2014
    • Quentin Colombet's avatar
      [LTO] Add a hook to map LLVM diagnostics into the clients of LTO. · 5fa1f6f5
      Quentin Colombet authored
      Add a hook in the C API of LTO so that clients of the code generator can set
      their own handler for the LLVM diagnostics.
      The handler is defined like this:
      typedef void (*lto_diagnostic_handler_t)(lto_codegen_diagnostic_severity_t
      severity, const char *diag, void *ctxt)
      - severity says how bad this is.
      - diag is a string that contains the diagnostic message.
      - ctxt is the registered context for this handler.
      
      This hook is more general than the lto_get_error_message, since this function
      keeps only the latest message and can only be queried when something went wrong
      (no warning for instance).
      
      <rdar://problem/15517596>
      
      llvm-svn: 199338
      5fa1f6f5
  7. Jan 14, 2014
    • Duncan P. N. Exon Smith's avatar
      Reapply "LTO: add API to set strategy for -internalize" · 93be7c4f
      Duncan P. N. Exon Smith authored
      Reapply r199191, reverted in r199197 because it carelessly broke
      Other/link-opts.ll.  The problem was that calling
      createInternalizePass("main") would select
      createInternalizePass(bool("main")) instead of
      createInternalizePass(ArrayRef<const char *>("main")).  This commit
      fixes the bug.
      
      The original commit message follows.
      
      Add API to LTOCodeGenerator to specify a strategy for the -internalize
      pass.
      
      This is a new attempt at Bill's change in r185882, which he reverted in
      r188029 due to problems with the gold linker.  This puts the onus on the
      linker to decide whether (and what) to internalize.
      
      In particular, running internalize before outputting an object file may
      change a 'weak' symbol into an internal one, even though that symbol
      could be needed by an external object file --- e.g., with arclite.
      
      This patch enables three strategies:
      
      - LTO_INTERNALIZE_FULL: the default (and the old behaviour).
      - LTO_INTERNALIZE_NONE: skip -internalize.
      - LTO_INTERNALIZE_HIDDEN: only -internalize symbols with hidden
        visibility.
      
      LTO_INTERNALIZE_FULL should be used when linking an executable.
      
      Outputting an object file (e.g., via ld -r) is more complicated, and
      depends on whether hidden symbols should be internalized.  E.g., for
      ld -r, LTO_INTERNALIZE_NONE can be used when -keep_private_externs, and
      LTO_INTERNALIZE_HIDDEN can be used otherwise.  However,
      LTO_INTERNALIZE_FULL is inappropriate, since the output object file will
      eventually need to link with others.
      
      lto_codegen_set_internalize_strategy() sets the strategy for subsequent
      calls to lto_codegen_write_merged_modules() and lto_codegen_compile*().
      
      <rdar://problem/14334895>
      
      llvm-svn: 199244
      93be7c4f
    • 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
    • NAKAMURA Takumi's avatar
      Revert r199191, "LTO: add API to set strategy for -internalize" · 23c0ab53
      NAKAMURA Takumi authored
      Please update also Other/link-opts.ll, in next time.
      
      llvm-svn: 199197
      23c0ab53
    • Duncan P. N. Exon Smith's avatar
      LTO: add API to set strategy for -internalize · 43ea3478
      Duncan P. N. Exon Smith authored
      Add API to LTOCodeGenerator to specify a strategy for the -internalize
      pass.
      
      This is a new attempt at Bill's change in r185882, which he reverted in
      r188029 due to problems with the gold linker.  This puts the onus on the
      linker to decide whether (and what) to internalize.
      
      In particular, running internalize before outputting an object file may
      change a 'weak' symbol into an internal one, even though that symbol
      could be needed by an external object file --- e.g., with arclite.
      
      This patch enables three strategies:
      
      - LTO_INTERNALIZE_FULL: the default (and the old behaviour).
      - LTO_INTERNALIZE_NONE: skip -internalize.
      - LTO_INTERNALIZE_HIDDEN: only -internalize symbols with hidden
        visibility.
      
      LTO_INTERNALIZE_FULL should be used when linking an executable.
      
      Outputting an object file (e.g., via ld -r) is more complicated, and
      depends on whether hidden symbols should be internalized.  E.g., for
      ld -r, LTO_INTERNALIZE_NONE can be used when -keep_private_externs, and
      LTO_INTERNALIZE_HIDDEN can be used otherwise.  However,
      LTO_INTERNALIZE_FULL is inappropriate, since the output object file will
      eventually need to link with others.
      
      lto_codegen_set_internalize_strategy() sets the strategy for subsequent
      calls to lto_codegen_write_merged_modules() and lto_codegen_compile*().
      
      <rdar://problem/14334895>
      
      llvm-svn: 199191
      43ea3478
  8. Jan 10, 2014
  9. Jan 06, 2014
    • Kevin Enderby's avatar
      For the 'C' disassembler API, add a new ReferenceType for the · f16c8c51
      Kevin Enderby authored
      SymbolLookUp() call back to return a demangled C++ name to
      be used as a comment.
      
      For example darwin's otool(1) program the uses the llvm
      disassembler now can produce disassembly like:
      
      callq   __ZNK4llvm6Target20createMCDisassemblerERKNS_15MCSubtargetInfoE ## llvm::Target::createMCDisassembler(llvm::MCSubtargetInfo const&) const
      
      Also fix a bug in LLVMDisasmInstruction() that was not flushing
      the raw_svector_ostream for the disassembled instruction string
      before copying it to the output buffer that was causing truncation
      of the output.
      
      rdar://10173828
      
      llvm-svn: 198637
      f16c8c51
  10. Dec 19, 2013
    • Reid Kleckner's avatar
      Begin adding docs and IR-level support for the inalloca attribute · a534a381
      Reid Kleckner authored
      The inalloca attribute is designed to support passing C++ objects by
      value in the Microsoft C++ ABI.  It behaves the same as byval, except
      that it always implies that the argument is in memory and that the bytes
      are never copied.  This attribute allows the caller to take the address
      of an outgoing argument's memory and execute arbitrary code to store
      into it.
      
      This patch adds basic IR support, docs, and verification.  It does not
      attempt to implement any lowering or fix any possibly broken transforms.
      
      When this patch lands, a complete description of this feature should
      appear at http://llvm.org/docs/InAlloca.html .
      
      Differential Revision: http://llvm-reviews.chandlerc.com/D2173
      
      llvm-svn: 197645
      a534a381
  11. Nov 22, 2013
  12. Nov 20, 2013
  13. Nov 17, 2013
    • Hal Finkel's avatar
      Add a loop rerolling pass · bf45efde
      Hal Finkel authored
      This adds a loop rerolling pass: the opposite of (partial) loop unrolling. The
      transformation aims to take loops like this:
      
      for (int i = 0; i < 3200; i += 5) {
        a[i]     += alpha * b[i];
        a[i + 1] += alpha * b[i + 1];
        a[i + 2] += alpha * b[i + 2];
        a[i + 3] += alpha * b[i + 3];
        a[i + 4] += alpha * b[i + 4];
      }
      
      and turn them into this:
      
      for (int i = 0; i < 3200; ++i) {
        a[i] += alpha * b[i];
      }
      
      and loops like this:
      
      for (int i = 0; i < 500; ++i) {
        x[3*i] = foo(0);
        x[3*i+1] = foo(0);
        x[3*i+2] = foo(0);
      }
      
      and turn them into this:
      
      for (int i = 0; i < 1500; ++i) {
        x[i] = foo(0);
      }
      
      There are two motivations for this transformation:
      
        1. Code-size reduction (especially relevant, obviously, when compiling for
      code size).
      
        2. Providing greater choice to the loop vectorizer (and generic unroller) to
      choose the unrolling factor (and a better ability to vectorize). The loop
      vectorizer can take vector lengths and register pressure into account when
      choosing an unrolling factor, for example, and a pre-unrolled loop limits that
      choice. This is especially problematic if the manual unrolling was optimized
      for a machine different from the current target.
      
      The current implementation is limited to single basic-block loops only. The
      rerolling recognition should work regardless of how the loop iterations are
      intermixed within the loop body (subject to dependency and side-effect
      constraints), but the significant restriction is that the order of the
      instructions in each iteration must be identical. This seems sufficient to
      capture all current use cases.
      
      This pass is not currently enabled by default at any optimization level.
      
      llvm-svn: 194939
      bf45efde
  14. Nov 15, 2013
  15. Nov 13, 2013
  16. Nov 11, 2013
  17. Nov 09, 2013
  18. Nov 07, 2013
  19. Nov 06, 2013
  20. Nov 05, 2013
  21. Nov 04, 2013
  22. Nov 03, 2013
  23. Nov 01, 2013
    • Rafael Espindola's avatar
      Remove linkonce_odr_auto_hide. · 716e7405
      Rafael Espindola authored
      linkonce_odr_auto_hide was in incomplete attempt to implement a way
      for the linker to hide symbols that are known to be available in every
      TU and whose addresses are not relevant for a particular DSO.
      
      It was redundant in that it all its uses are equivalent to
      linkonce_odr+unnamed_addr. Unlike those, it has never been connected
      to clang or llvm's optimizers, so it was effectively dead.
      
      Given that nothing produces it, this patch just nukes it
      (other than the llvm-c enum value).
      
      llvm-svn: 193865
      716e7405
    • Kevin Enderby's avatar
      Add to the disassembler C API output reference types for · 3c5ac810
      Kevin Enderby authored
      Objective-C data structures.
      
      This is allows tools such as darwin's otool(1) that uses the
      LLVM disassembler take a pointer value being loaded by
      an instruction and add a comment to what it is being referenced
      to make following disassembly of Objective-C programs
      more readable.
      
      For example disassembling the Mac OS X TextEdit app one
      will see comments like the following:
      
      movq    0x20684(%rip), %rsi ## Objc selector ref: standardUserDefaults
      movq    0x21985(%rip), %rdi ## Objc class ref: _OBJC_CLASS_$_NSUserDefaults
      movq    0x1d156(%rip), %r14 ## Objc message: +[NSUserDefaults standardUserDefaults]
      leaq    0x23615(%rip), %rdx ## Objc cfstring ref: @"SelectLinePanel"
      callq   0x10001386c ## Objc message: -[[%rdi super] initWithWindowNibName:]
      
      These diffs also include putting quotes around C strings
      in literal pools and uses "symbol address" in the comment
      when adding a symbol name to the comment to tell these
      types of references apart:
      
      leaq	0x4f(%rip), %rax ## literal pool for: "Hello world"
      movq    0x1c3ea(%rip), %rax ## literal pool symbol address: ___stack_chk_guard
      
      Of course the easy changes are in the LLVM disassembler and
      the hard work is up to the implementer of the SymbolLookUp()
      call back.
      
      rdar://10602439
      
      llvm-svn: 193833
      3c5ac810
  24. Oct 31, 2013
    • Rafael Espindola's avatar
      Use LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN instead of the "dso list". · 282a4703
      Rafael Espindola authored
      There are two ways one could implement hiding of linkonce_odr symbols in LTO:
      * LLVM tells the linker which symbols can be hidden if not used from native
        files.
      * The linker tells LLVM which symbols are not used from other object files,
        but will be put in the dso symbol table if present.
      
      GOLD's API is the second option. It was implemented almost 1:1 in llvm by
      passing the list down to internalize.
      
      LLVM already had partial support for the first option. It is also very similar
      to how ld64 handles hiding these symbols when *not* doing LTO.
      
      This patch then
      * removes the APIs for the DSO list.
      * marks LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN all linkonce_odr unnamed_addr
        global values and other linkonce_odr whose address is not used.
      * makes the gold plugin responsible for handling the API mismatch.
      
      llvm-svn: 193800
      282a4703
  25. Oct 29, 2013
Loading