68 return Reg == X86::NoRegister ||
69 getX86MCRegisterClass(X86::GR64RegClassID).contains(
Reg);
77void X86::X86MCLFIRewriter::rewriteSyscall(
const MCInst &Inst,
MCStreamer &Out,
120bool X86::X86MCLFIRewriter::isFSAccess(
const MCInst &Inst) {
121 return (mayLoad(Inst) || mayStore(Inst)) &&
143void X86::X86MCLFIRewriter::rewriteFSAccess(
const MCInst &Inst, MCStreamer &Out,
144 const MCSubtargetInfo &STI) {
150 bool HasBase =
BaseReg != X86::NoRegister;
151 bool HasIndex = IndexReg != X86::NoRegister;
156 if (!HasBase && !HasIndex && !HasDisp) {
165 BaseReg == X86::RSP || BaseReg == X86::RIP)
166 return error(Inst,
"unsupported addressing mode for %fs access");
175 if (
Desc.getNumDefs() > 0 &&
176 getX86MCRegisterClass(X86::GR64RegClassID).
contains(DestReg) &&
183 return error(Inst,
"%fs access reads reserved register %r11");
194 if (HasBase && HasIndex) {
215 if (HasBase && !HasIndex)
221void X86::X86MCLFIRewriter::doRewriteInst(
const MCInst &Inst, MCStreamer &Out,
222 const MCSubtargetInfo &STI) {
224 return error(Inst,
"illegal modification of reserved LFI register");
227 return rewriteSyscall(Inst, Out, STI);
229 if (isFSAccess(Inst))
230 return rewriteFSAccess(Inst, Out, STI);
244 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 getMemoryOperandNo(uint64_t TSFlags)
unsigned getOperandBias(const MCInstrDesc &Desc)
Compute whether all of the def operands are repeated in the uses and therefore should be skipped.
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