LCOV - code coverage report
Current view: top level - lib/ExecutionEngine/Orc - IRCompileLayer.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 10 17 58.8 %
Date: 2018-10-20 13:21:21 Functions: 2 3 66.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===--------------- IRCompileLayer.cpp - IR Compiling Layer --------------===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : 
      10             : #include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
      11             : 
      12             : namespace llvm {
      13             : namespace orc {
      14             : 
      15          15 : IRCompileLayer::IRCompileLayer(ExecutionSession &ES, ObjectLayer &BaseLayer,
      16          15 :                                  CompileFunction Compile)
      17          15 :     : IRLayer(ES), BaseLayer(BaseLayer), Compile(std::move(Compile)) {}
      18             : 
      19           0 : void IRCompileLayer::setNotifyCompiled(NotifyCompiledFunction NotifyCompiled) {
      20           0 :   std::lock_guard<std::mutex> Lock(IRLayerMutex);
      21           0 :   this->NotifyCompiled = std::move(NotifyCompiled);
      22           0 : }
      23             : 
      24          26 : void IRCompileLayer::emit(MaterializationResponsibility R,
      25             :                           ThreadSafeModule TSM) {
      26             :   assert(TSM.getModule() && "Module must not be null");
      27             : 
      28          52 :   if (auto Obj = Compile(*TSM.getModule())) {
      29             :     {
      30          26 :       std::lock_guard<std::mutex> Lock(IRLayerMutex);
      31          26 :       if (NotifyCompiled)
      32           0 :         NotifyCompiled(R.getVModuleKey(), std::move(TSM));
      33             :       else
      34          26 :         TSM = ThreadSafeModule();
      35             :     }
      36          52 :     BaseLayer.emit(std::move(R), std::move(*Obj));
      37             :   } else {
      38           0 :     R.failMaterialization();
      39           0 :     getExecutionSession().reportError(Obj.takeError());
      40             :   }
      41          26 : }
      42             : 
      43             : } // End namespace orc.
      44             : } // End namespace llvm.

Generated by: LCOV version 1.13