Skip to content
  1. Jan 10, 2014
  2. Jan 07, 2014
  3. Jan 03, 2014
    • Rafael Espindola's avatar
      Make the llvm mangler depend only on DataLayout. · 58873566
      Rafael Espindola authored
      Before this patch any program that wanted to know the final symbol name of a
      GlobalValue had to link with Target.
      
      This patch implements a compromise solution where the mangler uses DataLayout.
      This way, any tool that already links with Target (llc, clang) gets the exact
      behavior as before and new IR files can be mangled without linking with Target.
      
      With this patch the mangler is constructed with just a DataLayout and DataLayout
      is extended to include the information the Mangler needs.
      
      llvm-svn: 198438
      58873566
  4. Dec 12, 2013
  5. Dec 05, 2013
    • Rafael Espindola's avatar
      Remove the isImplicitlyPrivate argument of getNameWithPrefix. · 117b20c4
      Rafael Espindola authored
      getSymbolWithGlobalValueBase use is to create a name of a new symbol based
      on the name of an existing GV. Assert that and then remove the last call
      to pass true to isImplicitlyPrivate.
      
      This gives the mangler API a 1:1 mapping from GV to names, which is what we
      need to drop the mangler dependency on the target (and use an extended
      datalayout instead).
      
      llvm-svn: 196472
      117b20c4
  6. Nov 16, 2013
  7. Nov 12, 2013
    • Justin Bogner's avatar
      Protect user-supplied runtime library functions in LTO · b10a520c
      Justin Bogner authored
      Add user-supplied C runtime and compiler-rt library functions to
      llvm.compiler.used to protect them from premature optimization by
      passes like -globalopt and -ipsccp.  Calls to (seemingly unused)
      runtime library functions can be added by -instcombine and instruction
      lowering.
      
      Patch by Duncan Exon Smith, thanks!
      
      Fixes <rdar://problem/14740087>
      
      llvm-svn: 194514
      b10a520c
  8. 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
  9. Oct 29, 2013
  10. Oct 16, 2013
  11. Oct 03, 2013
    • Rafael Espindola's avatar
      Optimize linkonce_odr unnamed_addr functions during LTO. · cda2911c
      Rafael Espindola authored
      Generalize the API so we can distinguish symbols that are needed just for a DSO
      symbol table from those that are used from some native .o.
      
      The symbols that are only wanted for the dso symbol table can be dropped if
      llvm can prove every other dso has a copy (linkonce_odr) and the address is not
      important (unnamed_addr).
      
      llvm-svn: 191922
      cda2911c
  12. Oct 02, 2013
  13. Sep 30, 2013
  14. Sep 25, 2013
  15. Sep 04, 2013
  16. Aug 27, 2013
    • Shuxin Yang's avatar
      Revert 189297, the original commit message is following. · 388b52c0
      Shuxin Yang authored
      ----
        Add new API lto_codegen_compile_parallel().
      
        This API is proposed by Nick Kledzik. The semantic is:
      
        --------------------------------------------------------------------------
         Generate code for merged module into an array of native object files. On 
         success returns a pointer to an array of NativeObjectFile.  The count 
         parameter returns the number of elements in the array.  Each element is 
         a pointer/length for a generated mach-o/ELF buffer.  The buffer is owned
         by the lto_code_gen_t and will be freed when lto_codegen_dispose() is called, 
         or lto_codegen_compile() is called again. On failure, returns NULL 
         (check lto_get_error_message() for details).
      
         extern const struct  NativeObjectFile*
         lto_codegen_compile_parallel(lto_code_gen_t cg, size_t *count);
        ---------------------------------------------------------------------------
      
        This API is currently only called on OSX platform. Linux or other Unixes
      using GNU gold are not supposed to call this function, because on these systems, 
      object files are fed back to linker via disk file instead of memory buffer.
      
        In this commit, lto_codegen_compile_parallel() simply calls
      lto_codegen_compile() to return a single object file. In the near future,
      this function is the entry point for compilation with partition. Linker can
      blindly call this function even if partition is turned off; in this case,
      compiler will return only one object file.
      
      llvm-svn: 189386
      388b52c0
    • Shuxin Yang's avatar
      Add new API lto_codegen_compile_parallel(). · a44362e4
      Shuxin Yang authored
        This API is proposed by Nick Kledzik. The semantic is:
      
        --------------------------------------------------------------------------
         Generate code for merged module into an array of native object files. On 
         success returns a pointer to an array of NativeObjectFile.  The count 
         parameter returns the number of elements in the array.  Each element is 
         a pointer/length for a generated mach-o/ELF buffer.  The buffer is owned
         by the lto_code_gen_t and will be freed when lto_codegen_dispose() is called, 
         or lto_codegen_compile() is called again. On failure, returns NULL 
         (check lto_get_error_message() for details).
      
         extern const struct  NativeObjectFile*
         lto_codegen_compile_parallel(lto_code_gen_t cg, size_t *count);
        ---------------------------------------------------------------------------
      
        This API is currently only called on OSX platform. Linux or other Unixes
      using GNU gold are not supposed to call this function, because on these systems, 
      object files are fed back to linker via disk file instead of memory buffer.
      
        In this commit, lto_codegen_compile_parallel() simply calls
      lto_codegen_compile() to return a single object file. In the near future,
      this function is the entry point for compilation with partition. Linker can
      blindly call this function even if partition is turned off; in this case,
      compiler will return only one object file.
      
      llvm-svn: 189297
      a44362e4
  17. Aug 12, 2013
    • Shuxin Yang's avatar
      Revert r188188 and r188200. · 1826ae23
      Shuxin Yang authored
      In order to appease people (in Apple) who accuse me for committing "huge change" (?) without proper review. 
      
      Thank Eric for fixing a compile-warning. 
      
      llvm-svn: 188204
      1826ae23
    • Shuxin Yang's avatar
      Misc enhancements to LTO: · 76d082b5
      Shuxin Yang authored
        1. Add some helper classes for partitions. They are designed in a
           way such that the top-level LTO driver will not see much difference 
           with or without partitioning.
      
        2. Introduce work-dir. Now all intermediate files generated during 
           LTO phases will be saved under work-dir. User can specify the workdir
           via -lto-workdir=/path/to/dir. By default the work-dir will be 
           erased before linker exit. To keep the workdir, do -lto-keep, or -lto-keep=1.
      
          TODO: Erase the workdir, if the linker exit prematurely.  
            We are currently not able to remove directory on signal. The support 
            routines simply ignore directory.
      
        3. Add one new API lto_codegen_get_files_need_remove().
           Linker and LTO plugin will communicate via this API about which files
          (including directories) need to removed before linker exit.
      
      llvm-svn: 188188
      76d082b5
  18. Aug 09, 2013
  19. Aug 07, 2013
  20. Aug 06, 2013
  21. Jul 27, 2013
  22. Jul 23, 2013
  23. Jul 22, 2013
    • Shuxin Yang's avatar
      Initialize/Register LTO passes to enable flags like -print-after=<lto-pass> · 1e6d80e2
      Shuxin Yang authored
      There already have two "dead" functions, initialize{IPO|IPA}, defined for 
      similar purpose. I decide not to call these two functions for two reasons:
        o. they don't cover all LTO passes (which will soon be separated into IPO 
           and post-IPO passes)
        o. We have not yet figured out the right passes and the ordering for IPO 
           and post-IPO stages, meaning this change is only for the time being.
      
      Since LTO passes are registered, we are now able to print IR before and 
      after particular point.
      
      For OSX users:
      --------------
        "...-Wl,-mllvm -Wl,-print-after=<pass-name>" will print IR after the
        specified pass.
      
      For Other UNIX with GNU gold linker:
      ------------------------------------
        "-Wl,-plugin-opt=-print-after=<pass-name>" should work.
        (NOTE: no need for "-Wl,-mllvm")
      
        Strip "-Wl," if flags are fed directly to linker instead of clang/clang++.
      
      llvm-svn: 186853
      1e6d80e2
  24. Jul 16, 2013
    • Rafael Espindola's avatar
      Add a wrapper for open. · 6d35481c
      Rafael Espindola authored
      This centralizes the handling of O_BINARY and opens the way for hiding more
      differences (like how open behaves with directories).
      
      llvm-svn: 186447
      6d35481c
  25. Jul 09, 2013
  26. Jul 05, 2013
  27. Jun 18, 2013
  28. Jun 17, 2013
  29. Jun 13, 2013
  30. May 29, 2013
  31. May 23, 2013
  32. May 04, 2013
  33. Apr 24, 2013
    • Rafael Espindola's avatar
      Don't produce an empty llvm.compiler.used in LTO. · cc111b2b
      Rafael Espindola authored
      LTO was always creating an empty llvm.compiler.used. With this patch we
      now first check if there is anything to be added first.
      
      Unfortunately, there is no good way to test libLTO in isolation as it needs gold
      or ld64, but there are bots doing LTO builds that found this problem.
      
      llvm-svn: 180202
      cc111b2b
Loading