Skip to content
  1. Jul 03, 2018
  2. Jun 26, 2018
    • Lang Hames's avatar
      [ORC] Add LLJIT and LLLazyJIT, and replace OrcLazyJIT in LLI with LLLazyJIT. · 6a94134b
      Lang Hames authored
      LLJIT is a prefabricated ORC based JIT class that is meant to be the go-to
      replacement for MCJIT. Unlike OrcMCJITReplacement (which will continue to be
      supported) it is not API or bug-for-bug compatible, but targets the same
      use cases: Simple, non-lazy compilation and execution of LLVM IR.
      
      LLLazyJIT extends LLJIT with support for function-at-a-time lazy compilation,
      similar to what was provided by LLVM's original (now long deprecated) JIT APIs.
      
      This commit also contains some simple utility classes (CtorDtorRunner2,
      LocalCXXRuntimeOverrides2, JITTargetMachineBuilder) to support LLJIT and
      LLLazyJIT.
      
      Both of these classes are works in progress. Feedback from JIT clients is very
      welcome!
      
      llvm-svn: 335670
      6a94134b
  3. May 30, 2018
    • Lang Hames's avatar
      [ORC] Update JITCompileCallbackManager to support multi-threaded code. · bd0cb787
      Lang Hames authored
      Previously JITCompileCallbackManager only supported single threaded code. This
      patch embeds a VSO (see include/llvm/ExecutionEngine/Orc/Core.h) in the callback
      manager. The VSO ensures that the compile callback is only executed once and that
      the resulting address cached for use by subsequent re-entries.
      
      llvm-svn: 333490
      bd0cb787
  4. May 17, 2018
    • Lang Hames's avatar
      [ORC] Rewrite the VSO symbol table yet again. Update related utilities. · d261e125
      Lang Hames authored
      VSOs now track dependencies for materializing symbols. Each symbol must have its
      dependencies registered with the VSO prior to finalization. Usually this will
      involve registering the dependencies returned in
      AsynchronousSymbolQuery::ResolutionResults for queries made while linking the
      symbols being materialized.
      
      Queries against symbols are notified that a symbol is ready once it and all of
      its transitive dependencies are finalized, allowing compilation work to be
      broken up and moved between threads without queries returning until their
      symbols fully safe to access / execute.
      
      Related utilities (VSO, MaterializationUnit, MaterializationResponsibility) are
      updated to support dependence tracking and more explicitly track responsibility
      for symbols from the point of definition until they are finalized.
      
      llvm-svn: 332541
      d261e125
  5. May 14, 2018
    • Nicola Zaghen's avatar
      Rename DEBUG macro to LLVM_DEBUG. · d34e60ca
      Nicola Zaghen authored
          
      The DEBUG() macro is very generic so it might clash with other projects.
      The renaming was done as follows:
      - git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g'
      - git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM
      - Manual change to APInt
      - Manually chage DOCS as regex doesn't match it.
      
      In the transition period the DEBUG() macro is still present and aliased
      to the LLVM_DEBUG() one.
      
      Differential Revision: https://reviews.llvm.org/D43624
      
      llvm-svn: 332240
      d34e60ca
  6. Apr 30, 2018
    • Nico Weber's avatar
      IWYU for llvm-config.h in llvm, additions. · 432a3883
      Nico Weber authored
      See r331124 for how I made a list of files missing the include.
      I then ran this Python script:
      
          for f in open('filelist.txt'):
              f = f.strip()
              fl = open(f).readlines()
      
              found = False
              for i in xrange(len(fl)):
                  p = '#include "llvm/'
                  if not fl[i].startswith(p):
                      continue
                  if fl[i][len(p):] > 'Config':
                      fl.insert(i, '#include "llvm/Config/llvm-config.h"\n')
                      found = True
                      break
              if not found:
                  print 'not found', f
              else:
                  open(f, 'w').write(''.join(fl))
      
      and then looked through everything with `svn diff | diffstat -l | xargs -n 1000 gvim -p`
      and tried to fix include ordering and whatnot.
      
      No intended behavior change.
      
      llvm-svn: 331184
      432a3883
  7. Apr 22, 2018
  8. Apr 13, 2018
  9. Apr 11, 2018
    • David Blaikie's avatar
      Rename *CommandFlags.def to *CommandFlags.inc · 4333f970
      David Blaikie authored
      These aren't the .def style files used in LLVM that require a macro
      defined before their inclusion - they're just basic non-modular includes
      to stamp out command line flag variables.
      
      llvm-svn: 329840
      4333f970
  10. Apr 02, 2018
  11. Mar 15, 2018
  12. Mar 14, 2018
  13. Feb 14, 2018
  14. Feb 09, 2018
    • Lang Hames's avatar
      [ORC] Remove Layer handles from the layer concept. · 0976cee8
      Lang Hames authored
      Handles were returned by addModule and used as keys for removeModule,
      findSymbolIn, and emitAndFinalize. Their job is now subsumed by VModuleKeys,
      which simplify resource management by providing a consistent handle across all
      layers.
      
      llvm-svn: 324700
      0976cee8
  15. Feb 06, 2018
    • Lang Hames's avatar
      [ORC] Remove some unused lambda captures. · e33798f5
      Lang Hames authored
      llvm-svn: 324410
      e33798f5
    • Lang Hames's avatar
      [ORC] Start migrating ORC layers to use the new ORC Core.h APIs. · 4b546c91
      Lang Hames authored
      In particular this patch switches RTDyldObjectLinkingLayer to use
      orc::SymbolResolver and threads the requried changse (ExecutionSession
      references and VModuleKeys) through the existing layer APIs.
      
      The purpose of the new resolver interface is to improve query performance and
      better support parallelism, both in JIT'd code and within the compiler itself.
      
      The most visibile change is switch of the <Layer>::addModule signatures from:
      
      Expected<Handle> addModule(std::shared_ptr<ModuleType> Mod,
                                 std::shared_ptr<JITSymbolResolver> Resolver)
      
      to:
      
      Expected<Handle> addModule(VModuleKey K, std::shared_ptr<ModuleType> Mod);
      
      Typical usage of addModule will now look like:
      
      auto K = ES.allocateVModuleKey();
      Resolvers[K] = createSymbolResolver(...);
      Layer.addModule(K, std::move(Mod));
      
      See the BuildingAJIT tutorial code for example usage.
      
      llvm-svn: 324405
      4b546c91
  16. Jan 19, 2018
    • Lang Hames's avatar
      [ORC] Re-apply r322913 with a fix for a read-after-free error. · b72f4845
      Lang Hames authored
      ExternalSymbolMap now stores the string key (rather than using a StringRef),
      as the object file backing the key may be removed at any time.
      
      llvm-svn: 323001
      b72f4845
    • Lang Hames's avatar
      [ORC] Revert r322913 while I investigate an ASan failure. · 44efd042
      Lang Hames authored
      llvm-svn: 322914
      44efd042
    • Lang Hames's avatar
      [ORC] Redesign the JITSymbolResolver interface to support bulk queries. · 817df9fa
      Lang Hames authored
      Bulk queries reduce IPC/RPC overhead for cross-process JITing and expose
      opportunities for parallel compilation.
      
      The two new query methods are lookupFlags, which finds the flags for each of a
      set of symbols; and lookup, which finds the address and flags for each of a
      set of symbols. (See doxygen comments for more details.)
      
      The existing JITSymbolResolver class is renamed LegacyJITSymbolResolver, and
      modified to extend the new JITSymbolResolver class using the following scheme:
      
      - lookupFlags is implemented by calling findSymbolInLogicalDylib for each of the
      symbols, then returning the result of calling getFlags() on each of these
      symbols. (Importantly: lookupFlags does NOT call getAddress on the returned
      symbols, so lookupFlags will never trigger materialization, and lookupFlags will
      never call findSymbol, so only symbols that are part of the logical dylib will
      return results.)
      
      - lookup is implemented by calling findSymbolInLogicalDylib for each symbol and
      falling back to findSymbol if findSymbolInLogicalDylib returns a null result.
      Assuming a symbol is found its getAddress method is called to materialize it and
      the result (if getAddress succeeds) is stored in the result map, or the error
      (if getAddress fails) is returned immediately from lookup. If any symbol is not
      found then lookup returns immediately with an error.
      
      This change will break any out-of-tree derivatives of JITSymbolResolver. This
      can be fixed by updating those classes to derive from LegacyJITSymbolResolver
      instead.
      
      llvm-svn: 322913
      817df9fa
  17. Jan 09, 2018
    • Craig Topper's avatar
      [lli] Make lli support -mcpu=native for CPU autodetection · 243f20f1
      Craig Topper authored
      llc, opt, and clang can all autodetect the CPU and supported features. lli cannot as far as I could tell.
      
      This patch uses the getCPUStr() and introduces a new getCPUFeatureList() and uses those in lli in place of MCPU and MAttrs.
      
      Ideally, we would merge getCPUFeatureList and getCPUFeatureStr, but opt and llc need a string and lli wanted a list. Maybe we should just return the SubtargetFeature object and let the caller decide what it needs?
      
      Differential Revision: https://reviews.llvm.org/D41833
      
      llvm-svn: 322100
      243f20f1
  18. Nov 27, 2017
    • David Blaikie's avatar
      Rename CommandFlags.h -> CommandFlags.def · c14bfec4
      David Blaikie authored
      Since this isn't a real header - it includes static functions and had
      external linkage variables (though this change makes them static, since
      that's what they should be) so can't be included more than once in a
      program.
      
      llvm-svn: 319082
      c14bfec4
  19. Sep 04, 2017
    • Lang Hames's avatar
      [ORC] Refactor OrcRemoteTarget code to expose its RPC API, reduce · 9e68b734
      Lang Hames authored
      code duplication in the client, and improve error propagation.
      
      This patch moves the OrcRemoteTarget rpc::Function declarations from
      OrcRemoteTargetRPCAPI into their own namespaces under llvm::orc::remote so that
      they can be used in new contexts (in particular, a remote-object-file adapter
      layer that I will commit shortly).
      
      Code duplication in OrcRemoteTargetClient (especially in loops processing the
      code, rw-data and ro-data allocations) is removed by moving the loop bodies
      into their own functions.
      
      Error propagation is (slightly) improved by adding an ErrorReporter functor to
      the OrcRemoteTargetClient -- Errors that can't be returned (because they occur
      in destructors, or behind stable APIs that don't provide error returns) can be
      sent to the ErrorReporter instead. Some methods in the Client API are also
      changed to make better use of the Expected class: returning Expected<T>s rather
      than returning Errors and taking T&s to store the results.
      
      llvm-svn: 312500
      9e68b734
  20. Aug 28, 2017
  21. Aug 11, 2017
  22. Aug 03, 2017
    • Rafael Espindola's avatar
      Delete Default and JITDefault code models · 79e238af
      Rafael Espindola authored
      IMHO it is an antipattern to have a enum value that is Default.
      
      At any given piece of code it is not clear if we have to handle
      Default or if has already been mapped to a concrete value. In this
      case in particular, only the target can do the mapping and it is nice
      to make sure it is always done.
      
      This deletes the two default enum values of CodeModel and uses an
      explicit Optional<CodeModel> when it is possible that it is
      unspecified.
      
      llvm-svn: 309911
      79e238af
  23. Jul 11, 2017
  24. Jul 07, 2017
    • Lang Hames's avatar
      [ORC] Errorize the ORC APIs. · 4ce98662
      Lang Hames authored
      This patch updates the ORC layers and utilities to return and propagate
      llvm::Errors where appropriate. This is necessary to allow ORC to safely handle
      error cases in cross-process and remote JITing.
      
      llvm-svn: 307350
      4ce98662
  25. Jul 04, 2017
    • Lang Hames's avatar
      [Orc] Remove the memory manager argument to addModule, and de-templatize the · 5b518160
      Lang Hames authored
      symbol resolver argument.
      
      De-templatizing the symbol resolver is part of the ongoing simplification of
      ORC layer API.
      
      Removing the memory management argument (and delegating construction of memory
      managers for RTDyldObjectLinkingLayer to a functor passed in to the constructor)
      allows us to build JITs whose base object layers need not be compatible with
      RTDyldObjectLinkingLayer's memory mangement scheme. For example, a 'remote
      object layer' that sends fully relocatable objects directly to the remote does
      not need a memory management scheme at all (that will be handled by the remote).
      
      llvm-svn: 307058
      5b518160
  26. Jun 24, 2017
  27. Jun 23, 2017
  28. Jun 22, 2017
  29. Jun 20, 2017
  30. May 09, 2017
    • Lang Hames's avatar
      [ExecutionEngine] Make RuntimeDyld::MemoryManager responsible for tracking EH · c936ac7f
      Lang Hames authored
      frames.
      
      RuntimeDyld was previously responsible for tracking allocated EH frames, but it
      makes more sense to have the RuntimeDyld::MemoryManager track them (since the
      frames are allocated through the memory manager, and written to memory owned by
      the memory manager). This patch moves the frame tracking into
      RTDyldMemoryManager, and changes the deregisterFrames method on
      RuntimeDyld::MemoryManager from:
      
      void deregisterEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size);
      
      to:
      
      void deregisterEHFrames();
      
      Separating this responsibility will allow ORC to continue to throw the
      RuntimeDyld instances away post-link (saving a few dozen bytes per lazy
      function) while properly deregistering frames when modules are unloaded.
      
      This patch also updates ORC to call deregisterEHFrames when modules are
      unloaded. This fixes a bug where an exception that tears down the JIT can then
      unwind through dangling EH frames that have been deallocated but not
      deregistered, resulting in UB.
      
      For people using SectionMemoryManager this should be pretty much a no-op. For
      people with custom allocators that override registerEHFrames/deregisterEHFrames,
      you will now be responsible for tracking allocated EH frames.
      
      Reviewed in https://reviews.llvm.org/D32829
      
      llvm-svn: 302589
      c936ac7f
  31. Apr 11, 2017
Loading