| OLD | NEW |
| 1 //===- MCNaClExpander.h -----------------------------------------*- C++ -*-===// | 1 //===- MCNaClExpander.h -----------------------------------------*- 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 // This file declares the MCNaClExpander class. This is an abstract | 10 // This file declares the MCNaClExpander class. This is an abstract |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 class MCStreamer; | 27 class MCStreamer; |
| 28 | 28 |
| 29 class MCNaClExpander { | 29 class MCNaClExpander { |
| 30 private: | 30 private: |
| 31 SmallVector<unsigned, 2> ScratchRegs; | 31 SmallVector<unsigned, 2> ScratchRegs; |
| 32 const MCContext &Ctx; | 32 const MCContext &Ctx; |
| 33 | 33 |
| 34 protected: | 34 protected: |
| 35 std::unique_ptr<MCInstrInfo> InstInfo; | 35 std::unique_ptr<MCInstrInfo> InstInfo; |
| 36 std::unique_ptr<MCRegisterInfo> RegInfo; | 36 std::unique_ptr<MCRegisterInfo> RegInfo; |
| 37 void invalidateScratchRegs(const MCInst &Inst); |
| 38 unsigned getScratchReg(int index); |
| 39 unsigned numScratchRegs() const; |
| 40 virtual bool isValidScratchRegister(unsigned Reg) const = 0; |
| 37 | 41 |
| 38 public: | 42 public: |
| 39 MCNaClExpander(const MCContext &Ctx, std::unique_ptr<MCRegisterInfo> &&RI, | 43 MCNaClExpander(const MCContext &Ctx, std::unique_ptr<MCRegisterInfo> &&RI, |
| 40 std::unique_ptr<MCInstrInfo> &&II) | 44 std::unique_ptr<MCInstrInfo> &&II) |
| 41 : Ctx(Ctx), InstInfo(std::move(II)), RegInfo(std::move(RI)) {} | 45 : Ctx(Ctx), InstInfo(std::move(II)), RegInfo(std::move(RI)) {} |
| 42 | 46 |
| 43 void Error(const MCInst &Inst, const char msg[]); | 47 void Error(const MCInst &Inst, const char msg[]); |
| 44 | 48 |
| 45 void pushScratchReg(unsigned Reg); | 49 bool addScratchReg(unsigned Reg); |
| 46 unsigned popScratchReg(); | 50 void clearScratchRegs(); |
| 47 unsigned getScratchReg(int index); | |
| 48 unsigned numScratchRegs() const; | |
| 49 | 51 |
| 50 bool isPseudo(const MCInst &Inst) const; | 52 bool isPseudo(const MCInst &Inst) const; |
| 51 | 53 |
| 52 bool mayAffectControlFlow(const MCInst &Inst) const; | 54 bool mayAffectControlFlow(const MCInst &Inst) const; |
| 53 bool isCall(const MCInst &Inst) const; | 55 bool isCall(const MCInst &Inst) const; |
| 54 bool isBranch(const MCInst &Inst) const; | 56 bool isBranch(const MCInst &Inst) const; |
| 55 bool isIndirectBranch(const MCInst &Inst) const; | 57 bool isIndirectBranch(const MCInst &Inst) const; |
| 56 bool isReturn(const MCInst &Inst) const; | 58 bool isReturn(const MCInst &Inst) const; |
| 57 | 59 |
| 58 bool mayLoad(const MCInst &Inst) const; | 60 bool mayLoad(const MCInst &Inst) const; |
| 59 bool mayStore(const MCInst &Inst) const; | 61 bool mayStore(const MCInst &Inst) const; |
| 60 | 62 |
| 61 bool mayModifyRegister(const MCInst &Inst, unsigned Reg) const; | 63 bool mayModifyRegister(const MCInst &Inst, unsigned Reg) const; |
| 62 bool explicitlyModifiesRegister(const MCInst &Inst, unsigned Reg) const; | 64 bool explicitlyModifiesRegister(const MCInst &Inst, unsigned Reg) const; |
| 63 | 65 |
| 64 void replaceDefinitions(MCInst &Inst, unsigned RegOld, unsigned RegNew) const; | 66 void replaceDefinitions(MCInst &Inst, unsigned RegOld, unsigned RegNew) const; |
| 65 | 67 |
| 66 virtual ~MCNaClExpander() = default; | 68 virtual ~MCNaClExpander() = default; |
| 67 virtual bool expandInst(const MCInst &Inst, MCStreamer &Out, | 69 virtual bool expandInst(const MCInst &Inst, MCStreamer &Out, |
| 68 const MCSubtargetInfo &STI) = 0; | 70 const MCSubtargetInfo &STI) = 0; |
| 69 }; | 71 }; |
| 70 | 72 |
| 71 } | 73 } |
| 72 #endif | 74 #endif |
| OLD | NEW |