LCOV - code coverage report
Current view: top level - include/llvm/Target - CodeGenCWrappers.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 6 11 54.5 %
Date: 2018-10-20 13:21:21 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- llvm/Target/CodeGenCWrappers.h - CodeGen C Wrappers ------*- C++ -*-===//
       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             : // This file defines C bindings wrappers for enums in llvm/Support/CodeGen.h
      11             : // that need them.  The wrappers are separated to avoid adding an indirect
      12             : // dependency on llvm/Config/Targets.def to CodeGen.h.
      13             : //
      14             : //===----------------------------------------------------------------------===//
      15             : 
      16             : #ifndef LLVM_TARGET_CODEGENCWRAPPERS_H
      17             : #define LLVM_TARGET_CODEGENCWRAPPERS_H
      18             : 
      19             : #include "llvm-c/TargetMachine.h"
      20             : #include "llvm/ADT/Optional.h"
      21             : #include "llvm/Support/CodeGen.h"
      22             : #include "llvm/Support/ErrorHandling.h"
      23             : 
      24             : namespace llvm {
      25             : 
      26           8 : inline Optional<CodeModel::Model> unwrap(LLVMCodeModel Model, bool &JIT) {
      27           8 :   JIT = false;
      28           8 :   switch (Model) {
      29           8 :   case LLVMCodeModelJITDefault:
      30           8 :     JIT = true;
      31             :     LLVM_FALLTHROUGH;
      32           8 :   case LLVMCodeModelDefault:
      33             :     return None;
      34           0 :   case LLVMCodeModelTiny:
      35             :     return CodeModel::Tiny;
      36           0 :   case LLVMCodeModelSmall:
      37             :     return CodeModel::Small;
      38           0 :   case LLVMCodeModelKernel:
      39             :     return CodeModel::Kernel;
      40           0 :   case LLVMCodeModelMedium:
      41             :     return CodeModel::Medium;
      42           0 :   case LLVMCodeModelLarge:
      43             :     return CodeModel::Large;
      44             :   }
      45             :   return CodeModel::Small;
      46             : }
      47             : 
      48             : inline LLVMCodeModel wrap(CodeModel::Model Model) {
      49             :   switch (Model) {
      50             :   case CodeModel::Tiny:
      51             :     return LLVMCodeModelTiny;
      52             :   case CodeModel::Small:
      53             :     return LLVMCodeModelSmall;
      54             :   case CodeModel::Kernel:
      55             :     return LLVMCodeModelKernel;
      56             :   case CodeModel::Medium:
      57             :     return LLVMCodeModelMedium;
      58             :   case CodeModel::Large:
      59             :     return LLVMCodeModelLarge;
      60             :   }
      61             :   llvm_unreachable("Bad CodeModel!");
      62             : }
      63             : } // namespace llvm
      64             : 
      65             : #endif

Generated by: LCOV version 1.13