blob: f5b45da0c3dc2225c58cb014faf23892f319fc07 [file] [log] [blame]
Chris Lattner02a3d832002-10-29 22:37:54 +00001//===-- X86TargetMachine.h - Define TargetMachine for the X86 ---*- C++ -*-===//
Misha Brukmanc88330a2005-04-21 23:38:14 +00002//
John Criswell29265fe2003-10-21 15:17:13 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattnerf3ebc3f2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Misha Brukmanc88330a2005-04-21 23:38:14 +00007//
John Criswell29265fe2003-10-21 15:17:13 +00008//===----------------------------------------------------------------------===//
Misha Brukmanc88330a2005-04-21 23:38:14 +00009//
Chris Lattner02a3d832002-10-29 22:37:54 +000010// This file declares the X86 specific subclass of TargetMachine.
11//
12//===----------------------------------------------------------------------===//
13
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000014#ifndef LLVM_LIB_TARGET_X86_X86TARGETMACHINE_H
15#define LLVM_LIB_TARGET_X86_X86TARGETMACHINE_H
Eugene Zelenkofbd13c52017-02-02 22:55:55 +000016
Anton Korobeynikovf7183ed2010-11-15 00:06:54 +000017#include "X86Subtarget.h"
Eugene Zelenkofbd13c52017-02-02 22:55:55 +000018#include "llvm/ADT/Optional.h"
19#include "llvm/ADT/StringMap.h"
20#include "llvm/Analysis/TargetTransformInfo.h"
21#include "llvm/Support/CodeGen.h"
Chandler Carruth802d7552012-12-04 07:12:27 +000022#include "llvm/Target/TargetMachine.h"
Eugene Zelenkofbd13c52017-02-02 22:55:55 +000023#include <memory>
Chris Lattner02a3d832002-10-29 22:37:54 +000024
Brian Gaeke960707c2003-11-11 22:41:34 +000025namespace llvm {
Andrew Trick808a7a62012-02-03 05:12:30 +000026
Evan Cheng2129f592011-07-19 06:37:02 +000027class StringRef;
Daniel Sanders0b5293f2017-04-06 09:49:34 +000028class X86Subtarget;
29class X86RegisterBankInfo;
Brian Gaeke960707c2003-11-11 22:41:34 +000030
Matthias Braunbb8507e2017-10-12 22:57:28 +000031class X86TargetMachine final : public LLVMTargetMachine {
Aditya Nandakumara2719322014-11-13 09:26:31 +000032 std::unique_ptr<TargetLoweringObjectFile> TLOF;
Eric Christopher3faf2f12014-10-06 06:45:36 +000033 mutable StringMap<std::unique_ptr<X86Subtarget>> SubtargetMap;
34
Chris Lattner02a3d832002-10-29 22:37:54 +000035public:
Daniel Sanders3e5de882015-06-11 19:41:26 +000036 X86TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
Rafael Espindola8c34dd82016-05-18 22:04:49 +000037 StringRef FS, const TargetOptions &Options,
Rafael Espindola79e238a2017-08-03 02:16:21 +000038 Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
39 CodeGenOpt::Level OL, bool JIT);
Reid Kleckner357600e2014-11-20 23:37:18 +000040 ~X86TargetMachine() override;
Eugene Zelenkofbd13c52017-02-02 22:55:55 +000041
Eric Christopher3faf2f12014-10-06 06:45:36 +000042 const X86Subtarget *getSubtargetImpl(const Function &F) const override;
Eric Christopher97ae58682017-07-25 22:21:08 +000043 // 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.
Eric Christopherb4fb2562017-06-30 19:49:05 +000046 const X86Subtarget *getSubtargetImpl() const = delete;
Rafael Espindolab8141d52014-08-05 22:10:21 +000047
Sanjoy Das26d11ca2017-12-22 18:21:59 +000048 TargetTransformInfo getTargetTransformInfo(const Function &F) override;
Chandler Carruth664e3542013-01-07 01:37:14 +000049
Chris Lattner12e97302006-09-04 04:14:57 +000050 // Set up the pass pipeline.
Craig Topper2d9361e2014-03-09 07:44:38 +000051 TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
Eugene Zelenkofbd13c52017-02-02 22:55:55 +000052
Aditya Nandakumara2719322014-11-13 09:26:31 +000053 TargetLoweringObjectFile *getObjFileLowering() const override {
54 return TLOF.get();
55 }
Chris Lattner02a3d832002-10-29 22:37:54 +000056};
Evan Cheng11b0a5d2006-09-08 06:48:29 +000057
Eugene Zelenkofbd13c52017-02-02 22:55:55 +000058} // end namespace llvm
Brian Gaeke960707c2003-11-11 22:41:34 +000059
Eugene Zelenkofbd13c52017-02-02 22:55:55 +000060#endif // LLVM_LIB_TARGET_X86_X86TARGETMACHINE_H