[clang] [llvm] [LFI][X86] Add X86 LFI target and system instruction rewrites (PR #189569)
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 7 01:31:37 PDT 2026
================
@@ -0,0 +1,248 @@
+//===- X86MCLFIRewriter.cpp -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements the X86MCLFIRewriter class, which rewrites X86-64
+// instructions for LFI (Lightweight Fault Isolation) sandboxing.
+//
+//===----------------------------------------------------------------------===//
+
+#include "X86MCLFIRewriter.h"
+#include "X86BaseInfo.h"
+#include "X86MCTargetDesc.h"
+#include "llvm/MC/MCContext.h"
+#include "llvm/MC/MCExpr.h"
+#include "llvm/MC/MCInst.h"
+#include "llvm/MC/MCStreamer.h"
+#include "llvm/MC/MCSubtargetInfo.h"
+
+using namespace llvm;
+
+// LFI reserved registers.
+static constexpr MCRegister LFIBaseReg = X86::R14;
----------------
MaskRay wrote:
just `constexpr` - implies internal linkage, no need for `static`
https://github.com/llvm/llvm-project/pull/189569
More information about the cfe-commits
mailing list