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 "llvm/ADT/Triple.h" | 18 #include "llvm/ADT/Triple.h" |
19 #include "llvm/MC/MCCodeGenInfo.h" | 19 #include "llvm/MC/MCCodeGenInfo.h" |
20 #include "llvm/MC/MCContext.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" |
24 #include "llvm/MC/MCSectionELF.h" | |
23 #include "llvm/MC/MCStreamer.h" | 25 #include "llvm/MC/MCStreamer.h" |
24 #include "llvm/MC/MCSubtargetInfo.h" | 26 #include "llvm/MC/MCSubtargetInfo.h" |
25 #include "llvm/MC/MachineLocation.h" | 27 #include "llvm/MC/MachineLocation.h" |
28 #include "llvm/Support/ELF.h" | |
26 #include "llvm/Support/ErrorHandling.h" | 29 #include "llvm/Support/ErrorHandling.h" |
27 #include "llvm/Support/Host.h" | 30 #include "llvm/Support/Host.h" |
28 #include "llvm/Support/TargetRegistry.h" | 31 #include "llvm/Support/TargetRegistry.h" |
29 | 32 |
30 #define GET_REGINFO_MC_DESC | 33 #define GET_REGINFO_MC_DESC |
31 #include "X86GenRegisterInfo.inc" | 34 #include "X86GenRegisterInfo.inc" |
32 | 35 |
33 #define GET_INSTRINFO_MC_DESC | 36 #define GET_INSTRINFO_MC_DESC |
34 #include "X86GenInstrInfo.inc" | 37 #include "X86GenInstrInfo.inc" |
35 | 38 |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
359 bool RelaxAll, | 362 bool RelaxAll, |
360 bool NoExecStack) { | 363 bool NoExecStack) { |
361 Triple TheTriple(TT); | 364 Triple TheTriple(TT); |
362 | 365 |
363 if (TheTriple.isOSDarwin() || TheTriple.getEnvironment() == Triple::MachO) | 366 if (TheTriple.isOSDarwin() || TheTriple.getEnvironment() == Triple::MachO) |
364 return createMachOStreamer(Ctx, MAB, _OS, _Emitter, RelaxAll); | 367 return createMachOStreamer(Ctx, MAB, _OS, _Emitter, RelaxAll); |
365 | 368 |
366 if (TheTriple.isOSWindows() && TheTriple.getEnvironment() != Triple::ELF) | 369 if (TheTriple.isOSWindows() && TheTriple.getEnvironment() != Triple::ELF) |
367 return createWinCOFFStreamer(Ctx, MAB, *_Emitter, _OS, RelaxAll); | 370 return createWinCOFFStreamer(Ctx, MAB, *_Emitter, _OS, RelaxAll); |
368 | 371 |
369 // @LOCALMOD-BEGIN | 372 // @LOCALMOD-BEGIN |
eliben
2013/05/09 21:54:59
I wonder why the LOCALMOD is here, createELFStream
Derek Schuff
2013/05/10 18:35:30
I removed this localmod entirely in the cleanup.
| |
370 MCStreamer *Streamer = createELFStreamer(Ctx, MAB, _OS, _Emitter, | 373 MCStreamer *Streamer = createELFStreamer(Ctx, MAB, _OS, _Emitter, |
371 RelaxAll, NoExecStack); | 374 RelaxAll, NoExecStack); |
372 if (TheTriple.isOSNaCl()) | 375 if (TheTriple.isOSNaCl()) { |
eliben
2013/05/09 21:54:59
Move this to a separate function with a descriptiv
Derek Schuff
2013/05/10 18:35:30
That actually doesn't work because registration on
| |
373 Streamer->EmitBundleAlignMode(5); | 376 Streamer->EmitBundleAlignMode(5); |
377 const char *NoteName = TheTriple.isArch32Bit() ? | |
378 ".note.NaCl.ABI.x86-32" : ".note.NaCl.ABI.x86-64"; | |
379 const char *NoteNamespace = "NaCl"; | |
380 const char *NoteArch = TheTriple.isArch32Bit() ? "x86-32" : "x86-64"; | |
381 const MCSection *Note = Ctx.getELFSection( | |
382 NoteName, ELF::SHT_NOTE, ELF::SHF_ALLOC | ELF::SHF_GROUP, | |
383 SectionKind::getReadOnly(), 0, NoteName); | |
384 | |
385 Streamer->reset(); | |
386 // maybe should use pushSection and popSection but popSection will crash if | |
387 // there haven't been any other sections switched to yet. | |
388 Streamer->SwitchSection(Note); | |
389 Streamer->EmitIntValue(5, 4); // sizeof("NaCl") | |
390 Streamer->EmitIntValue(7, 4); // sizeof("x86-xx") | |
391 Streamer->EmitIntValue(1, 4); // NT_VERSION | |
392 Streamer->EmitValueToAlignment(4); | |
393 Streamer->EmitBytes(NoteNamespace); | |
394 Streamer->EmitIntValue(0, 1); // NUL terminator | |
395 Streamer->EmitValueToAlignment(4); | |
396 Streamer->EmitBytes(NoteArch); | |
397 Streamer->EmitIntValue(0, 1); // NUL terminator | |
398 Streamer->EmitValueToAlignment(4); | |
399 } | |
374 | 400 |
375 return Streamer; | 401 return Streamer; |
376 // @LOCALMOD-END | 402 // @LOCALMOD-END |
377 } | 403 } |
378 | 404 |
379 static MCInstPrinter *createX86MCInstPrinter(const Target &T, | 405 static MCInstPrinter *createX86MCInstPrinter(const Target &T, |
380 unsigned SyntaxVariant, | 406 unsigned SyntaxVariant, |
381 const MCAsmInfo &MAI, | 407 const MCAsmInfo &MAI, |
382 const MCInstrInfo &MII, | 408 const MCInstrInfo &MII, |
383 const MCRegisterInfo &MRI, | 409 const MCRegisterInfo &MRI, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
440 createMCStreamer); | 466 createMCStreamer); |
441 TargetRegistry::RegisterMCObjectStreamer(TheX86_64Target, | 467 TargetRegistry::RegisterMCObjectStreamer(TheX86_64Target, |
442 createMCStreamer); | 468 createMCStreamer); |
443 | 469 |
444 // Register the MCInstPrinter. | 470 // Register the MCInstPrinter. |
445 TargetRegistry::RegisterMCInstPrinter(TheX86_32Target, | 471 TargetRegistry::RegisterMCInstPrinter(TheX86_32Target, |
446 createX86MCInstPrinter); | 472 createX86MCInstPrinter); |
447 TargetRegistry::RegisterMCInstPrinter(TheX86_64Target, | 473 TargetRegistry::RegisterMCInstPrinter(TheX86_64Target, |
448 createX86MCInstPrinter); | 474 createX86MCInstPrinter); |
449 } | 475 } |
OLD | NEW |