66 return Reg == X86::NoRegister ||
67 getX86MCRegisterClass(X86::GR64RegClassID).contains(
Reg);
77void X86::X86MCLFIRewriter::rewriteSyscall(
const MCInst &Inst,
MCStreamer &Out,
123bool X86::X86MCLFIRewriter::isFSAccess(
const MCInst &Inst) {
124 return (mayLoad(Inst) || mayStore(Inst)) &&
146void X86::X86MCLFIRewriter::rewriteFSAccess(
const MCInst &Inst, MCStreamer &Out,
147 const MCSubtargetInfo &STI) {
153 bool HasBase =
BaseReg != X86::NoRegister;
154 bool HasIndex = IndexReg != X86::NoRegister;
159 if (!HasBase && !HasIndex && !HasDisp) {
168 BaseReg == X86::RSP || BaseReg == X86::RIP)
169 return error(Inst,
"unsupported addressing mode for %fs access");
178 if (
Desc.getNumDefs() > 0 &&
179 getX86MCRegisterClass(X86::GR64RegClassID).
contains(DestReg) &&
186 return error(Inst,
"%fs access reads reserved register %r11");
197 if (HasBase && HasIndex) {
218 if (HasBase && !HasIndex)
224void X86::X86MCLFIRewriter::doRewriteInst(
const MCInst &Inst, MCStreamer &Out,
225 const MCSubtargetInfo &STI) {
227 return error(Inst,
"illegal modification of reserved LFI register");
230 return rewriteSyscall(Inst, Out, STI);
232 if (isFSAccess(Inst))
233 return rewriteFSAccess(Inst, Out, STI);
247 doRewriteInst(Inst, Out, STI);
static constexpr MCRegister LFIScratchReg
static bool isSyscall(const MCInst &Inst)
static constexpr MCRegister LFIBaseReg
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
static void emitTPLoad(MCRegister Reg, MCStreamer &Out, const MCSubtargetInfo &STI)
static bool isGR64OrNone(MCRegister Reg)
static int findFSMemOperand(const MCInst &Inst, const MCInstrInfo &InstInfo)
static constexpr MCRegister LFITPReg
static constexpr int TPOffset
static bool isSyscall(const MCInst &Inst)
static bool readsRegister(const MCInst &Inst, const MCInstrDesc &Desc, MCRegister Reg, const MCRegisterInfo &RI)
LLVM_ABI MCSymbol * createTempSymbol()
Create a temporary symbol with a unique name.
Instances of this class represent a single low-level machine instruction.
unsigned getNumOperands() const
unsigned getOpcode() const
void addOperand(const MCOperand Op)
void setOpcode(unsigned Op)
const MCOperand & getOperand(unsigned i) const
Describe properties that are true of each instruction in the target description file.
Interface to description of machine instruction set.
Instances of this class represent operands of the MCInst class.
static MCOperand createExpr(const MCExpr *Val)
static MCOperand createReg(MCRegister Reg)
static MCOperand createImm(int64_t Val)
MCRegister getReg() const
Returns the register number.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
bool regsOverlap(MCRegister RegA, MCRegister RegB) const
Returns true if the two registers are equal or alias each other.
Wrapper class representing physical registers. Should be passed by value.
Streaming machine code generation interface.
virtual void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI)
Emit the given Instruction into the current section.
MCContext & getContext() const
virtual void emitBundleLock(bool AlignToEnd, const MCSubtargetInfo &STI)
The following instructions are a bundle-locked group.
virtual void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
virtual void emitBundleUnlock(const MCSubtargetInfo &STI)
Ends a bundle-locked group.
Generic base class for all target subtargets.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx, SMLoc Loc=SMLoc())
A Use represents the edge between a Value definition and its users.
bool rewriteInst(const MCInst &Inst, MCStreamer &Out, const MCSubtargetInfo &STI) override
int getMemoryOperandIdx(const MCInstrDesc &Desc)
BaseReg
Stack frame base register. Bit 0 of FREInfo.Info.
This is an optimization pass for GlobalISel generic memory operations.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
DWARFExpression::Operation Op