66 return Reg == X86::NoRegister ||
67 getX86MCRegisterClass(X86::GR64RegClassID).contains(
Reg);
75void X86::X86MCLFIRewriter::rewriteSyscall(
const MCInst &Inst,
MCStreamer &Out,
118bool X86::X86MCLFIRewriter::isFSAccess(
const MCInst &Inst) {
119 return (mayLoad(Inst) || mayStore(Inst)) &&
141void X86::X86MCLFIRewriter::rewriteFSAccess(
const MCInst &Inst, MCStreamer &Out,
142 const MCSubtargetInfo &STI) {
148 bool HasBase =
BaseReg != X86::NoRegister;
149 bool HasIndex = IndexReg != X86::NoRegister;
154 if (!HasBase && !HasIndex && !HasDisp) {
163 BaseReg == X86::RSP || BaseReg == X86::RIP)
164 return error(Inst,
"unsupported addressing mode for %fs access");
173 if (
Desc.getNumDefs() > 0 &&
174 getX86MCRegisterClass(X86::GR64RegClassID).
contains(DestReg) &&
181 return error(Inst,
"%fs access reads reserved register %r11");
192 if (HasBase && HasIndex) {
213 if (HasBase && !HasIndex)
219void X86::X86MCLFIRewriter::doRewriteInst(
const MCInst &Inst, MCStreamer &Out,
220 const MCSubtargetInfo &STI) {
222 return error(Inst,
"illegal modification of reserved LFI register");
225 return rewriteSyscall(Inst, Out, STI);
227 if (isFSAccess(Inst))
228 return rewriteFSAccess(Inst, Out, STI);
242 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 emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
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