33 #define DEBUG_TYPE "asm-printer"
36 #define PRINT_ALIAS_INSTR
37 #include "X86GenAsmWriter.inc"
46 uint64_t TSFlags = Desc.
TSFlags;
50 HasCustomInstComment =
62 if (MI->
getOpcode() == X86::CALLpcrel32 &&
72 else if (MI->
getOpcode() == X86::DATA16_PREFIX &&
91 case 0: O <<
"eq";
break;
92 case 1: O <<
"lt";
break;
93 case 2: O <<
"le";
break;
94 case 3: O <<
"unord";
break;
95 case 4: O <<
"neq";
break;
96 case 5: O <<
"nlt";
break;
97 case 6: O <<
"nle";
break;
98 case 7: O <<
"ord";
break;
99 case 8: O <<
"eq_uq";
break;
100 case 9: O <<
"nge";
break;
101 case 0xa: O <<
"ngt";
break;
102 case 0xb: O <<
"false";
break;
103 case 0xc: O <<
"neq_oq";
break;
104 case 0xd: O <<
"ge";
break;
105 case 0xe: O <<
"gt";
break;
106 case 0xf: O <<
"true";
break;
107 case 0x10: O <<
"eq_os";
break;
108 case 0x11: O <<
"lt_oq";
break;
109 case 0x12: O <<
"le_oq";
break;
110 case 0x13: O <<
"unord_s";
break;
111 case 0x14: O <<
"neq_us";
break;
112 case 0x15: O <<
"nlt_uq";
break;
113 case 0x16: O <<
"nle_uq";
break;
114 case 0x17: O <<
"ord_s";
break;
115 case 0x18: O <<
"eq_us";
break;
116 case 0x19: O <<
"nge_uq";
break;
117 case 0x1a: O <<
"ngt_uq";
break;
118 case 0x1b: O <<
"false_os";
break;
119 case 0x1c: O <<
"neq_os";
break;
120 case 0x1d: O <<
"ge_oq";
break;
121 case 0x1e: O <<
"gt_oq";
break;
122 case 0x1f: O <<
"true_us";
break;
131 case 0: O <<
"lt";
break;
132 case 1: O <<
"le";
break;
133 case 2: O <<
"gt";
break;
134 case 3: O <<
"ge";
break;
135 case 4: O <<
"eq";
break;
136 case 5: O <<
"neq";
break;
137 case 6: O <<
"false";
break;
138 case 7: O <<
"true";
break;
146 case 0: O <<
"{rn-sae}";
break;
147 case 1: O <<
"{rd-sae}";
break;
148 case 2: O <<
"{ru-sae}";
break;
149 case 3: O <<
"{rz-sae}";
break;
163 assert(Op.
isExpr() &&
"unknown pcrel immediate operand");
168 if (BranchTarget && BranchTarget->evaluateAsAbsolute(Address)) {
182 }
else if (Op.
isImm()) {
184 int64_t Imm = Op.
getImm();
193 if (
CommentStream && !HasCustomInstComment && (Imm > 255 || Imm < -256)) {
195 if (Imm == (int16_t)(Imm))
197 else if (Imm == (int32_t)(Imm))
203 assert(Op.
isExpr() &&
"unknown operand kind in printOperand");
204 O <<
markup(
"<imm:") <<
'$';
225 if (DispSpec.
isImm()) {
226 int64_t DispVal = DispSpec.
getImm();
227 if (DispVal || (!IndexReg.
getReg() && !BaseReg.
getReg()))
230 assert(DispSpec.
isExpr() &&
"non-immediate displacement for LEA?");
244 O <<
',' <<
markup(
"<imm:") << ScaleVal
297 if (DispSpec.
isImm()) {
300 assert(DispSpec.
isExpr() &&
"non-immediate displacement?");
void printDstIdx(const MCInst *MI, unsigned OpNo, raw_ostream &OS)
void printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot, const MCSubtargetInfo &STI) override
Print the specified MCInst to the specified raw_ostream.
static const char * getRegisterName(unsigned RegNo)
format_object< int64_t > formatHex(int64_t Value) const
Describe properties that are true of each instruction in the target description file.
MachineInstrBuilder MachineInstrBuilder &DefMI const MCInstrDesc & Desc
void printSrcIdx(const MCInst *MI, unsigned OpNo, raw_ostream &OS)
void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &OS)
void printInstruction(const MCInst *MI, raw_ostream &OS)
unsigned getReg() const
Returns the register number.
Instances of this class represent a single low-level machine instruction.
format_object< Ts...> format(const char *Fmt, const Ts &...Vals)
These are helper functions used to produce formatted output.
void printRegName(raw_ostream &OS, unsigned RegNo) const override
Print the assembler register name.
void printMemOffset(const MCInst *MI, unsigned OpNo, raw_ostream &OS)
const MCExpr * getExpr() const
void printSSEAVXCC(const MCInst *MI, unsigned Op, raw_ostream &OS)
StringRef markup(StringRef s) const
Utility functions to make adding mark ups simpler.
void printXOPCC(const MCInst *MI, unsigned Op, raw_ostream &OS)
format_object< int64_t > formatImm(int64_t Value) const
Utility function to print immediates in decimal or hex.
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
void setOpcode(unsigned Op)
void printMemReference(const MCInst *MI, unsigned Op, raw_ostream &OS)
AddrSegmentReg - The operand # of the segment in the memory operand.
const FeatureBitset & getFeatureBits() const
getFeatureBits - Return the feature bits.
void printU8Imm(const MCInst *MI, unsigned Op, raw_ostream &OS)
raw_ostream * CommentStream
A stream that comments can be emitted to if desired.
unsigned getOpcode() const
llvm_unreachable("Unknown RegBank!")
void printPCRelImm(const MCInst *MI, unsigned OpNo, raw_ostream &OS)
printPCRelImm - This is used to print an immediate value that ends up being encoded as a pc-relative ...
MCSubtargetInfo - Generic base class for all target subtargets.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
void print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens=false) const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void printAnnotation(raw_ostream &OS, StringRef Annot)
Utility function for printing annotations.
This class implements an extremely fast bulk output stream that can only output to a stream...
bool printAliasInstr(const MCInst *MI, raw_ostream &OS)
StringRef - Represent a constant reference to a string, i.e.
Instances of this class represent operands of the MCInst class.
const MCOperand & getOperand(unsigned i) const
void printRoundingControl(const MCInst *MI, unsigned Op, raw_ostream &OS)
bool EmitAnyX86InstComments(const MCInst *MI, raw_ostream &OS, const char *(*getRegName)(unsigned))
EmitAnyX86InstComments - This function decodes x86 instructions and prints newline terminated strings...