LLVM API Documentation
00001 //===-- X86MCTargetDesc.h - X86 Target Descriptions -------------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file provides X86 specific target descriptions. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCTARGETDESC_H 00015 #define LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCTARGETDESC_H 00016 00017 #include "llvm/Support/DataTypes.h" 00018 #include <string> 00019 00020 namespace llvm { 00021 class MCAsmBackend; 00022 class MCCodeEmitter; 00023 class MCContext; 00024 class MCInstrInfo; 00025 class MCObjectWriter; 00026 class MCRegisterInfo; 00027 class MCSubtargetInfo; 00028 class MCRelocationInfo; 00029 class MCStreamer; 00030 class Target; 00031 class Triple; 00032 class StringRef; 00033 class raw_ostream; 00034 00035 extern Target TheX86_32Target, TheX86_64Target; 00036 00037 /// DWARFFlavour - Flavour of dwarf regnumbers 00038 /// 00039 namespace DWARFFlavour { 00040 enum { 00041 X86_64 = 0, X86_32_DarwinEH = 1, X86_32_Generic = 2 00042 }; 00043 } 00044 00045 /// N86 namespace - Native X86 register numbers 00046 /// 00047 namespace N86 { 00048 enum { 00049 EAX = 0, ECX = 1, EDX = 2, EBX = 3, ESP = 4, EBP = 5, ESI = 6, EDI = 7 00050 }; 00051 } 00052 00053 namespace X86_MC { 00054 std::string ParseX86Triple(StringRef TT); 00055 00056 /// GetCpuIDAndInfo - Execute the specified cpuid and return the 4 values in 00057 /// the specified arguments. If we can't run cpuid on the host, return true. 00058 bool GetCpuIDAndInfo(unsigned value, unsigned *rEAX, 00059 unsigned *rEBX, unsigned *rECX, unsigned *rEDX); 00060 /// GetCpuIDAndInfoEx - Execute the specified cpuid with subleaf and return 00061 /// the 4 values in the specified arguments. If we can't run cpuid on the 00062 /// host, return true. 00063 bool GetCpuIDAndInfoEx(unsigned value, unsigned subleaf, unsigned *rEAX, 00064 unsigned *rEBX, unsigned *rECX, unsigned *rEDX); 00065 00066 void DetectFamilyModel(unsigned EAX, unsigned &Family, unsigned &Model); 00067 00068 unsigned getDwarfRegFlavour(Triple TT, bool isEH); 00069 00070 void InitLLVM2SEHRegisterMapping(MCRegisterInfo *MRI); 00071 00072 /// createX86MCSubtargetInfo - Create a X86 MCSubtargetInfo instance. 00073 /// This is exposed so Asm parser, etc. do not need to go through 00074 /// TargetRegistry. 00075 MCSubtargetInfo *createX86MCSubtargetInfo(StringRef TT, StringRef CPU, 00076 StringRef FS); 00077 } 00078 00079 MCCodeEmitter *createX86MCCodeEmitter(const MCInstrInfo &MCII, 00080 const MCRegisterInfo &MRI, 00081 const MCSubtargetInfo &STI, 00082 MCContext &Ctx); 00083 00084 MCAsmBackend *createX86_32AsmBackend(const Target &T, const MCRegisterInfo &MRI, 00085 StringRef TT, StringRef CPU); 00086 MCAsmBackend *createX86_64AsmBackend(const Target &T, const MCRegisterInfo &MRI, 00087 StringRef TT, StringRef CPU); 00088 00089 /// createX86WinCOFFStreamer - Construct an X86 Windows COFF machine code 00090 /// streamer which will generate PE/COFF format object files. 00091 /// 00092 /// Takes ownership of \p AB and \p CE. 00093 MCStreamer *createX86WinCOFFStreamer(MCContext &C, MCAsmBackend &AB, 00094 MCCodeEmitter *CE, raw_ostream &OS, 00095 bool RelaxAll); 00096 00097 /// createX86MachObjectWriter - Construct an X86 Mach-O object writer. 00098 MCObjectWriter *createX86MachObjectWriter(raw_ostream &OS, 00099 bool Is64Bit, 00100 uint32_t CPUType, 00101 uint32_t CPUSubtype); 00102 00103 /// createX86ELFObjectWriter - Construct an X86 ELF object writer. 00104 MCObjectWriter *createX86ELFObjectWriter(raw_ostream &OS, 00105 bool IsELF64, 00106 uint8_t OSABI, 00107 uint16_t EMachine); 00108 /// createX86WinCOFFObjectWriter - Construct an X86 Win COFF object writer. 00109 MCObjectWriter *createX86WinCOFFObjectWriter(raw_ostream &OS, bool Is64Bit); 00110 00111 /// createX86_64MachORelocationInfo - Construct X86-64 Mach-O relocation info. 00112 MCRelocationInfo *createX86_64MachORelocationInfo(MCContext &Ctx); 00113 00114 /// createX86_64ELFORelocationInfo - Construct X86-64 ELF relocation info. 00115 MCRelocationInfo *createX86_64ELFRelocationInfo(MCContext &Ctx); 00116 } // End llvm namespace 00117 00118 00119 // Defines symbolic names for X86 registers. This defines a mapping from 00120 // register name to register number. 00121 // 00122 #define GET_REGINFO_ENUM 00123 #include "X86GenRegisterInfo.inc" 00124 00125 // Defines symbolic names for the X86 instructions. 00126 // 00127 #define GET_INSTRINFO_ENUM 00128 #include "X86GenInstrInfo.inc" 00129 00130 #define GET_SUBTARGETINFO_ENUM 00131 #include "X86GenSubtargetInfo.inc" 00132 00133 #endif