LLVM  8.0.1
X86MCTargetDesc.h
Go to the documentation of this file.
1 //===-- X86MCTargetDesc.h - X86 Target Descriptions -------------*- 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 provides X86 specific target descriptions.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCTARGETDESC_H
15 #define LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCTARGETDESC_H
16 
17 #include "llvm/MC/MCStreamer.h"
18 #include "llvm/Support/DataTypes.h"
19 #include <string>
20 
21 namespace llvm {
22 class MCAsmBackend;
23 class MCCodeEmitter;
24 class MCContext;
25 class MCInstrInfo;
26 class MCObjectTargetWriter;
27 class MCObjectWriter;
28 class MCRegisterInfo;
29 class MCSubtargetInfo;
30 class MCRelocationInfo;
31 class MCTargetOptions;
32 class Target;
33 class Triple;
34 class StringRef;
35 class raw_ostream;
36 class raw_pwrite_stream;
37 
38 Target &getTheX86_32Target();
39 Target &getTheX86_64Target();
40 
41 /// Flavour of dwarf regnumbers
42 ///
43 namespace DWARFFlavour {
44  enum {
46  };
47 }
48 
49 /// Native X86 register numbers
50 ///
51 namespace N86 {
52  enum {
53  EAX = 0, ECX = 1, EDX = 2, EBX = 3, ESP = 4, EBP = 5, ESI = 6, EDI = 7
54  };
55 }
56 
57 namespace X86_MC {
58 std::string ParseX86Triple(const Triple &TT);
59 
60 unsigned getDwarfRegFlavour(const Triple &TT, bool isEH);
61 
63 
64 /// Create a X86 MCSubtargetInfo instance. This is exposed so Asm parser, etc.
65 /// do not need to go through TargetRegistry.
67  StringRef FS);
68 }
69 
71  const MCRegisterInfo &MRI,
72  MCContext &Ctx);
73 
75  const MCSubtargetInfo &STI,
76  const MCRegisterInfo &MRI,
77  const MCTargetOptions &Options);
79  const MCSubtargetInfo &STI,
80  const MCRegisterInfo &MRI,
81  const MCTargetOptions &Options);
82 
83 /// Implements X86-only directives for assembly emission.
86  MCInstPrinter *InstPrint,
87  bool isVerboseAsm);
88 
89 /// Implements X86-only directives for object files.
91  const MCSubtargetInfo &STI);
92 
93 /// Construct an X86 Windows COFF machine code streamer which will generate
94 /// PE/COFF format object files.
95 ///
96 /// Takes ownership of \p AB and \p CE.
98  std::unique_ptr<MCAsmBackend> &&AB,
99  std::unique_ptr<MCObjectWriter> &&OW,
100  std::unique_ptr<MCCodeEmitter> &&CE,
101  bool RelaxAll,
102  bool IncrementalLinkerCompatible);
103 
104 /// Construct an X86 Mach-O object writer.
105 std::unique_ptr<MCObjectTargetWriter>
106 createX86MachObjectWriter(bool Is64Bit, uint32_t CPUType, uint32_t CPUSubtype);
107 
108 /// Construct an X86 ELF object writer.
109 std::unique_ptr<MCObjectTargetWriter>
110 createX86ELFObjectWriter(bool IsELF64, uint8_t OSABI, uint16_t EMachine);
111 /// Construct an X86 Win COFF object writer.
112 std::unique_ptr<MCObjectTargetWriter>
113 createX86WinCOFFObjectWriter(bool Is64Bit);
114 
115 /// Returns the sub or super register of a specific X86 register.
116 /// e.g. getX86SubSuperRegister(X86::EAX, 16) returns X86::AX.
117 /// Aborts on error.
118 unsigned getX86SubSuperRegister(unsigned, unsigned, bool High=false);
119 
120 /// Returns the sub or super register of a specific X86 register.
121 /// Like getX86SubSuperRegister() but returns 0 on error.
122 unsigned getX86SubSuperRegisterOrZero(unsigned, unsigned,
123  bool High = false);
124 
125 } // End llvm namespace
126 
127 
128 // Defines symbolic names for X86 registers. This defines a mapping from
129 // register name to register number.
130 //
131 #define GET_REGINFO_ENUM
132 #include "X86GenRegisterInfo.inc"
133 
134 // Defines symbolic names for the X86 instructions.
135 //
136 #define GET_INSTRINFO_ENUM
137 #define GET_INSTRINFO_MC_HELPER_DECLS
138 #include "X86GenInstrInfo.inc"
139 
140 #define GET_SUBTARGETINFO_ENUM
141 #include "X86GenSubtargetInfo.inc"
142 
143 #endif
uint64_t CallInst * C
This class represents lattice values for constants.
Definition: AllocatorList.h:24
formatted_raw_ostream - A raw_ostream that wraps another one and keeps track of line and column posit...
MCTargetStreamer * createX86ObjectTargetStreamer(MCStreamer &OS, const MCSubtargetInfo &STI)
Implements X86-only directives for object files.
Target specific streamer interface.
Definition: MCStreamer.h:84
std::unique_ptr< MCObjectTargetWriter > createX86MachObjectWriter(bool Is64Bit, uint32_t CPUType, uint32_t CPUSubtype)
Construct an X86 Mach-O object writer.
unsigned getDwarfRegFlavour(const Triple &TT, bool isEH)
uint64_t High
std::string ParseX86Triple(const Triple &TT)
MCAsmBackend * createX86_32AsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const MCTargetOptions &Options)
MCCodeEmitter * createX86MCCodeEmitter(const MCInstrInfo &MCII, const MCRegisterInfo &MRI, MCContext &Ctx)
MCAsmBackend * createX86_64AsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const MCTargetOptions &Options)
Context object for machine code objects.
Definition: MCContext.h:63
std::unique_ptr< MCObjectTargetWriter > createX86ELFObjectWriter(bool IsELF64, uint8_t OSABI, uint16_t EMachine)
Construct an X86 ELF object writer.
std::unique_ptr< MCObjectTargetWriter > createX86WinCOFFObjectWriter(bool Is64Bit)
Construct an X86 Win COFF object writer.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Streaming machine code generation interface.
Definition: MCStreamer.h:189
unsigned const MachineRegisterInfo * MRI
MCCodeEmitter - Generic instruction encoding interface.
Definition: MCCodeEmitter.h:22
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:24
MCStreamer * createX86WinCOFFStreamer(MCContext &C, std::unique_ptr< MCAsmBackend > &&AB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE, bool RelaxAll, bool IncrementalLinkerCompatible)
Construct an X86 Windows COFF machine code streamer which will generate PE/COFF format object files...
MCTargetStreamer * createX86AsmTargetStreamer(MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint, bool isVerboseAsm)
Implements X86-only directives for assembly emission.
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
MCSubtargetInfo * createX86MCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS)
Create a X86 MCSubtargetInfo instance.
unsigned getX86SubSuperRegisterOrZero(unsigned, unsigned, bool High=false)
Returns the sub or super register of a specific X86 register.
void initLLVMToSEHAndCVRegMapping(MCRegisterInfo *MRI)
unsigned getX86SubSuperRegister(unsigned, unsigned, bool High=false)
Returns the sub or super register of a specific X86 register.
Target - Wrapper for Target specific information.
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:40
Generic base class for all target subtargets.
Target & getTheX86_32Target()
Generic interface to target specific assembler backends.
Definition: MCAsmBackend.h:42
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
Target & getTheX86_64Target()