10 #ifndef LLVM_LIB_TARGET_X86_ASMPARSER_X86OPERAND_H
11 #define LLVM_LIB_TARGET_X86_ASMPARSER_X86OPERAND_H
210 if (!
isImm())
return false;
214 if (!CE)
return true;
316 cast<MCConstantExpr>(
getMemDisp())->getValue() == 0;
336 cast<MCConstantExpr>(
getMemDisp())->getValue() == 0;
394 (X86MCRegisterClasses[X86::GR32RegClassID].contains(
getReg()) ||
395 X86MCRegisterClasses[X86::GR64RegClassID].contains(
getReg()));
407 assert(N == 1 &&
"Invalid number of operands!");
422 case X86::R8:
return X86::R8D;
423 case X86::R9:
return X86::R9D;
424 case X86::R10:
return X86::R10D;
425 case X86::R11:
return X86::R11D;
426 case X86::R12:
return X86::R12D;
427 case X86::R13:
return X86::R13D;
428 case X86::R14:
return X86::R14D;
429 case X86::R15:
return X86::R15D;
430 case X86::RIP:
return X86::EIP;
435 assert(N == 1 &&
"Invalid number of operands!");
436 unsigned RegNo =
getReg();
437 if (X86MCRegisterClasses[X86::GR64RegClassID].
contains(RegNo))
443 assert(N == 1 &&
"Invalid number of operands!");
448 assert(N == 1 &&
"Invalid number of operands!");
453 assert((N == 5) &&
"Invalid number of operands!");
462 assert((N == 1) &&
"Invalid number of operands!");
471 assert((N == 2) &&
"Invalid number of operands!");
477 assert((N == 1) &&
"Invalid number of operands!");
482 assert((N == 2) &&
"Invalid number of operands!");
493 auto Res = llvm::make_unique<X86Operand>(
Token, Loc,
EndLoc);
494 Res->Tok.Data = Str.
data();
495 Res->Tok.Length = Str.
size();
499 static std::unique_ptr<X86Operand>
504 Res->Reg.RegNo = RegNo;
520 static std::unique_ptr<X86Operand>
523 void *
OpDecl =
nullptr,
unsigned FrontendSize = 0) {
526 Res->Mem.Disp = Disp;
527 Res->Mem.BaseReg = 0;
528 Res->Mem.IndexReg = 0;
530 Res->Mem.Size =
Size;
531 Res->Mem.ModeSize = ModeSize;
532 Res->Mem.FrontendSize = FrontendSize;
535 Res->AddressOf =
false;
540 static std::unique_ptr<X86Operand>
542 unsigned BaseReg,
unsigned IndexReg,
unsigned Scale,
SMLoc StartLoc,
544 void *
OpDecl =
nullptr,
unsigned FrontendSize = 0) {
547 assert((SegReg || BaseReg || IndexReg) &&
"Invalid memory operand!");
550 assert(((Scale == 1 || Scale == 2 || Scale == 4 || Scale == 8)) &&
553 Res->Mem.SegReg = SegReg;
554 Res->Mem.Disp = Disp;
555 Res->Mem.BaseReg = BaseReg;
556 Res->Mem.IndexReg = IndexReg;
557 Res->Mem.Scale = Scale;
558 Res->Mem.Size =
Size;
559 Res->Mem.ModeSize = ModeSize;
560 Res->Mem.FrontendSize = FrontendSize;
563 Res->AddressOf =
false;
570 #endif // LLVM_LIB_TARGET_X86_ASMPARSER_X86OPERAND_H
void addImmOperands(MCInst &Inst, unsigned N) const
StringRef getToken() const
bool isMemOffs64_16() const
Represents a range in source code.
const char * getPointer() const
SMLoc getOffsetOfLoc() const override
getOffsetOfLoc - Get the location of the offset operator.
bool isMem128_RC128X() const
bool isMemOffs64_32() const
bool isImmUnsignedi8Value(uint64_t Value)
bool isMem512_RC512() const
void addAVX512RCOperands(MCInst &Inst, unsigned N) const
static MCOperand createExpr(const MCExpr *Val)
This class provides various memory handling functions that manipulate MemoryBlock instances...
bool isMemOffs16_32() const
bool isMem256_RC256() const
unsigned getMemModeSize() const
bool isMem256_RC512() const
unsigned getMemFrontendSize() const
static std::unique_ptr< X86Operand > CreateMem(unsigned ModeSize, const MCExpr *Disp, SMLoc StartLoc, SMLoc EndLoc, unsigned Size=0, StringRef SymName=StringRef(), void *OpDecl=nullptr, unsigned FrontendSize=0)
Create an absolute memory operand.
bool isMemOffs64_64() const
bool isMem256_RC128X() const
unsigned getMemScale() const
return AArch64::GPR64RegClass contains(Reg)
bool isImmSExti64i32() const
unsigned FrontendSize
If the memory operand is unsized and there are multiple instruction matches, prefer the one with this...
bool isMem512_RC256X() const
static MCOperand createReg(unsigned Reg)
bool isImmSExti64i8Value(uint64_t Value)
SMLoc getEndLoc() const override
getEndLoc - Get the location of the last token of this operand.
bool isImm() const override
isImm - Is this an immediate operand?
Base class for the full range of assembler expressions which are needed for parsing.
const MCExpr * getImm() const
void addMemOffsOperands(MCInst &Inst, unsigned N) const
MCParsedAsmOperand - This abstract class represents a source-level assembly instruction operand...
static std::unique_ptr< X86Operand > CreateImm(const MCExpr *Val, SMLoc StartLoc, SMLoc EndLoc)
static std::unique_ptr< X86Operand > CreateMem(unsigned ModeSize, unsigned SegReg, const MCExpr *Disp, unsigned BaseReg, unsigned IndexReg, unsigned Scale, SMLoc StartLoc, SMLoc EndLoc, unsigned Size=0, StringRef SymName=StringRef(), void *OpDecl=nullptr, unsigned FrontendSize=0)
Create a generalized memory operand.
bool isMem128_RC256X() const
StringRef getSymName() override
bool isImmSExti64i32Value(uint64_t Value)
unsigned getReg() const override
bool isMemOffs16_16() const
bool isMemOffs64_8() const
bool isImmSExti16i8Value(uint64_t Value)
bool isMemOffs32_8() const
const MCExpr * getMemDisp() const
bool isMem64_RC128() const
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
Instances of this class represent a single low-level machine instruction.
bool isImmSExti32i8() const
X86Operand - Instances of this class represent a parsed X86 machine instruction.
SMRange getLocRange() const
getLocRange - Get the range between the first and last token of this operand.
bool isMem128_RC256() const
bool isImmUnsignedi8() const
static const unsigned End
void setTokenValue(StringRef Value)
bool isToken() const override
isToken - Is this a token operand?
SMLoc getStartLoc() const override
getStartLoc - Get the location of the first token of this operand.
bool isMem64_RC128X() const
unsigned getMemSegReg() const
void addGR32orGR64Operands(MCInst &Inst, unsigned N) const
bool isMemOffs32_16() const
void * getOpDecl() override
bool isMemOffs32_64() const
void addRegOperands(MCInst &Inst, unsigned N) const
bool isMem128_RC128() const
bool isOffsetOf() const override
isOffsetOf - Do we need to emit code to get the offset of the variable, rather then the value of the ...
bool isMem256_RC256X() const
bool isMemUnsized() const
bool isMemOffs16_8() const
static unsigned getGR32FromGR64(unsigned RegNo)
bool isImmSExti16i8() const
void print(raw_ostream &OS) const override
print - Print a debug representation of the operand to the given stream.
unsigned getMemBaseReg() const
static std::unique_ptr< X86Operand > CreateToken(StringRef Str, SMLoc Loc)
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
static SMLoc getFromPointer(const char *Ptr)
llvm_unreachable("Unknown RegBank!")
static std::unique_ptr< X86Operand > CreateReg(unsigned RegNo, SMLoc StartLoc, SMLoc EndLoc, bool AddressOf=false, SMLoc OffsetOfLoc=SMLoc(), StringRef SymName=StringRef(), void *OpDecl=nullptr)
bool isImmSExti64i8() const
X86Operand(KindTy K, SMLoc Start, SMLoc End)
bool isMemIndexReg(unsigned LowR, unsigned HighR) const
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
bool isMem256_RC128() const
bool isGR32orGR64() const
void addAbsMemOperands(MCInst &Inst, unsigned N) const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
bool isImmSExti32i8Value(uint64_t Value)
This class implements an extremely fast bulk output stream that can only output to a stream...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
void addMemOperands(MCInst &Inst, unsigned N) const
bool isReg() const override
isReg - Is this a register operand?
void addOperand(const MCOperand &Op)
StringRef - Represent a constant reference to a string, i.e.
void addSrcIdxOperands(MCInst &Inst, unsigned N) const
enum llvm::X86Operand::KindTy Kind
void addExpr(MCInst &Inst, const MCExpr *Expr) const
Represents a location in source code.
bool isMemOffs32_32() const
static MCOperand createImm(int64_t Val)
void addDstIdxOperands(MCInst &Inst, unsigned N) const
unsigned getMemIndexReg() const
bool isMem() const override
isMem - Is this a memory operand?
bool needAddressOf() const override
needAddressOf - Do we need to emit code to get the address of the variable/label? Only valid when par...