Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/Target/PowerPC/PPCTargetMachine.h
Line
Count
Source
1
//===-- PPCTargetMachine.h - Define TargetMachine for PowerPC ---*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// This file declares the PowerPC specific subclass of TargetMachine.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_LIB_TARGET_POWERPC_PPCTARGETMACHINE_H
14
#define LLVM_LIB_TARGET_POWERPC_PPCTARGETMACHINE_H
15
16
#include "PPCInstrInfo.h"
17
#include "PPCSubtarget.h"
18
#include "llvm/IR/DataLayout.h"
19
#include "llvm/Target/TargetMachine.h"
20
21
namespace llvm {
22
23
/// Common code between 32-bit and 64-bit PowerPC targets.
24
///
25
class PPCTargetMachine final : public LLVMTargetMachine {
26
public:
27
  enum PPCABI { PPC_ABI_UNKNOWN, PPC_ABI_ELFv1, PPC_ABI_ELFv2 };
28
private:
29
  std::unique_ptr<TargetLoweringObjectFile> TLOF;
30
  PPCABI TargetABI;
31
32
  mutable StringMap<std::unique_ptr<PPCSubtarget>> SubtargetMap;
33
34
public:
35
  PPCTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
36
                   StringRef FS, const TargetOptions &Options,
37
                   Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
38
                   CodeGenOpt::Level OL, bool JIT);
39
40
  ~PPCTargetMachine() override;
41
42
  const PPCSubtarget *getSubtargetImpl(const Function &F) const override;
43
  // DO NOT IMPLEMENT: There is no such thing as a valid default subtarget,
44
  // subtargets are per-function entities based on the target-specific
45
  // attributes of each function.
46
  const PPCSubtarget *getSubtargetImpl() const = delete;
47
48
  // Pass Pipeline Configuration
49
  TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
50
51
  TargetTransformInfo getTargetTransformInfo(const Function &F) override;
52
53
63.6k
  TargetLoweringObjectFile *getObjFileLowering() const override {
54
63.6k
    return TLOF.get();
55
63.6k
  }
56
184k
  bool isELFv2ABI() const { return TargetABI == PPC_ABI_ELFv2; }
57
2.52M
  bool isPPC64() const {
58
2.52M
    const Triple &TT = getTargetTriple();
59
2.52M
    return (TT.getArch() == Triple::ppc64 || 
TT.getArch() == Triple::ppc64le1.35M
);
60
2.52M
  };
61
};
62
} // end namespace llvm
63
64
#endif