Jia Liu | b22310f | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 1 | //===-- X86MCTargetDesc.cpp - X86 Target Descriptions ---------------------===// |
Evan Cheng | 2475331 | 2011-06-24 01:44:41 +0000 | [diff] [blame] | 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 | |
Evan Cheng | 3ddfbd3 | 2011-07-06 22:01:53 +0000 | [diff] [blame] | 14 | #include "X86MCTargetDesc.h" |
Evan Cheng | 61faa55 | 2011-07-25 21:20:24 +0000 | [diff] [blame] | 15 | #include "InstPrinter/X86ATTInstPrinter.h" |
| 16 | #include "InstPrinter/X86IntelInstPrinter.h" |
Chandler Carruth | ed0881b | 2012-12-03 16:50:05 +0000 | [diff] [blame] | 17 | #include "X86MCAsmInfo.h" |
| 18 | #include "llvm/ADT/Triple.h" |
Evan Cheng | 4d6c9d7 | 2011-08-23 20:15:21 +0000 | [diff] [blame] | 19 | #include "llvm/MC/MCCodeGenInfo.h" |
| 20 | #include "llvm/MC/MCInstrAnalysis.h" |
Evan Cheng | 1e210d0 | 2011-06-28 20:07:07 +0000 | [diff] [blame] | 21 | #include "llvm/MC/MCInstrInfo.h" |
Evan Cheng | 2475331 | 2011-06-24 01:44:41 +0000 | [diff] [blame] | 22 | #include "llvm/MC/MCRegisterInfo.h" |
Evan Cheng | b253100 | 2011-07-25 19:33:48 +0000 | [diff] [blame] | 23 | #include "llvm/MC/MCStreamer.h" |
Evan Cheng | 0711c4d | 2011-07-01 22:25:04 +0000 | [diff] [blame] | 24 | #include "llvm/MC/MCSubtargetInfo.h" |
Chandler Carruth | ed0881b | 2012-12-03 16:50:05 +0000 | [diff] [blame] | 25 | #include "llvm/MC/MachineLocation.h" |
Craig Topper | c4965bc | 2012-02-05 07:21:30 +0000 | [diff] [blame] | 26 | #include "llvm/Support/ErrorHandling.h" |
Chandler Carruth | ed0881b | 2012-12-03 16:50:05 +0000 | [diff] [blame] | 27 | #include "llvm/Support/Host.h" |
Evan Cheng | 2bb4035 | 2011-08-24 18:08:43 +0000 | [diff] [blame] | 28 | #include "llvm/Support/TargetRegistry.h" |
Evan Cheng | d9997ac | 2011-06-27 18:32:37 +0000 | [diff] [blame] | 29 | |
Chandler Carruth | d174b72 | 2014-04-22 02:03:14 +0000 | [diff] [blame] | 30 | #if _MSC_VER |
| 31 | #include <intrin.h> |
| 32 | #endif |
| 33 | |
| 34 | using namespace llvm; |
| 35 | |
Evan Cheng | d9997ac | 2011-06-27 18:32:37 +0000 | [diff] [blame] | 36 | #define GET_REGINFO_MC_DESC |
| 37 | #include "X86GenRegisterInfo.inc" |
Evan Cheng | 1e210d0 | 2011-06-28 20:07:07 +0000 | [diff] [blame] | 38 | |
| 39 | #define GET_INSTRINFO_MC_DESC |
| 40 | #include "X86GenInstrInfo.inc" |
| 41 | |
Evan Cheng | 0711c4d | 2011-07-01 22:25:04 +0000 | [diff] [blame] | 42 | #define GET_SUBTARGETINFO_MC_DESC |
Evan Cheng | c9c090d | 2011-07-01 22:36:09 +0000 | [diff] [blame] | 43 | #include "X86GenSubtargetInfo.inc" |
Evan Cheng | 0711c4d | 2011-07-01 22:25:04 +0000 | [diff] [blame] | 44 | |
Evan Cheng | 13bcc6c | 2011-07-07 21:06:52 +0000 | [diff] [blame] | 45 | std::string X86_MC::ParseX86Triple(StringRef TT) { |
| 46 | Triple TheTriple(TT); |
Nick Lewycky | 73df7e3 | 2011-09-05 21:51:43 +0000 | [diff] [blame] | 47 | std::string FS; |
Evan Cheng | 13bcc6c | 2011-07-07 21:06:52 +0000 | [diff] [blame] | 48 | if (TheTriple.getArch() == Triple::x86_64) |
Craig Topper | 3c80d62 | 2014-01-06 04:55:54 +0000 | [diff] [blame] | 49 | FS = "+64bit-mode,-32bit-mode,-16bit-mode"; |
David Woodhouse | 71d15ed | 2014-01-20 12:02:25 +0000 | [diff] [blame] | 50 | else if (TheTriple.getEnvironment() != Triple::CODE16) |
Craig Topper | 3c80d62 | 2014-01-06 04:55:54 +0000 | [diff] [blame] | 51 | FS = "-64bit-mode,+32bit-mode,-16bit-mode"; |
David Woodhouse | 71d15ed | 2014-01-20 12:02:25 +0000 | [diff] [blame] | 52 | else |
| 53 | FS = "-64bit-mode,-32bit-mode,+16bit-mode"; |
| 54 | |
Nick Lewycky | 73df7e3 | 2011-09-05 21:51:43 +0000 | [diff] [blame] | 55 | return FS; |
Evan Cheng | 13bcc6c | 2011-07-07 21:06:52 +0000 | [diff] [blame] | 56 | } |
| 57 | |
Eric Christopher | 1f8ad4f | 2014-06-10 22:34:28 +0000 | [diff] [blame] | 58 | unsigned X86_MC::getDwarfRegFlavour(Triple TT, bool isEH) { |
| 59 | if (TT.getArch() == Triple::x86_64) |
Evan Cheng | d60fa58b | 2011-07-18 20:57:22 +0000 | [diff] [blame] | 60 | return DWARFFlavour::X86_64; |
| 61 | |
Eric Christopher | 1f8ad4f | 2014-06-10 22:34:28 +0000 | [diff] [blame] | 62 | if (TT.isOSDarwin()) |
Evan Cheng | d60fa58b | 2011-07-18 20:57:22 +0000 | [diff] [blame] | 63 | return isEH ? DWARFFlavour::X86_32_DarwinEH : DWARFFlavour::X86_32_Generic; |
Eric Christopher | 1f8ad4f | 2014-06-10 22:34:28 +0000 | [diff] [blame] | 64 | if (TT.isOSCygMing()) |
Evan Cheng | d60fa58b | 2011-07-18 20:57:22 +0000 | [diff] [blame] | 65 | // Unsupported by now, just quick fallback |
| 66 | return DWARFFlavour::X86_32_Generic; |
| 67 | return DWARFFlavour::X86_32_Generic; |
| 68 | } |
| 69 | |
Evan Cheng | d60fa58b | 2011-07-18 20:57:22 +0000 | [diff] [blame] | 70 | void X86_MC::InitLLVM2SEHRegisterMapping(MCRegisterInfo *MRI) { |
| 71 | // FIXME: TableGen these. |
| 72 | for (unsigned Reg = X86::NoRegister+1; Reg < X86::NUM_TARGET_REGS; ++Reg) { |
Michael Liao | f54249b | 2012-10-04 19:50:43 +0000 | [diff] [blame] | 73 | unsigned SEH = MRI->getEncodingValue(Reg); |
Evan Cheng | d60fa58b | 2011-07-18 20:57:22 +0000 | [diff] [blame] | 74 | MRI->mapLLVMRegToSEHReg(Reg, SEH); |
| 75 | } |
| 76 | } |
| 77 | |
Evan Cheng | 4d1ca96 | 2011-07-08 01:53:10 +0000 | [diff] [blame] | 78 | MCSubtargetInfo *X86_MC::createX86MCSubtargetInfo(StringRef TT, StringRef CPU, |
| 79 | StringRef FS) { |
Evan Cheng | 13bcc6c | 2011-07-07 21:06:52 +0000 | [diff] [blame] | 80 | std::string ArchFS = X86_MC::ParseX86Triple(TT); |
| 81 | if (!FS.empty()) { |
| 82 | if (!ArchFS.empty()) |
Yaron Keren | 75e0c4b | 2015-03-27 17:51:30 +0000 | [diff] [blame] | 83 | ArchFS = (Twine(ArchFS) + "," + FS).str(); |
Evan Cheng | 13bcc6c | 2011-07-07 21:06:52 +0000 | [diff] [blame] | 84 | else |
| 85 | ArchFS = FS; |
| 86 | } |
| 87 | |
| 88 | std::string CPUName = CPU; |
Jim Grosbach | a344b6c3 | 2014-04-14 22:23:30 +0000 | [diff] [blame] | 89 | if (CPUName.empty()) |
Evan Cheng | 964cb5f | 2011-07-08 21:14:14 +0000 | [diff] [blame] | 90 | CPUName = "generic"; |
Evan Cheng | 13bcc6c | 2011-07-07 21:06:52 +0000 | [diff] [blame] | 91 | |
Evan Cheng | 0711c4d | 2011-07-01 22:25:04 +0000 | [diff] [blame] | 92 | MCSubtargetInfo *X = new MCSubtargetInfo(); |
Evan Cheng | c5e6d2f | 2011-07-11 03:57:24 +0000 | [diff] [blame] | 93 | InitX86MCSubtargetInfo(X, TT, CPUName, ArchFS); |
Evan Cheng | 4d1ca96 | 2011-07-08 01:53:10 +0000 | [diff] [blame] | 94 | return X; |
| 95 | } |
| 96 | |
Evan Cheng | 1705ab0 | 2011-07-14 23:50:31 +0000 | [diff] [blame] | 97 | static MCInstrInfo *createX86MCInstrInfo() { |
Evan Cheng | 4d1ca96 | 2011-07-08 01:53:10 +0000 | [diff] [blame] | 98 | MCInstrInfo *X = new MCInstrInfo(); |
| 99 | InitX86MCInstrInfo(X); |
| 100 | return X; |
| 101 | } |
| 102 | |
Evan Cheng | d60fa58b | 2011-07-18 20:57:22 +0000 | [diff] [blame] | 103 | static MCRegisterInfo *createX86MCRegisterInfo(StringRef TT) { |
| 104 | Triple TheTriple(TT); |
| 105 | unsigned RA = (TheTriple.getArch() == Triple::x86_64) |
| 106 | ? X86::RIP // Should have dwarf #16. |
| 107 | : X86::EIP; // Should have dwarf #8. |
| 108 | |
Evan Cheng | 1705ab0 | 2011-07-14 23:50:31 +0000 | [diff] [blame] | 109 | MCRegisterInfo *X = new MCRegisterInfo(); |
Evan Cheng | d60fa58b | 2011-07-18 20:57:22 +0000 | [diff] [blame] | 110 | InitX86MCRegisterInfo(X, RA, |
Eric Christopher | 1f8ad4f | 2014-06-10 22:34:28 +0000 | [diff] [blame] | 111 | X86_MC::getDwarfRegFlavour(TheTriple, false), |
| 112 | X86_MC::getDwarfRegFlavour(TheTriple, true), |
Jim Grosbach | 6df9484 | 2012-12-19 23:38:53 +0000 | [diff] [blame] | 113 | RA); |
Evan Cheng | d60fa58b | 2011-07-18 20:57:22 +0000 | [diff] [blame] | 114 | X86_MC::InitLLVM2SEHRegisterMapping(X); |
Evan Cheng | 1705ab0 | 2011-07-14 23:50:31 +0000 | [diff] [blame] | 115 | return X; |
| 116 | } |
| 117 | |
Daniel Sanders | 7813ae8 | 2015-06-04 13:12:25 +0000 | [diff] [blame] | 118 | static MCAsmInfo *createX86MCAsmInfo(const MCRegisterInfo &MRI, |
| 119 | const Triple &TheTriple) { |
Evan Cheng | 67c033e | 2011-07-18 22:29:13 +0000 | [diff] [blame] | 120 | bool is64Bit = TheTriple.getArch() == Triple::x86_64; |
Evan Cheng | 1705ab0 | 2011-07-14 23:50:31 +0000 | [diff] [blame] | 121 | |
Evan Cheng | 67c033e | 2011-07-18 22:29:13 +0000 | [diff] [blame] | 122 | MCAsmInfo *MAI; |
Tim Northover | d6a729b | 2014-01-06 14:28:05 +0000 | [diff] [blame] | 123 | if (TheTriple.isOSBinFormatMachO()) { |
Evan Cheng | 67c033e | 2011-07-18 22:29:13 +0000 | [diff] [blame] | 124 | if (is64Bit) |
| 125 | MAI = new X86_64MCAsmInfoDarwin(TheTriple); |
Evan Cheng | 1705ab0 | 2011-07-14 23:50:31 +0000 | [diff] [blame] | 126 | else |
Evan Cheng | 67c033e | 2011-07-18 22:29:13 +0000 | [diff] [blame] | 127 | MAI = new X86MCAsmInfoDarwin(TheTriple); |
Saleem Abdulrasool | 3547633 | 2014-03-06 20:47:11 +0000 | [diff] [blame] | 128 | } else if (TheTriple.isOSBinFormatELF()) { |
Andrew Kaylor | feb805f | 2012-10-02 18:38:34 +0000 | [diff] [blame] | 129 | // Force the use of an ELF container. |
| 130 | MAI = new X86ELFMCAsmInfo(TheTriple); |
Reid Kleckner | d970702 | 2014-11-17 22:55:59 +0000 | [diff] [blame] | 131 | } else if (TheTriple.isWindowsMSVCEnvironment()) { |
Michael J. Spencer | de3a211 | 2011-11-29 18:00:06 +0000 | [diff] [blame] | 132 | MAI = new X86MCAsmInfoMicrosoft(TheTriple); |
Saleem Abdulrasool | 862e60c | 2014-07-17 16:27:40 +0000 | [diff] [blame] | 133 | } else if (TheTriple.isOSCygMing() || |
| 134 | TheTriple.isWindowsItaniumEnvironment()) { |
Michael J. Spencer | de3a211 | 2011-11-29 18:00:06 +0000 | [diff] [blame] | 135 | MAI = new X86MCAsmInfoGNUCOFF(TheTriple); |
Evan Cheng | 67c033e | 2011-07-18 22:29:13 +0000 | [diff] [blame] | 136 | } else { |
Andrew Kaylor | feb805f | 2012-10-02 18:38:34 +0000 | [diff] [blame] | 137 | // The default is ELF. |
Evan Cheng | 67c033e | 2011-07-18 22:29:13 +0000 | [diff] [blame] | 138 | MAI = new X86ELFMCAsmInfo(TheTriple); |
Evan Cheng | 1705ab0 | 2011-07-14 23:50:31 +0000 | [diff] [blame] | 139 | } |
| 140 | |
Evan Cheng | 67c033e | 2011-07-18 22:29:13 +0000 | [diff] [blame] | 141 | // Initialize initial frame state. |
| 142 | // Calculate amount of bytes used for return address storing |
| 143 | int stackGrowth = is64Bit ? -8 : -4; |
Evan Cheng | 1705ab0 | 2011-07-14 23:50:31 +0000 | [diff] [blame] | 144 | |
Evan Cheng | 67c033e | 2011-07-18 22:29:13 +0000 | [diff] [blame] | 145 | // Initial state of the frame pointer is esp+stackGrowth. |
Rafael Espindola | 227144c | 2013-05-13 01:16:13 +0000 | [diff] [blame] | 146 | unsigned StackPtr = is64Bit ? X86::RSP : X86::ESP; |
| 147 | MCCFIInstruction Inst = MCCFIInstruction::createDefCfa( |
Craig Topper | 062a2ba | 2014-04-25 05:30:21 +0000 | [diff] [blame] | 148 | nullptr, MRI.getDwarfRegNum(StackPtr, true), -stackGrowth); |
Rafael Espindola | 227144c | 2013-05-13 01:16:13 +0000 | [diff] [blame] | 149 | MAI->addInitialFrameState(Inst); |
Evan Cheng | 67c033e | 2011-07-18 22:29:13 +0000 | [diff] [blame] | 150 | |
| 151 | // Add return address to move list |
Rafael Espindola | 227144c | 2013-05-13 01:16:13 +0000 | [diff] [blame] | 152 | unsigned InstPtr = is64Bit ? X86::RIP : X86::EIP; |
| 153 | MCCFIInstruction Inst2 = MCCFIInstruction::createOffset( |
Craig Topper | 062a2ba | 2014-04-25 05:30:21 +0000 | [diff] [blame] | 154 | nullptr, MRI.getDwarfRegNum(InstPtr, true), stackGrowth); |
Rafael Espindola | 227144c | 2013-05-13 01:16:13 +0000 | [diff] [blame] | 155 | MAI->addInitialFrameState(Inst2); |
Evan Cheng | 67c033e | 2011-07-18 22:29:13 +0000 | [diff] [blame] | 156 | |
| 157 | return MAI; |
Evan Cheng | 1705ab0 | 2011-07-14 23:50:31 +0000 | [diff] [blame] | 158 | } |
| 159 | |
Evan Cheng | 6376593 | 2011-07-23 00:01:04 +0000 | [diff] [blame] | 160 | static MCCodeGenInfo *createX86MCCodeGenInfo(StringRef TT, Reloc::Model RM, |
Evan Cheng | ecb2908 | 2011-11-16 08:38:26 +0000 | [diff] [blame] | 161 | CodeModel::Model CM, |
| 162 | CodeGenOpt::Level OL) { |
Evan Cheng | 2129f59 | 2011-07-19 06:37:02 +0000 | [diff] [blame] | 163 | MCCodeGenInfo *X = new MCCodeGenInfo(); |
| 164 | |
| 165 | Triple T(TT); |
| 166 | bool is64Bit = T.getArch() == Triple::x86_64; |
| 167 | |
| 168 | if (RM == Reloc::Default) { |
| 169 | // Darwin defaults to PIC in 64 bit mode and dynamic-no-pic in 32 bit mode. |
| 170 | // Win64 requires rip-rel addressing, thus we force it to PIC. Otherwise we |
| 171 | // use static relocation model by default. |
| 172 | if (T.isOSDarwin()) { |
| 173 | if (is64Bit) |
| 174 | RM = Reloc::PIC_; |
| 175 | else |
| 176 | RM = Reloc::DynamicNoPIC; |
| 177 | } else if (T.isOSWindows() && is64Bit) |
| 178 | RM = Reloc::PIC_; |
| 179 | else |
| 180 | RM = Reloc::Static; |
| 181 | } |
| 182 | |
| 183 | // ELF and X86-64 don't have a distinct DynamicNoPIC model. DynamicNoPIC |
| 184 | // is defined as a model for code which may be used in static or dynamic |
| 185 | // executables but not necessarily a shared library. On X86-32 we just |
| 186 | // compile in -static mode, in x86-64 we use PIC. |
| 187 | if (RM == Reloc::DynamicNoPIC) { |
| 188 | if (is64Bit) |
| 189 | RM = Reloc::PIC_; |
| 190 | else if (!T.isOSDarwin()) |
| 191 | RM = Reloc::Static; |
| 192 | } |
| 193 | |
| 194 | // If we are on Darwin, disallow static relocation model in X86-64 mode, since |
| 195 | // the Mach-O file format doesn't support it. |
| 196 | if (RM == Reloc::Static && T.isOSDarwin() && is64Bit) |
| 197 | RM = Reloc::PIC_; |
| 198 | |
Evan Cheng | efd9b42 | 2011-07-20 07:51:56 +0000 | [diff] [blame] | 199 | // For static codegen, if we're not already set, use Small codegen. |
| 200 | if (CM == CodeModel::Default) |
| 201 | CM = CodeModel::Small; |
| 202 | else if (CM == CodeModel::JITDefault) |
| 203 | // 64-bit JIT places everything in the same buffer except external funcs. |
| 204 | CM = is64Bit ? CodeModel::Large : CodeModel::Small; |
| 205 | |
Jim Grosbach | 4c98cf7 | 2015-05-15 19:13:31 +0000 | [diff] [blame] | 206 | X->initMCCodeGenInfo(RM, CM, OL); |
Evan Cheng | 2129f59 | 2011-07-19 06:37:02 +0000 | [diff] [blame] | 207 | return X; |
| 208 | } |
| 209 | |
Eric Christopher | f801940 | 2015-03-31 00:10:04 +0000 | [diff] [blame] | 210 | static MCInstPrinter *createX86MCInstPrinter(const Triple &T, |
| 211 | unsigned SyntaxVariant, |
James Molloy | 4c493e8 | 2011-09-07 17:24:38 +0000 | [diff] [blame] | 212 | const MCAsmInfo &MAI, |
Craig Topper | 54bfde7 | 2012-04-02 06:09:36 +0000 | [diff] [blame] | 213 | const MCInstrInfo &MII, |
Eric Christopher | f801940 | 2015-03-31 00:10:04 +0000 | [diff] [blame] | 214 | const MCRegisterInfo &MRI) { |
Evan Cheng | 61faa55 | 2011-07-25 21:20:24 +0000 | [diff] [blame] | 215 | if (SyntaxVariant == 0) |
Eric Christopher | 9c1bd05 | 2015-03-30 22:16:37 +0000 | [diff] [blame] | 216 | return new X86ATTInstPrinter(MAI, MII, MRI); |
Evan Cheng | 61faa55 | 2011-07-25 21:20:24 +0000 | [diff] [blame] | 217 | if (SyntaxVariant == 1) |
Craig Topper | 54bfde7 | 2012-04-02 06:09:36 +0000 | [diff] [blame] | 218 | return new X86IntelInstPrinter(MAI, MII, MRI); |
Craig Topper | 062a2ba | 2014-04-25 05:30:21 +0000 | [diff] [blame] | 219 | return nullptr; |
Evan Cheng | 61faa55 | 2011-07-25 21:20:24 +0000 | [diff] [blame] | 220 | } |
| 221 | |
Daniel Sanders | 9aa7e38 | 2015-06-10 10:54:40 +0000 | [diff] [blame] | 222 | static MCRelocationInfo *createX86MCRelocationInfo(const Triple &TheTriple, |
Quentin Colombet | f482805 | 2013-05-24 22:51:52 +0000 | [diff] [blame] | 223 | MCContext &Ctx) { |
Tim Northover | 9653eb5 | 2013-12-10 16:57:43 +0000 | [diff] [blame] | 224 | if (TheTriple.isOSBinFormatMachO() && TheTriple.getArch() == Triple::x86_64) |
Ahmed Bougacha | ad1084d | 2013-05-24 00:39:57 +0000 | [diff] [blame] | 225 | return createX86_64MachORelocationInfo(Ctx); |
| 226 | else if (TheTriple.isOSBinFormatELF()) |
| 227 | return createX86_64ELFRelocationInfo(Ctx); |
| 228 | // Default to the stock relocation info. |
Daniel Sanders | 9aa7e38 | 2015-06-10 10:54:40 +0000 | [diff] [blame] | 229 | return llvm::createMCRelocationInfo(TheTriple, Ctx); |
Ahmed Bougacha | ad1084d | 2013-05-24 00:39:57 +0000 | [diff] [blame] | 230 | } |
| 231 | |
Evan Cheng | 4d6c9d7 | 2011-08-23 20:15:21 +0000 | [diff] [blame] | 232 | static MCInstrAnalysis *createX86MCInstrAnalysis(const MCInstrInfo *Info) { |
| 233 | return new MCInstrAnalysis(Info); |
| 234 | } |
| 235 | |
Evan Cheng | 8c886a4 | 2011-07-22 21:58:54 +0000 | [diff] [blame] | 236 | // Force static initialization. |
| 237 | extern "C" void LLVMInitializeX86TargetMC() { |
Rafael Espindola | 69244c3 | 2015-03-18 23:15:49 +0000 | [diff] [blame] | 238 | for (Target *T : {&TheX86_32Target, &TheX86_64Target}) { |
| 239 | // Register the MC asm info. |
| 240 | RegisterMCAsmInfoFn X(*T, createX86MCAsmInfo); |
Evan Cheng | 8c886a4 | 2011-07-22 21:58:54 +0000 | [diff] [blame] | 241 | |
Rafael Espindola | 69244c3 | 2015-03-18 23:15:49 +0000 | [diff] [blame] | 242 | // Register the MC codegen info. |
| 243 | RegisterMCCodeGenInfoFn Y(*T, createX86MCCodeGenInfo); |
Evan Cheng | 8c886a4 | 2011-07-22 21:58:54 +0000 | [diff] [blame] | 244 | |
Rafael Espindola | 69244c3 | 2015-03-18 23:15:49 +0000 | [diff] [blame] | 245 | // Register the MC instruction info. |
| 246 | TargetRegistry::RegisterMCInstrInfo(*T, createX86MCInstrInfo); |
Evan Cheng | 8c886a4 | 2011-07-22 21:58:54 +0000 | [diff] [blame] | 247 | |
Rafael Espindola | 69244c3 | 2015-03-18 23:15:49 +0000 | [diff] [blame] | 248 | // Register the MC register info. |
| 249 | TargetRegistry::RegisterMCRegInfo(*T, createX86MCRegisterInfo); |
Evan Cheng | 8c886a4 | 2011-07-22 21:58:54 +0000 | [diff] [blame] | 250 | |
Rafael Espindola | 69244c3 | 2015-03-18 23:15:49 +0000 | [diff] [blame] | 251 | // Register the MC subtarget info. |
| 252 | TargetRegistry::RegisterMCSubtargetInfo(*T, |
| 253 | X86_MC::createX86MCSubtargetInfo); |
Evan Cheng | b253100 | 2011-07-25 19:33:48 +0000 | [diff] [blame] | 254 | |
Rafael Espindola | 69244c3 | 2015-03-18 23:15:49 +0000 | [diff] [blame] | 255 | // Register the MC instruction analyzer. |
| 256 | TargetRegistry::RegisterMCInstrAnalysis(*T, createX86MCInstrAnalysis); |
Evan Cheng | 4d6c9d7 | 2011-08-23 20:15:21 +0000 | [diff] [blame] | 257 | |
Rafael Espindola | 69244c3 | 2015-03-18 23:15:49 +0000 | [diff] [blame] | 258 | // Register the code emitter. |
| 259 | TargetRegistry::RegisterMCCodeEmitter(*T, createX86MCCodeEmitter); |
| 260 | |
| 261 | // Register the object streamer. |
Rafael Espindola | cd584a8 | 2015-03-19 01:50:16 +0000 | [diff] [blame] | 262 | TargetRegistry::RegisterCOFFStreamer(*T, createX86WinCOFFStreamer); |
Rafael Espindola | 69244c3 | 2015-03-18 23:15:49 +0000 | [diff] [blame] | 263 | |
| 264 | // Register the MCInstPrinter. |
| 265 | TargetRegistry::RegisterMCInstPrinter(*T, createX86MCInstPrinter); |
| 266 | |
| 267 | // Register the MC relocation info. |
| 268 | TargetRegistry::RegisterMCRelocationInfo(*T, createX86MCRelocationInfo); |
| 269 | } |
Evan Cheng | b253100 | 2011-07-25 19:33:48 +0000 | [diff] [blame] | 270 | |
| 271 | // Register the asm backend. |
Evan Cheng | 5928e69 | 2011-07-25 23:24:55 +0000 | [diff] [blame] | 272 | TargetRegistry::RegisterMCAsmBackend(TheX86_32Target, |
| 273 | createX86_32AsmBackend); |
| 274 | TargetRegistry::RegisterMCAsmBackend(TheX86_64Target, |
| 275 | createX86_64AsmBackend); |
Evan Cheng | 2129f59 | 2011-07-19 06:37:02 +0000 | [diff] [blame] | 276 | } |