LLVM  4.0.0
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 MCObjectWriter;
27 class MCRegisterInfo;
28 class MCSubtargetInfo;
29 class MCRelocationInfo;
30 class MCTargetOptions;
31 class Target;
32 class Triple;
33 class StringRef;
34 class raw_ostream;
35 class raw_pwrite_stream;
36 
39 
40 /// Flavour of dwarf regnumbers
41 ///
42 namespace DWARFFlavour {
43  enum {
45  };
46 }
47 
48 /// Native X86 register numbers
49 ///
50 namespace N86 {
51  enum {
52  EAX = 0, ECX = 1, EDX = 2, EBX = 3, ESP = 4, EBP = 5, ESI = 6, EDI = 7
53  };
54 }
55 
56 namespace X86_MC {
57 std::string ParseX86Triple(const Triple &TT);
58 
59 unsigned getDwarfRegFlavour(const Triple &TT, bool isEH);
60 
62 
63 /// Create a X86 MCSubtargetInfo instance. This is exposed so Asm parser, etc.
64 /// do not need to go through TargetRegistry.
66  StringRef FS);
67 }
68 
70  const MCRegisterInfo &MRI,
71  MCContext &Ctx);
72 
74  const Triple &TT, StringRef CPU,
75  const MCTargetOptions &Options);
77  const Triple &TT, StringRef CPU,
78  const MCTargetOptions &Options);
79 
80 /// Construct an X86 Windows COFF machine code streamer which will generate
81 /// PE/COFF format object files.
82 ///
83 /// Takes ownership of \p AB and \p CE.
87 
88 /// Construct an X86 Mach-O object writer.
91  uint32_t CPUSubtype);
92 
93 /// Construct an X86 ELF object writer.
95  uint8_t OSABI, uint16_t EMachine);
96 /// Construct an X86 Win COFF object writer.
98  bool Is64Bit);
99 
100 /// Returns the sub or super register of a specific X86 register.
101 /// e.g. getX86SubSuperRegister(X86::EAX, 16) returns X86::AX.
102 /// Aborts on error.
103 unsigned getX86SubSuperRegister(unsigned, unsigned, bool High=false);
104 
105 /// Returns the sub or super register of a specific X86 register.
106 /// Like getX86SubSuperRegister() but returns 0 on error.
107 unsigned getX86SubSuperRegisterOrZero(unsigned, unsigned,
108  bool High = false);
109 
110 } // End llvm namespace
111 
112 
113 // Defines symbolic names for X86 registers. This defines a mapping from
114 // register name to register number.
115 //
116 #define GET_REGINFO_ENUM
117 #include "X86GenRegisterInfo.inc"
118 
119 // Defines symbolic names for the X86 instructions.
120 //
121 #define GET_INSTRINFO_ENUM
122 #include "X86GenInstrInfo.inc"
123 
124 #define GET_SUBTARGETINFO_ENUM
125 #include "X86GenSubtargetInfo.inc"
126 
127 #endif
MCStreamer * createX86WinCOFFStreamer(MCContext &C, MCAsmBackend &AB, raw_pwrite_stream &OS, MCCodeEmitter *CE, bool RelaxAll, bool IncrementalLinkerCompatible)
Construct an X86 Windows COFF machine code streamer which will generate PE/COFF format object files...
unsigned getDwarfRegFlavour(const Triple &TT, bool isEH)
uint64_t High
Defines the object file and target independent interfaces used by the assembler backend to write nati...
std::string ParseX86Triple(const Triple &TT)
MCObjectWriter * createX86WinCOFFObjectWriter(raw_pwrite_stream &OS, bool Is64Bit)
Construct an X86 Win COFF object writer.
MCCodeEmitter * createX86MCCodeEmitter(const MCInstrInfo &MCII, const MCRegisterInfo &MRI, MCContext &Ctx)
Context object for machine code objects.
Definition: MCContext.h:51
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Streaming machine code generation interface.
Definition: MCStreamer.h:161
unsigned const MachineRegisterInfo * MRI
MCObjectWriter * createX86MachObjectWriter(raw_pwrite_stream &OS, bool Is64Bit, uint32_t CPUType, uint32_t CPUSubtype)
Construct an X86 Mach-O object writer.
MCCodeEmitter - Generic instruction encoding interface.
Definition: MCCodeEmitter.h:23
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:24
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.
cl::opt< bool > IncrementalLinkerCompatible("incremental-linker-compatible", cl::desc("When used with filetype=obj, ""emit an object file which can be used with an incremental linker"))
MCAsmBackend * createX86_64AsmBackend(const Target &T, const MCRegisterInfo &MRI, const Triple &TT, StringRef CPU, const MCTargetOptions &Options)
void initLLVMToSEHAndCVRegMapping(MCRegisterInfo *MRI)
CPUType
These values correspond to the CV_CPU_TYPE_e enumeration, and are documented here: https://msdn...
Definition: CodeView.h:73
static const char * Target
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
unsigned getX86SubSuperRegister(unsigned, unsigned, bool High=false)
Returns the sub or super register of a specific X86 register.
MCObjectWriter * createX86ELFObjectWriter(raw_pwrite_stream &OS, bool IsELF64, uint8_t OSABI, uint16_t EMachine)
Construct an X86 ELF object writer.
Target - Wrapper for Target specific information.
MCSubtargetInfo - Generic base class for all target subtargets.
Target & getTheX86_32Target()
MCAsmBackend * createX86_32AsmBackend(const Target &T, const MCRegisterInfo &MRI, const Triple &TT, StringRef CPU, const MCTargetOptions &Options)
An abstract base class for streams implementations that also support a pwrite operation.
Definition: raw_ostream.h:333
cl::opt< bool > RelaxAll("mc-relax-all", cl::desc("When used with filetype=obj, ""relax all fixups in the emitted object file"))
Generic interface to target specific assembler backends.
Definition: MCAsmBackend.h:36
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:47
Target & getTheX86_64Target()