OLD | NEW |
1 //=== X86MCNaCl.cpp - Expansion of NaCl pseudo-instructions --*- C++ -*-=// | 1 //=== X86MCNaCl.cpp - Expansion of NaCl pseudo-instructions --*- C++ -*-=// |
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 //===----------------------------------------------------------------------===// | 10 //===----------------------------------------------------------------------===// |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 // consistent during recursive calls. | 474 // consistent during recursive calls. |
475 // | 475 // |
476 // We need global state to keep track of the explicit prefix (PREFIX_*) | 476 // We need global state to keep track of the explicit prefix (PREFIX_*) |
477 // instructions. Unfortunately, the assembly parser prefers to generate | 477 // instructions. Unfortunately, the assembly parser prefers to generate |
478 // these instead of combined instructions. At this time, having only | 478 // these instead of combined instructions. At this time, having only |
479 // one explicit prefix is supported. | 479 // one explicit prefix is supported. |
480 bool CustomExpandInstNaClX86(const llvm::MCSubtargetInfo &STI, | 480 bool CustomExpandInstNaClX86(const llvm::MCSubtargetInfo &STI, |
481 const MCInst &Inst, MCStreamer &Out, | 481 const MCInst &Inst, MCStreamer &Out, |
482 X86MCNaClSFIState &State) { | 482 X86MCNaClSFIState &State) { |
483 // If we are emitting to .s, only sandbox pseudos not supported by gas. | 483 // If we are emitting to .s, only sandbox pseudos not supported by gas. |
| 484 |
484 if (Out.hasRawTextSupport()) { | 485 if (Out.hasRawTextSupport()) { |
485 if (!(Inst.getOpcode() == X86::NACL_ANDSPi8 || | 486 if (!(Inst.getOpcode() == X86::NACL_ANDSPi8 || |
486 Inst.getOpcode() == X86::NACL_ANDSPi32)) | 487 Inst.getOpcode() == X86::NACL_ANDSPi32 || |
| 488 » Inst.getOpcode() == X86::RETL)) |
487 return false; | 489 return false; |
488 } | 490 } |
| 491 |
489 // If we make a call to EmitInstruction, we will be called recursively. In | 492 // If we make a call to EmitInstruction, we will be called recursively. In |
490 // this case we just want the raw instruction to be emitted instead of | 493 // this case we just want the raw instruction to be emitted instead of |
491 // handling the insruction here. | 494 // handling the insruction here. |
492 if (State.EmitRaw == true && !State.PrefixPass) { | 495 if (State.EmitRaw == true && !State.PrefixPass) { |
493 return false; | 496 return false; |
494 } | 497 } |
495 EmitRawState E(State); | 498 EmitRawState E(State); |
496 unsigned Opc = Inst.getOpcode(); | 499 unsigned Opc = Inst.getOpcode(); |
497 DEBUG(dbgs() << "CustomExpandInstNaClX86("; Inst.dump(); dbgs() << ")\n"); | 500 DEBUG(dbgs() << "CustomExpandInstNaClX86("; Inst.dump(); dbgs() << ")\n"); |
498 switch (Opc) { | 501 switch (Opc) { |
(...skipping 30 matching lines...) Expand all Loading... |
529 return true; | 532 return true; |
530 case X86::NACL_JMP32r: | 533 case X86::NACL_JMP32r: |
531 assert(State.PrefixSaved == 0); | 534 assert(State.PrefixSaved == 0); |
532 EmitIndirectBranch(STI, Inst.getOperand(0), false, false, Out); | 535 EmitIndirectBranch(STI, Inst.getOperand(0), false, false, Out); |
533 return true; | 536 return true; |
534 case X86::NACL_JMP64r: | 537 case X86::NACL_JMP64r: |
535 case X86::NACL_JMP64z: | 538 case X86::NACL_JMP64z: |
536 assert(State.PrefixSaved == 0); | 539 assert(State.PrefixSaved == 0); |
537 EmitIndirectBranch(STI, Inst.getOperand(0), true, false, Out); | 540 EmitIndirectBranch(STI, Inst.getOperand(0), true, false, Out); |
538 return true; | 541 return true; |
| 542 case X86::RETL: |
539 case X86::NACL_RET32: | 543 case X86::NACL_RET32: |
540 assert(State.PrefixSaved == 0); | 544 assert(State.PrefixSaved == 0); |
541 EmitRet(STI, NULL, false, Out); | 545 EmitRet(STI, NULL, false, Out); |
542 return true; | 546 return true; |
543 case X86::NACL_RET64: | 547 case X86::NACL_RET64: |
544 assert(State.PrefixSaved == 0); | 548 assert(State.PrefixSaved == 0); |
545 EmitRet(STI, NULL, true, Out); | 549 EmitRet(STI, NULL, true, Out); |
546 return true; | 550 return true; |
547 case X86::NACL_RETI32: | 551 case X86::NACL_RETI32: |
548 assert(State.PrefixSaved == 0); | 552 assert(State.PrefixSaved == 0); |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 | 829 |
826 unsigned DemoteRegTo32_(unsigned RegIn) { | 830 unsigned DemoteRegTo32_(unsigned RegIn) { |
827 if (RegIn == 0) | 831 if (RegIn == 0) |
828 return 0; | 832 return 0; |
829 unsigned RegOut = getX86SubSuperRegister_(RegIn, MVT::i32, false); | 833 unsigned RegOut = getX86SubSuperRegister_(RegIn, MVT::i32, false); |
830 assert(RegOut != 0); | 834 assert(RegOut != 0); |
831 return RegOut; | 835 return RegOut; |
832 } | 836 } |
833 } //namespace | 837 } //namespace |
834 // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | 838 // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
OLD | NEW |