diff options
author | Craig Topper <craig.topper@intel.com> | 2019-04-05 19:28:09 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2019-04-05 19:28:09 +0000 |
commit | 80aa2290fb02386579e5d7b0a1d8ce3691fd88da (patch) | |
tree | 1978efce308a80e3eb9b48155418940531556fb2 /llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp | |
parent | 7323c2bf850b61b85252e17e6f1f73037c328378 (diff) | |
download | bcm5719-llvm-80aa2290fb02386579e5d7b0a1d8ce3691fd88da.tar.gz bcm5719-llvm-80aa2290fb02386579e5d7b0a1d8ce3691fd88da.zip |
[X86] Merge the different Jcc instructions for each condition code into single instructions that store the condition code as an operand.
Summary:
This avoids needing an isel pattern for each condition code. And it removes translation switches for converting between Jcc instructions and condition codes.
Now the printer, encoder and disassembler take care of converting the immediate. We use InstAliases to handle the assembly matching. But we print using the asm string in the instruction definition. The instruction itself is marked IsCodeGenOnly=1 to hide it from the assembly parser.
Reviewers: spatel, lebedev.ri, courbet, gchatelet, RKSimon
Reviewed By: RKSimon
Subscribers: MatzeB, qcolombet, eraman, hiraditya, arphaman, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60228
llvm-svn: 357802
Diffstat (limited to 'llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp')
-rw-r--r-- | llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp index 05e19a3db1c..d063c4e5a86 100644 --- a/llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp +++ b/llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp @@ -1273,6 +1273,8 @@ encodeInstruction(const MCInst &MI, raw_ostream &OS, if ((TSFlags & X86II::OpMapMask) == X86II::ThreeDNow) BaseOpcode = 0x0F; // Weird 3DNow! encoding. + unsigned OpcodeOffset = 0; + uint64_t Form = TSFlags & X86II::FormMask; switch (Form) { default: errs() << "FORM: " << Form << "\n"; @@ -1319,8 +1321,14 @@ encodeInstruction(const MCInst &MI, raw_ostream &OS, EmitByte(BaseOpcode, CurByte, OS); break; } - case X86II::RawFrm: { - EmitByte(BaseOpcode, CurByte, OS); + case X86II::AddCCFrm: { + // This will be added to the opcode in the fallthrough. + OpcodeOffset = MI.getOperand(NumOps - 1).getImm(); + assert(OpcodeOffset < 16 && "Unexpected opcode offset!"); + --NumOps; // Drop the operand from the end. + LLVM_FALLTHROUGH; + case X86II::RawFrm: + EmitByte(BaseOpcode + OpcodeOffset, CurByte, OS); if (!is64BitMode(STI) || !isPCRel32Branch(MI)) break; |