mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-06 06:33:24 +00:00
c96096cc0f
Summary: This required me to implement the disassembler for MIPS64r6 since the encodings are ambiguous with other instructions. This in turn revealed a few assembly/disassembly bugs which I have fixed. * da[ht]i only take two operands according to the spec, not three. * DecodeBranchTarget2[16] correctly handles wider immediates than simm16 * Also made non-functional change to DecodeBranchTarget and DecodeBranchTargetMM to keep implementation style consistent between them. * Difficult encodings are handled by a custom decode method on the most general encoding in the group. This method will convert the MCInst to a different opcode if necessary. DecodeBranchTarget is not currently the inverse of getBranchTargetOpValue so disassembling some branch instructions emit incorrect output. This seems to affect branches with delay slots on all MIPS ISA's. I've left this bug for now and temporarily removed the check for the immediate on bc[12]eqz/bc[12]nez in the MIPS32r6/MIPS64r6 tests. jialc and jic crash the disassembler for some reason. I've left these instructions commented out for the moment. Depends on D3760 Reviewers: jkolek, zoran.jovanovic, vmedic Reviewed By: vmedic Differential Revision: http://reviews.llvm.org/D3761 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209415 91177308-0d34-0410-b5e6-96231b3b80d8
90 lines
3.6 KiB
TableGen
90 lines
3.6 KiB
TableGen
//=- Mips64r6InstrInfo.td - Mips64r6 Instruction Information -*- tablegen -*-=//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file describes Mips64r6 instructions.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Notes about removals/changes from MIPS32r6:
|
|
// Reencoded: dclo, dclz
|
|
// Reencoded: lld, scd
|
|
// Removed: daddi
|
|
// Removed: ddiv, ddivu, dmult, dmultu
|
|
// Removed: div, divu
|
|
// Removed: ldl, ldr, ldle, ldre, sdl, sdr, sdle, sdre
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Instruction Encodings
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
class DALIGN_ENC : SPECIAL3_DALIGN_FM<OPCODE6_DALIGN>;
|
|
class DAUI_ENC : DAUI_FM;
|
|
class DAHI_ENC : REGIMM_FM<OPCODE5_DAHI>;
|
|
class DATI_ENC : REGIMM_FM<OPCODE5_DATI>;
|
|
class DBITSWAP_ENC : SPECIAL3_2R_FM<OPCODE6_DBITSWAP>;
|
|
class DDIV_ENC : SPECIAL_3R_FM<0b00010, 0b011110>;
|
|
class DDIVU_ENC : SPECIAL_3R_FM<0b00010, 0b011111>;
|
|
class DMOD_ENC : SPECIAL_3R_FM<0b00011, 0b011110>;
|
|
class DMODU_ENC : SPECIAL_3R_FM<0b00011, 0b011111>;
|
|
class DMUH_ENC : SPECIAL_3R_FM<0b00011, 0b111000>;
|
|
class DMUHU_ENC : SPECIAL_3R_FM<0b00011, 0b111001>;
|
|
class DMUL_R6_ENC : SPECIAL_3R_FM<0b00010, 0b111000>;
|
|
class DMULU_ENC : SPECIAL_3R_FM<0b00010, 0b111001>;
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Instruction Descriptions
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
class AHI_ATI_DESC_BASE<string instr_asm, RegisterOperand GPROpnd> {
|
|
dag OutOperandList = (outs GPROpnd:$rs);
|
|
dag InOperandList = (ins GPROpnd:$rt, simm16:$imm);
|
|
string AsmString = !strconcat(instr_asm, "\t$rt, $imm");
|
|
string Constraints = "$rs = $rt";
|
|
}
|
|
|
|
class DALIGN_DESC : ALIGN_DESC_BASE<"dalign", GPR64Opnd, uimm3>;
|
|
class DAHI_DESC : AHI_ATI_DESC_BASE<"dahi", GPR64Opnd>;
|
|
class DATI_DESC : AHI_ATI_DESC_BASE<"dati", GPR64Opnd>;
|
|
class DAUI_DESC : AUI_DESC_BASE<"daui", GPR64Opnd>;
|
|
class DBITSWAP_DESC : BITSWAP_DESC_BASE<"dbitswap", GPR64Opnd>;
|
|
class DDIV_DESC : DIVMOD_DESC_BASE<"ddiv", GPR64Opnd>;
|
|
class DDIVU_DESC : DIVMOD_DESC_BASE<"ddivu", GPR64Opnd>;
|
|
class DMOD_DESC : DIVMOD_DESC_BASE<"dmod", GPR64Opnd>;
|
|
class DMODU_DESC : DIVMOD_DESC_BASE<"dmodu", GPR64Opnd>;
|
|
class DMUH_DESC : MUL_R6_DESC_BASE<"dmuh", GPR64Opnd>;
|
|
class DMUHU_DESC : MUL_R6_DESC_BASE<"dmuhu", GPR64Opnd>;
|
|
class DMUL_R6_DESC : MUL_R6_DESC_BASE<"dmul", GPR64Opnd>;
|
|
class DMULU_DESC : MUL_R6_DESC_BASE<"dmulu", GPR64Opnd>;
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Instruction Definitions
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
def DAHI : DAHI_ENC, DAHI_DESC, ISA_MIPS64R6;
|
|
def DALIGN : DALIGN_ENC, DALIGN_DESC, ISA_MIPS64R6;
|
|
def DATI : DATI_ENC, DATI_DESC, ISA_MIPS64R6;
|
|
def DAUI : DAUI_ENC, DAUI_DESC, ISA_MIPS64R6;
|
|
def DBITSWAP : DBITSWAP_ENC, DBITSWAP_DESC, ISA_MIPS64R6;
|
|
def DDIV : DDIV_ENC, DDIV_DESC, ISA_MIPS64R6;
|
|
def DDIVU : DDIVU_ENC, DDIVU_DESC, ISA_MIPS64R6;
|
|
// def DLSA; // See MSA
|
|
def DMOD : DMOD_ENC, DMOD_DESC, ISA_MIPS64R6;
|
|
def DMODU : DMODU_ENC, DMODU_DESC, ISA_MIPS64R6;
|
|
def DMUH: DMUH_ENC, DMUH_DESC, ISA_MIPS64R6;
|
|
def DMUHU: DMUHU_ENC, DMUHU_DESC, ISA_MIPS64R6;
|
|
def DMUL_R6: DMUL_R6_ENC, DMUL_R6_DESC, ISA_MIPS64R6;
|
|
def DMULU: DMULU_ENC, DMULU_DESC, ISA_MIPS64R6;
|
|
def LDPC;
|