34 cl::desc(
"Enable rewriting for LFI."),
45 assert(TheTarget !=
nullptr);
56 const Triple &TheTriple = Ctx.getTargetTriple();
64 const Triple &TheTriple = Ctx.getTargetTriple();
71 NoteName =
".note.LFI.ABI.aarch64";
75 NoteName =
".note.LFI.ABI.x86_64";
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file declares the MCLFIRewriter class, an abstract class that encapsulates the rewriting logic f...
static const char NoteNamespace[]
static constexpr unsigned X86BundleSize
LFI-specific code for MC.
Lightweight error class with error context and mandatory checking.
Context object for machine code objects.
This represents a section on linux, lots of unix variants and some bare metal systems.
Streaming machine code generation interface.
virtual void emitValueToAlignment(Align Alignment, int64_t Fill=0, uint8_t FillLen=1, unsigned MaxBytesToEmit=0)
Emit some number of copies of Value until the byte alignment ByteAlignment is reached.
virtual void emitIntValue(uint64_t Value, unsigned Size)
Special case of EmitValue that avoids the client having to pass in a MCExpr for constant integers.
void setLFIRewriter(std::unique_ptr< MCLFIRewriter > Rewriter)
virtual void switchSection(MCSection *Section, uint32_t Subsec=0)
Set the current section where code is being emitted to Section.
virtual void emitBundleAlignMode(Align Alignment)
Enable aligned instruction bundling with the given bundle size, from this point onward.
virtual void emitBytes(StringRef Data)
Emit the bytes in Data into the output.
Target - Wrapper for Target specific information.
MCRegisterInfo * createMCRegInfo(const Triple &TT) const
Create a MCRegisterInfo implementation.
MCLFIRewriter * createMCLFIRewriter(MCContext &Ctx, std::unique_ptr< MCRegisterInfo > &&RegInfo, std::unique_ptr< MCInstrInfo > &&InstInfo) const
MCInstrInfo * createMCInstrInfo() const
createMCInstrInfo - Create a MCInstrInfo implementation.
Triple - Helper class for working with autoconf configuration names.
bool isLFI() const
Tests whether the target is LFI.
ArchType getArch() const
Get the parsed architecture type of this triple.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
cl::opt< bool > FlagEnableRewriting("lfi-enable-rewriter", cl::desc("Enable rewriting for LFI."), cl::init(true), cl::Hidden)
LLVM_ABI void initializeLFIMCStreamer(MCStreamer &Streamer, MCContext &Ctx, const Triple &TheTriple)
LLVM_ABI void emitLFINoteSection(MCStreamer &Streamer, MCContext &Ctx)
LLVM_ABI void emitLFIBundleAlign(MCStreamer &Streamer, MCContext &Ctx)
LLVM_ABI void reportFatalUsageError(Error Err)
Report a fatal error that does not indicate a bug in LLVM.
This struct is a compact representation of a valid (non-zero power of two) alignment.
static LLVM_ABI const Target * lookupTarget(const Triple &TheTriple, std::string &Error)
lookupTarget - Lookup a target based on a target triple.