OLD | NEW |
1 //===-- X86MCTargetDesc.cpp - X86 Target Descriptions ---------------------===// | 1 //===-- X86MCTargetDesc.cpp - X86 Target Descriptions ---------------------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file provides X86 specific target descriptions. | 10 // This file provides X86 specific target descriptions. |
11 // | 11 // |
12 //===----------------------------------------------------------------------===// | 12 //===----------------------------------------------------------------------===// |
13 | 13 |
14 #include "X86MCTargetDesc.h" | 14 #include "X86MCTargetDesc.h" |
15 #include "InstPrinter/X86ATTInstPrinter.h" | 15 #include "InstPrinter/X86ATTInstPrinter.h" |
16 #include "InstPrinter/X86IntelInstPrinter.h" | 16 #include "InstPrinter/X86IntelInstPrinter.h" |
17 #include "X86MCAsmInfo.h" | 17 #include "X86MCAsmInfo.h" |
| 18 #include "X86MCNaClAsmStreamer.h" |
18 #include "llvm/ADT/Triple.h" | 19 #include "llvm/ADT/Triple.h" |
19 #include "llvm/MC/MCCodeGenInfo.h" | 20 #include "llvm/MC/MCCodeGenInfo.h" |
20 #include "llvm/MC/MCInstrAnalysis.h" | 21 #include "llvm/MC/MCInstrAnalysis.h" |
21 #include "llvm/MC/MCInstrInfo.h" | 22 #include "llvm/MC/MCInstrInfo.h" |
22 #include "llvm/MC/MCRegisterInfo.h" | 23 #include "llvm/MC/MCRegisterInfo.h" |
23 #include "llvm/MC/MCStreamer.h" | 24 #include "llvm/MC/MCStreamer.h" |
24 #include "llvm/MC/MCSubtargetInfo.h" | 25 #include "llvm/MC/MCSubtargetInfo.h" |
25 #include "llvm/MC/MachineLocation.h" | 26 #include "llvm/MC/MachineLocation.h" |
26 #include "llvm/Support/ErrorHandling.h" | 27 #include "llvm/Support/ErrorHandling.h" |
27 #include "llvm/Support/Host.h" | 28 #include "llvm/Support/Host.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 else if (TheTriple.isOSBinFormatELF()) | 228 else if (TheTriple.isOSBinFormatELF()) |
228 return createX86_64ELFRelocationInfo(Ctx); | 229 return createX86_64ELFRelocationInfo(Ctx); |
229 // Default to the stock relocation info. | 230 // Default to the stock relocation info. |
230 return llvm::createMCRelocationInfo(TT, Ctx); | 231 return llvm::createMCRelocationInfo(TT, Ctx); |
231 } | 232 } |
232 | 233 |
233 static MCInstrAnalysis *createX86MCInstrAnalysis(const MCInstrInfo *Info) { | 234 static MCInstrAnalysis *createX86MCInstrAnalysis(const MCInstrInfo *Info) { |
234 return new MCInstrAnalysis(Info); | 235 return new MCInstrAnalysis(Info); |
235 } | 236 } |
236 | 237 |
| 238 static MCStreamer *createX86MCNaClAsmStreamer(MCContext &Context, |
| 239 std::unique_ptr<formatted_raw_ostr
eam> OS, |
| 240 bool isVerboseAsm, bool useDwarfDi
rectory, |
| 241 MCInstPrinter *IP, MCCodeEmitter *
CE, |
| 242 MCAsmBackend *MAB, bool ShowInst)
{ |
| 243 return new X86MCNaClAsmStreamer(Context, std::move(OS), isVerboseAsm, |
| 244 useDwarfDirectory, IP, CE, MAB, ShowInst); |
| 245 } |
| 246 |
237 // Force static initialization. | 247 // Force static initialization. |
238 extern "C" void LLVMInitializeX86TargetMC() { | 248 extern "C" void LLVMInitializeX86TargetMC() { |
239 for (Target *T : {&TheX86_32Target, &TheX86_64Target}) { | 249 for (Target *T : {&TheX86_32Target, &TheX86_64Target}) { |
240 // Register the MC asm info. | 250 // Register the MC asm info. |
241 RegisterMCAsmInfoFn X(*T, createX86MCAsmInfo); | 251 RegisterMCAsmInfoFn X(*T, createX86MCAsmInfo); |
242 | 252 |
243 // Register the MC codegen info. | 253 // Register the MC codegen info. |
244 RegisterMCCodeGenInfoFn Y(*T, createX86MCCodeGenInfo); | 254 RegisterMCCodeGenInfoFn Y(*T, createX86MCCodeGenInfo); |
245 | 255 |
246 // Register the MC instruction info. | 256 // Register the MC instruction info. |
247 TargetRegistry::RegisterMCInstrInfo(*T, createX86MCInstrInfo); | 257 TargetRegistry::RegisterMCInstrInfo(*T, createX86MCInstrInfo); |
248 | 258 |
249 // Register the MC register info. | 259 // Register the MC register info. |
250 TargetRegistry::RegisterMCRegInfo(*T, createX86MCRegisterInfo); | 260 TargetRegistry::RegisterMCRegInfo(*T, createX86MCRegisterInfo); |
251 | 261 |
252 // Register the MC subtarget info. | 262 // Register the MC subtarget info. |
253 TargetRegistry::RegisterMCSubtargetInfo(*T, | 263 TargetRegistry::RegisterMCSubtargetInfo(*T, |
254 X86_MC::createX86MCSubtargetInfo); | 264 X86_MC::createX86MCSubtargetInfo); |
255 | 265 |
256 // Register the MC instruction analyzer. | 266 // Register the MC instruction analyzer. |
257 TargetRegistry::RegisterMCInstrAnalysis(*T, createX86MCInstrAnalysis); | 267 TargetRegistry::RegisterMCInstrAnalysis(*T, createX86MCInstrAnalysis); |
258 | 268 |
259 // Register the code emitter. | 269 // Register the code emitter. |
260 TargetRegistry::RegisterMCCodeEmitter(*T, createX86MCCodeEmitter); | 270 TargetRegistry::RegisterMCCodeEmitter(*T, createX86MCCodeEmitter); |
261 #ifndef __native_client__ | 271 #ifndef __native_client__ |
262 // Register the object streamer. | 272 // Register the object streamer. |
263 TargetRegistry::RegisterCOFFStreamer(*T, createX86WinCOFFStreamer); | 273 TargetRegistry::RegisterCOFFStreamer(*T, createX86WinCOFFStreamer); |
| 274 |
| 275 |
264 #endif | 276 #endif |
| 277 TargetRegistry::RegisterNaClAsmStreamer(*T, createX86MCNaClAsmStreamer); |
| 278 |
265 // Register the MCInstPrinter. | 279 // Register the MCInstPrinter. |
266 TargetRegistry::RegisterMCInstPrinter(*T, createX86MCInstPrinter); | 280 TargetRegistry::RegisterMCInstPrinter(*T, createX86MCInstPrinter); |
267 | 281 |
268 // Register the MC relocation info. | 282 // Register the MC relocation info. |
269 TargetRegistry::RegisterMCRelocationInfo(*T, createX86MCRelocationInfo); | 283 TargetRegistry::RegisterMCRelocationInfo(*T, createX86MCRelocationInfo); |
270 } | 284 } |
271 | 285 |
272 // Register the asm backend. | 286 // Register the asm backend. |
273 TargetRegistry::RegisterMCAsmBackend(TheX86_32Target, | 287 TargetRegistry::RegisterMCAsmBackend(TheX86_32Target, |
274 createX86_32AsmBackend); | 288 createX86_32AsmBackend); |
275 TargetRegistry::RegisterMCAsmBackend(TheX86_64Target, | 289 TargetRegistry::RegisterMCAsmBackend(TheX86_64Target, |
276 createX86_64AsmBackend); | 290 createX86_64AsmBackend); |
277 } | 291 } |
OLD | NEW |