llir-opt  0.0.1
Low-Level Post-Link Optimiser for OCaml and C
x86.h
1 // This file if part of the llir-opt project.
2 // Licensing information can be found in the LICENSE file.
3 // (C) 2018 Nandor Licker. All rights reserved.
4 
5 #pragma once
6 
7 #include <llvm/Target/TargetMachine.h>
8 #include <llvm/Target/X86/X86Subtarget.h>
9 #include <llvm/Target/X86/X86TargetMachine.h>
10 
11 #include "core/target.h"
12 
13 class Func;
14 
15 
16 
20 class X86Target final : public Target {
21 private:
23  static const Kind kKind = Kind::X86;
24 
25 public:
26  X86Target(
27  const llvm::Triple &triple,
28  const std::string &cpu,
29  const std::string &tuneCPU,
30  const std::string &fs,
31  const std::string &abi,
32  bool shared
33  );
34 
36  llvm::X86TargetMachine &GetTargetMachine() { return *machine_; }
37 
39  const llvm::X86Subtarget &GetSubtarget(const Func &func) const;
40 
42  bool AllowsUnalignedStores() const override { return true; }
43 
44 private:
45  friend class Target;
47  std::unique_ptr<llvm::X86TargetMachine> machine_;
48 };
X86Target::GetSubtarget
const llvm::X86Subtarget & GetSubtarget(const Func &func) const
Returns the subtarget.
Definition: x86.cpp:56
Func
Definition: func.h:30
Target
Definition: target.h:24
X86Target
Definition: x86.h:20
X86Target::AllowsUnalignedStores
bool AllowsUnalignedStores() const override
X86 allows unaligned stores.
Definition: x86.h:42
X86Target::GetTargetMachine
llvm::X86TargetMachine & GetTargetMachine()
Returns the generic target machine.
Definition: x86.h:36
Target::Kind
Kind
Enumeration of supported targets.
Definition: target.h:27