LLVM 23.0.0git
llvm::AArch64MCLFIRewriter Class Reference

Rewrites AArch64 instructions for LFI sandboxing. More...

#include "Target/AArch64/MCTargetDesc/AArch64MCLFIRewriter.h"

Inheritance diagram for llvm::AArch64MCLFIRewriter:
[legend]

Public Member Functions

 AArch64MCLFIRewriter (MCContext &Ctx, std::unique_ptr< MCRegisterInfo > &&RI, std::unique_ptr< MCInstrInfo > &&II)
bool rewriteInst (const MCInst &Inst, MCStreamer &Out, const MCSubtargetInfo &STI) override
Public Member Functions inherited from llvm::MCLFIRewriter
 MCLFIRewriter (MCContext &Ctx, std::unique_ptr< MCRegisterInfo > &&RI, std::unique_ptr< MCInstrInfo > &&II)
LLVM_ABI void error (const MCInst &Inst, const char Msg[])
void disable ()
void enable ()
LLVM_ABI bool isCall (const MCInst &Inst) const
LLVM_ABI bool isBranch (const MCInst &Inst) const
LLVM_ABI bool isIndirectBranch (const MCInst &Inst) const
LLVM_ABI bool isReturn (const MCInst &Inst) const
LLVM_ABI bool mayLoad (const MCInst &Inst) const
LLVM_ABI bool mayStore (const MCInst &Inst) const
LLVM_ABI bool mayModifyRegister (const MCInst &Inst, MCRegister Reg) const
virtual ~MCLFIRewriter ()=default
virtual void onLabel (const MCSymbol *Symbol)

Additional Inherited Members

Protected Attributes inherited from llvm::MCLFIRewriter
bool Enabled = true
std::unique_ptr< MCInstrInfoInstInfo
std::unique_ptr< MCRegisterInfoRegInfo

Detailed Description

Rewrites AArch64 instructions for LFI sandboxing.

This class implements the LFI (Lightweight Fault Isolation) rewriting for AArch64 instructions. It transforms instructions to ensure memory accesses and control flow are confined within the sandbox region.

Reserved registers:

  • X27: Sandbox base address (always holds the base)
  • X28: Safe address register (always within sandbox)
  • X26: Scratch register for intermediate calculations
  • X25: context register (points to thread-local runtime data)
  • SP: Stack pointer (always within sandbox)
  • X30: Link register (always within sandbox)

Definition at line 40 of file AArch64MCLFIRewriter.h.

Constructor & Destructor Documentation

◆ AArch64MCLFIRewriter()

llvm::AArch64MCLFIRewriter::AArch64MCLFIRewriter ( MCContext & Ctx,
std::unique_ptr< MCRegisterInfo > && RI,
std::unique_ptr< MCInstrInfo > && II )
inline

Definition at line 42 of file AArch64MCLFIRewriter.h.

References II, llvm::MCLFIRewriter::MCLFIRewriter(), and llvm::move().

Member Function Documentation

◆ rewriteInst()

bool AArch64MCLFIRewriter::rewriteInst ( const MCInst & Inst,
MCStreamer & Out,
const MCSubtargetInfo & STI )
overridevirtual

Implements llvm::MCLFIRewriter.

Definition at line 198 of file AArch64MCLFIRewriter.cpp.

References llvm::MCLFIRewriter::Enabled.


The documentation for this class was generated from the following files: