blob: 644481446883cb04aaaa4edb04f7eb8f8fec5db3 [file] [log] [blame]
Alexei Starovoitove4c8c802015-01-24 17:51:26 +00001//===-- BPFTargetMachine.h - Define TargetMachine for BPF --- 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 declares the BPF specific subclass of TargetMachine.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_BPF_BPFTARGETMACHINE_H
15#define LLVM_LIB_TARGET_BPF_BPFTARGETMACHINE_H
16
17#include "BPFSubtarget.h"
18#include "llvm/Target/TargetMachine.h"
19
20namespace llvm {
21class BPFTargetMachine : public LLVMTargetMachine {
22 std::unique_ptr<TargetLoweringObjectFile> TLOF;
23 BPFSubtarget Subtarget;
24
25public:
Daniel Sanders3e5de882015-06-11 19:41:26 +000026 BPFTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
Rafael Espindola8c34dd82016-05-18 22:04:49 +000027 StringRef FS, const TargetOptions &Options,
28 Optional<Reloc::Model> RM, CodeModel::Model CM,
29 CodeGenOpt::Level OL);
Alexei Starovoitove4c8c802015-01-24 17:51:26 +000030
Eric Christopher4d0f35a2015-03-21 04:22:23 +000031 const BPFSubtarget *getSubtargetImpl() const { return &Subtarget; }
32 const BPFSubtarget *getSubtargetImpl(const Function &) const override {
33 return &Subtarget;
34 }
Alexei Starovoitove4c8c802015-01-24 17:51:26 +000035
36 TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
37
38 TargetLoweringObjectFile *getObjFileLowering() const override {
39 return TLOF.get();
40 }
41};
Alexander Kornienkof00654e2015-06-23 09:49:53 +000042}
Alexei Starovoitove4c8c802015-01-24 17:51:26 +000043
44#endif