| 1 | //===- X86MCLFIRewriter.h ---------------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // This file declares the X86MCLFIRewriter class, the X86 specific |
| 10 | // subclass of MCLFIRewriter. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | #ifndef LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCLFIREWRITER_H |
| 14 | #define LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCLFIREWRITER_H |
| 15 | |
| 16 | #include "llvm/MC/MCInstrInfo.h" |
| 17 | #include "llvm/MC/MCLFIRewriter.h" |
| 18 | #include "llvm/MC/MCRegisterInfo.h" |
| 19 | |
| 20 | namespace llvm { |
| 21 | class MCContext; |
| 22 | class MCInst; |
| 23 | class MCStreamer; |
| 24 | class MCSubtargetInfo; |
| 25 | |
| 26 | namespace X86 { |
| 27 | |
| 28 | class X86MCLFIRewriter : public MCLFIRewriter { |
| 29 | public: |
| 30 | X86MCLFIRewriter(MCContext &Ctx, std::unique_ptr<MCRegisterInfo> &&RI, |
| 31 | std::unique_ptr<MCInstrInfo> &&II) |
| 32 | : MCLFIRewriter(Ctx, std::move(RI), std::move(II)) {} |
| 33 | |
| 34 | bool rewriteInst(const MCInst &Inst, MCStreamer &Out, |
| 35 | const MCSubtargetInfo &STI) override; |
| 36 | |
| 37 | private: |
| 38 | /// Recursion guard to prevent infinite loops when emitting instructions. |
| 39 | bool Guard = false; |
| 40 | |
| 41 | void doRewriteInst(const MCInst &Inst, MCStreamer &Out, |
| 42 | const MCSubtargetInfo &STI); |
| 43 | |
| 44 | void rewriteSyscall(const MCInst &Inst, MCStreamer &Out, |
| 45 | const MCSubtargetInfo &STI); |
| 46 | |
| 47 | bool isFSAccess(const MCInst &Inst); |
| 48 | void rewriteFSAccess(const MCInst &Inst, MCStreamer &Out, |
| 49 | const MCSubtargetInfo &STI); |
| 50 | }; |
| 51 | |
| 52 | } // namespace X86 |
| 53 | } // namespace llvm |
| 54 | #endif // LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCLFIREWRITER_H |
| 55 | |