| OLD | NEW |
| 1 //===-- X86MCInstLower.cpp - Convert X86 MachineInstr to an MCInst --------===// | 1 //===-- X86MCInstLower.cpp - Convert X86 MachineInstr to an MCInst --------===// |
| 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 contains code to lower X86 MachineInstrs to their corresponding | 10 // This file contains code to lower X86 MachineInstrs to their corresponding |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 | 609 |
| 610 bool is64Bits = MI.getOpcode() == X86::TLS_addr64 || | 610 bool is64Bits = MI.getOpcode() == X86::TLS_addr64 || |
| 611 MI.getOpcode() == X86::TLS_base_addr64; | 611 MI.getOpcode() == X86::TLS_base_addr64; |
| 612 | 612 |
| 613 bool needsPadding = MI.getOpcode() == X86::TLS_addr64; | 613 bool needsPadding = MI.getOpcode() == X86::TLS_addr64; |
| 614 | 614 |
| 615 MCContext &context = OutStreamer.getContext(); | 615 MCContext &context = OutStreamer.getContext(); |
| 616 | 616 |
| 617 Triple TT(STI.getTargetTriple()); | 617 Triple TT(STI.getTargetTriple()); |
| 618 // @LOCALMOD-START | 618 // @LOCALMOD-START |
| 619 // There are 2 issues with this code. First, instead of testing the target OS | 619 // TODO(dschuff): Instead of testing the target OS we should add (upstream) a |
| 620 // we should add (upstream) a method to one of the MC classes to test whether | 620 // method to one of the MC classes to test whether bundle alignment is enabled |
| 621 // bundle alignment is enabled (currently only the AsmBackend has this, which | 621 // (currently only the AsmBackend has this, which can't be used when emitting |
| 622 // can't be used when emitting asm files). That facility should be used here | 622 // asm files). That facility should be used here and in MCAsmStreamer.cpp |
| 623 // and in MCAsmStreamer.cpp (this should be done once we are unblocked from | 623 // (this should be done once we are unblocked from switching to gas by |
| 624 // switching to gas by default, so we know exactly where we need it). | 624 // default, so we know exactly where we need it). |
| 625 // Secondly, a bug in gas prevents us from using .bundle_lock with the call | 625 const bool needsBundleLock = TT.getOS() == Triple::NaCl; |
| 626 // here (https://code.google.com/p/nativeclient/issues/detail?id=4008). | |
| 627 // This is actually ok for nacl-clang for now because the old x86 ld linker | |
| 628 // has a hack that allows it to rewrite TLS GD sequences even in the presence | |
| 629 // of nop padding. For PNaCl (with gold) we do need the sequence to be bundle | |
| 630 // locked, so we use !hasRawTextSupport as a proxy for that. Once bug 4008 | |
| 631 // is fixed we will use the bundle-locks unconditionally with NaCl. | |
| 632 bool needsBundleLock = (TT.getOS() == Triple::NaCl && | |
| 633 !OutStreamer.hasRawTextSupport()); | |
| 634 if (needsBundleLock) | 626 if (needsBundleLock) |
| 635 OutStreamer.EmitBundleLock(false); | 627 OutStreamer.EmitBundleLock(false); |
| 636 // @LOCALMOD-END | 628 // @LOCALMOD-END |
| 637 if (needsPadding) | 629 if (needsPadding) |
| 638 OutStreamer.EmitInstruction(MCInstBuilder(X86::DATA16_PREFIX), STI); | 630 OutStreamer.EmitInstruction(MCInstBuilder(X86::DATA16_PREFIX), STI); |
| 639 | 631 |
| 640 MCSymbolRefExpr::VariantKind SRVK; | 632 MCSymbolRefExpr::VariantKind SRVK; |
| 641 switch (MI.getOpcode()) { | 633 switch (MI.getOpcode()) { |
| 642 case X86::TLS_addr32: | 634 case X86::TLS_addr32: |
| 643 case X86::TLS_addr64: | 635 case X86::TLS_addr64: |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 | 956 |
| 965 case X86::SEH_EndPrologue: | 957 case X86::SEH_EndPrologue: |
| 966 OutStreamer.EmitWinCFIEndProlog(); | 958 OutStreamer.EmitWinCFIEndProlog(); |
| 967 return; | 959 return; |
| 968 } | 960 } |
| 969 | 961 |
| 970 MCInst TmpInst; | 962 MCInst TmpInst; |
| 971 MCInstLowering.Lower(MI, TmpInst); | 963 MCInstLowering.Lower(MI, TmpInst); |
| 972 EmitToStreamer(OutStreamer, TmpInst); | 964 EmitToStreamer(OutStreamer, TmpInst); |
| 973 } | 965 } |
| OLD | NEW |