Skip to content
  1. Sep 11, 2018
  2. Aug 28, 2018
    • Lang Hames's avatar
      [ORC] Add an addObjectFile method to LLJIT. · 37a66413
      Lang Hames authored
      The addObjectFile method adds the given object file to the JIT session, making
      its code available for execution.
      
      Support for the -extra-object flag is added to lli when operating in
      -jit-kind=orc-lazy mode to support testing of this feature.
      
      llvm-svn: 340870
      37a66413
  3. Aug 17, 2018
    • Lang Hames's avatar
      [ORC] Rename VSO to JITDylib. · d5f56c59
      Lang Hames authored
      VSO was a little close to VDSO (an acronym on Linux for Virtual Dynamic Shared
      Object) for comfort. It also risks giving the impression that instances of this
      class could be shared between ExecutionSessions, which they can not.
      
      JITDylib seems moderately less confusing, while still hinting at how this
      class is intended to be used, i.e. as a JIT-compiled stand-in for a dynamic
      library (code that would have been a dynamic library if you had wanted to
      compile it ahead of time).
      
      llvm-svn: 340084
      d5f56c59
  4. Jul 24, 2018
    • Andres Freund's avatar
      Add PerfJITEventListener for perf profiling support. · 376a3d36
      Andres Freund authored
      This new JIT event listener supports generating profiling data for
      the linux 'perf' profiling tool, allowing it to generate function and
      instruction level profiles.
      
      Currently this functionality is not enabled by default, but must be
      enabled with LLVM_USE_PERF=yes.  Given that the listener has no
      dependencies, it might be sensible to enable by default once the
      initial issues have been shaken out.
      
      I followed existing precedent in registering the listener by default
      in lli. Should there be a decision to enable this by default on linux,
      that should probably be changed.
      
      Please note that until https://reviews.llvm.org/D47343 is resolved,
      using this functionality with mcjit rather than orcjit will not
      reliably work.
      
      Disregarding the previous comment, here's an example:
      
      $ cat /tmp/expensive_loop.c
      
      bool stupid_isprime(uint64_t num)
      {
              if (num == 2)
                      return true;
              if (num < 1 || num % 2 == 0)
                      return false;
              for(uint64_t i = 3; i < num / 2; i+= 2) {
                      if (num % i == 0)
                              return false;
              }
              return true;
      }
      
      int main(int argc, char **argv)
      {
              int numprimes = 0;
      
              for (uint64_t num = argc; num < 100000; num++)
              {
                      if (stupid_isprime(num))
                              numprimes++;
              }
      
              return numprimes;
      }
      
      $ clang -ggdb -S -c -emit-llvm /tmp/expensive_loop.c -o
      /tmp/expensive_loop.ll
      
      $ perf record -o perf.data -g -k 1 ./bin/lli -jit-kind=mcjit /tmp/expensive_loop.ll 1
      
      $ perf inject --jit -i perf.data -o perf.jit.data
      
      $ perf report -i perf.jit.data
      -   92.59%  lli      jitted-5881-2.so                   [.] stupid_isprime
           stupid_isprime
           main
           llvm::MCJIT::runFunction
           llvm::ExecutionEngine::runFunctionAsMain
           main
           __libc_start_main
           0x4bf6258d4c544155
      +    0.85%  lli      ld-2.27.so                         [.] do_lookup_x
      
      And line-level annotations also work:
             │              for(uint64_t i = 3; i < num / 2; i+= 2) {
             │1 30:   movq   $0x3,-0x18(%rbp)
        0.03 │1 38:   mov    -0x18(%rbp),%rax
        0.03 │        mov    -0x10(%rbp),%rcx
             │        shr    $0x1,%rcx
        3.63 │     ┌──cmp    %rcx,%rax
             │     ├──jae    6f
             │     │                if (num % i == 0)
        0.03 │     │  mov    -0x10(%rbp),%rax
             │     │  xor    %edx,%edx
       89.00 │     │  divq   -0x18(%rbp)
             │     │  cmp    $0x0,%rdx
        0.22 │     │↓ jne    5f
             │     │                        return false;
             │     │  movb   $0x0,-0x1(%rbp)
             │     │↓ jmp    73
             │     │        }
        3.22 │1 5f:│↓ jmp    61
             │     │        for(uint64_t i = 3; i < num / 2; i+= 2) {
      
      Subscribers: mgorny, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D44892
      
      llvm-svn: 337789
      376a3d36
  5. Jul 03, 2018
  6. 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
  7. 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
  8. 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
  9. 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
  10. Apr 22, 2018
  11. Apr 13, 2018
  12. 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
  13. 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
  14. 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
  15. 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
  16. Aug 28, 2017
  17. 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
  18. Jul 11, 2017
  19. Apr 11, 2017
  20. Apr 06, 2017
  21. Nov 20, 2016
  22. Nov 17, 2016
  23. Nov 11, 2016
    • Lang Hames's avatar
      [ORC] Re-apply 286620 with fixes for the ErrorSuccess class. · 1f2bf2d3
      Lang Hames authored
      llvm-svn: 286639
      1f2bf2d3
    • Lang Hames's avatar
      [ORC] Revert r286620 while I investigate a bot failure. · 4f734f25
      Lang Hames authored
      llvm-svn: 286621
      4f734f25
    • Lang Hames's avatar
      [ORC] Refactor the ORC RPC utilities to add some new features. · ae1fdddb
      Lang Hames authored
      (1) Add support for function key negotiation.
      
      The previous version of the RPC required both sides to maintain the same
      enumeration for functions in the API. This means that any version skew between
      the client and server would result in communication failure.
      
      With this version of the patch functions (and serializable types) are defined
      with string names, and the derived function signature strings are used to
      negotiate the actual function keys (which are used for efficient call
      serialization). This allows clients to connect to any server that supports a
      superset of the API (based on the function signatures it supports).
      
      (2) Add a callAsync primitive.
      
      The callAsync primitive can be used to install a return value handler that will
      run as soon as the RPC function's return value is sent back from the remote.
      
      (3) Launch policies for RPC function handlers.
      
      The new addHandler method, which installs handlers for RPC functions, takes two
      arguments: (1) the handler itself, and (2) an optional "launch policy". When the
      RPC function is called, the launch policy (if present) is invoked to actually
      launch the handler. This allows the handler to be spawned on a background
      thread, or added to a work list. If no launch policy is used, the handler is run
      on the server thread itself. This should only be used for short-running
      handlers, or entirely synchronous RPC APIs.
      
      (4) Zero cost cross type serialization.
      
      You can now define serialization from any type to a different "wire" type. For
      example, this allows you to call an RPC function that's defined to take a
      std::string while passing a StringRef argument. If a serializer from StringRef
      to std::string has been defined for the channel type this will be used to
      serialize the argument without having to construct a std::string instance.
      
      This allows buffer reference types to be used as arguments to RPC calls without
      requiring a copy of the buffer to be made.
      
      llvm-svn: 286620
      ae1fdddb
    • Teresa Johnson's avatar
      Split Bitcode/ReaderWriter.h into separate reader and writer headers · ad17679a
      Teresa Johnson authored
      Summary:
      Split ReaderWriter.h which contains the APIs into both the BitReader and
      BitWriter libraries into BitcodeReader.h and BitcodeWriter.h.
      
      This is to address Chandler's concern about sharing the same API header
      between multiple libraries (BitReader and BitWriter). That concern is
      why we create a single bitcode library in our downstream build of clang,
      which led to r286297 being reverted as it added a dependency that
      created a cycle only when there is a single bitcode library (not two as
      in upstream).
      
      Reviewers: mehdi_amini
      
      Subscribers: dlj, mehdi_amini, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D26502
      
      llvm-svn: 286566
      ad17679a
  24. Nov 09, 2016
  25. Nov 02, 2016
  26. Oct 28, 2016
  27. Oct 08, 2016
  28. Sep 11, 2016
  29. Aug 02, 2016
  30. Aug 01, 2016
    • Lang Hames's avatar
      [ExecutionEngine][MCJIT][Orc] Replace RuntimeDyld::SymbolInfo with JITSymbol. · ad4a911f
      Lang Hames authored
      This patch replaces RuntimeDyld::SymbolInfo with JITSymbol: A symbol class
      that is capable of lazy materialization (i.e. the symbol definition needn't be
      emitted until the address is requested). This can be used to support common
      and weak symbols in the JIT (though this is not implemented in this patch).
      
      For consistency, RuntimeDyld::SymbolResolver is renamed to JITSymbolResolver.
      
      For space efficiency a new class, JITEvaluatedSymbol, is introduced that
      behaves like the old RuntimeDyld::SymbolInfo - i.e. it is just a pair of an
      address and symbol flags. Instances of JITEvaluatedSymbol can be used in
      symbol-tables to avoid paying the space cost of the materializer.
      
      llvm-svn: 277386
      ad4a911f
  31. Jun 29, 2016
Loading