| 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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 // | 483 // |
| 484 // We need global state to keep track of the explicit prefix (PREFIX_*) | 484 // We need global state to keep track of the explicit prefix (PREFIX_*) |
| 485 // instructions. Unfortunately, the assembly parser prefers to generate | 485 // instructions. Unfortunately, the assembly parser prefers to generate |
| 486 // these instead of combined instructions. At this time, having only | 486 // these instead of combined instructions. At this time, having only |
| 487 // one explicit prefix is supported. | 487 // one explicit prefix is supported. |
| 488 bool CustomExpandInstNaClX86(const llvm::MCSubtargetInfo &STI, | 488 bool CustomExpandInstNaClX86(const llvm::MCSubtargetInfo &STI, |
| 489 const MCInst &Inst, MCStreamer &Out, | 489 const MCInst &Inst, MCStreamer &Out, |
| 490 X86MCNaClSFIState &State) { | 490 X86MCNaClSFIState &State) { |
| 491 // If we are emitting to .s, only sandbox pseudos not supported by gas. | 491 // If we are emitting to .s, only sandbox pseudos not supported by gas. |
| 492 if (Out.hasRawTextSupport()) { | 492 if (Out.hasRawTextSupport()) { |
| 493 if (Inst.getOpcode() != X86::NACL_ANDSPi32) | 493 if (!(Inst.getOpcode() == X86::NACL_ANDSPi8 || |
| 494 Inst.getOpcode() == X86::NACL_ANDSPi32)) |
| 494 return false; | 495 return false; |
| 495 } | 496 } |
| 496 // If we make a call to EmitInstruction, we will be called recursively. In | 497 // If we make a call to EmitInstruction, we will be called recursively. In |
| 497 // this case we just want the raw instruction to be emitted instead of | 498 // this case we just want the raw instruction to be emitted instead of |
| 498 // handling the insruction here. | 499 // handling the insruction here. |
| 499 if (State.EmitRaw == true && !State.PrefixPass) { | 500 if (State.EmitRaw == true && !State.PrefixPass) { |
| 500 return false; | 501 return false; |
| 501 } | 502 } |
| 502 EmitRawState E(State); | 503 EmitRawState E(State); |
| 503 unsigned Opc = Inst.getOpcode(); | 504 unsigned Opc = Inst.getOpcode(); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 EmitSPArith(STI, X86::ADD32ri, Inst.getOperand(0), Out); | 565 EmitSPArith(STI, X86::ADD32ri, Inst.getOperand(0), Out); |
| 565 return true; | 566 return true; |
| 566 case X86::NACL_SSPi8: | 567 case X86::NACL_SSPi8: |
| 567 assert(State.PrefixSaved == 0); | 568 assert(State.PrefixSaved == 0); |
| 568 EmitSPArith(STI, X86::SUB32ri8, Inst.getOperand(0), Out); | 569 EmitSPArith(STI, X86::SUB32ri8, Inst.getOperand(0), Out); |
| 569 return true; | 570 return true; |
| 570 case X86::NACL_SSPi32: | 571 case X86::NACL_SSPi32: |
| 571 assert(State.PrefixSaved == 0); | 572 assert(State.PrefixSaved == 0); |
| 572 EmitSPArith(STI, X86::SUB32ri, Inst.getOperand(0), Out); | 573 EmitSPArith(STI, X86::SUB32ri, Inst.getOperand(0), Out); |
| 573 return true; | 574 return true; |
| 575 case X86::NACL_ANDSPi8: |
| 576 assert(State.PrefixSaved == 0); |
| 577 EmitSPArith(STI, X86::AND32ri8, Inst.getOperand(0), Out); |
| 578 return true; |
| 574 case X86::NACL_ANDSPi32: | 579 case X86::NACL_ANDSPi32: |
| 575 assert(State.PrefixSaved == 0); | 580 assert(State.PrefixSaved == 0); |
| 576 EmitSPArith(STI, X86::AND32ri, Inst.getOperand(0), Out); | 581 EmitSPArith(STI, X86::AND32ri, Inst.getOperand(0), Out); |
| 577 return true; | 582 return true; |
| 578 case X86::NACL_SPADJi32: | 583 case X86::NACL_SPADJi32: |
| 579 assert(State.PrefixSaved == 0); | 584 assert(State.PrefixSaved == 0); |
| 580 EmitSPAdj(STI, Inst.getOperand(0), Out); | 585 EmitSPAdj(STI, Inst.getOperand(0), Out); |
| 581 return true; | 586 return true; |
| 582 case X86::NACL_RESTBPm: | 587 case X86::NACL_RESTBPm: |
| 583 assert(State.PrefixSaved == 0); | 588 assert(State.PrefixSaved == 0); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 | 833 |
| 829 unsigned DemoteRegTo32_(unsigned RegIn) { | 834 unsigned DemoteRegTo32_(unsigned RegIn) { |
| 830 if (RegIn == 0) | 835 if (RegIn == 0) |
| 831 return 0; | 836 return 0; |
| 832 unsigned RegOut = getX86SubSuperRegister_(RegIn, MVT::i32, false); | 837 unsigned RegOut = getX86SubSuperRegister_(RegIn, MVT::i32, false); |
| 833 assert(RegOut != 0); | 838 assert(RegOut != 0); |
| 834 return RegOut; | 839 return RegOut; |
| 835 } | 840 } |
| 836 } //namespace | 841 } //namespace |
| 837 // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | 842 // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
| OLD | NEW |