add a bunch of mod/rm encoding types for fixed mod/rm bytes.

This will work better for the disassembler for modeling things
like lfence/monitor/vmcall etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95960 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2010-02-12 02:06:33 +00:00
parent e79562dce0
commit 0d8db8e0a8
6 changed files with 64 additions and 2 deletions

View File

@ -858,6 +858,27 @@ void Emitter<CodeEmitter>::emitInstruction(const MachineInstr &MI,
getX86RegNum(MI.getOperand(CurOp).getReg()));
++CurOp;
break;
case X86II::MRM_C1:
MCE.emitByte(BaseOpcode);
MCE.emitByte(0xC1);
break;
case X86II::MRM_C8:
MCE.emitByte(BaseOpcode);
MCE.emitByte(0xC8);
break;
case X86II::MRM_C9:
MCE.emitByte(BaseOpcode);
MCE.emitByte(0xC9);
break;
case X86II::MRM_E8:
MCE.emitByte(BaseOpcode);
MCE.emitByte(0xE8);
break;
case X86II::MRM_F0:
MCE.emitByte(BaseOpcode);
MCE.emitByte(0xF0);
break;
}
if (!Desc->isVariadic() && CurOp != NumOps) {

View File

@ -29,6 +29,11 @@ def MRM0m : Format<24>; def MRM1m : Format<25>; def MRM2m : Format<26>;
def MRM3m : Format<27>; def MRM4m : Format<28>; def MRM5m : Format<29>;
def MRM6m : Format<30>; def MRM7m : Format<31>;
def MRMInitReg : Format<32>;
def MRM_C1 : Format<33>;
def MRM_C8 : Format<34>;
def MRM_C9 : Format<35>;
def MRM_E8 : Format<36>;
def MRM_F0 : Format<37>;
// ImmType - This specifies the immediate type used by an instruction. This is

View File

@ -3556,6 +3556,14 @@ static unsigned GetInstSizeWithDesc(const MachineInstr &MI,
}
}
break;
case X86II::MRM_C1:
case X86II::MRM_C8:
case X86II::MRM_C9:
case X86II::MRM_E8:
case X86II::MRM_F0:
FinalSize += 2;
break;
}
case X86II::MRMInitReg:

View File

@ -268,6 +268,13 @@ namespace X86II {
// MRMInitReg - This form is used for instructions whose source and
// destinations are the same register.
MRMInitReg = 32,
//// MRM_C1 - A mod/rm byte of exactly 0xC1.
MRM_C1 = 33,
MRM_C8 = 34,
MRM_C9 = 35,
MRM_E8 = 36,
MRM_F0 = 37,
FormMask = 63,

View File

@ -560,6 +560,26 @@ EncodeInstruction(const MCInst &MI, raw_ostream &OS,
CurByte, OS, Fixups);
CurOp += X86AddrNumOperands;
break;
case X86II::MRM_C1:
EmitByte(BaseOpcode, CurByte, OS);
EmitByte(0xC1, CurByte, OS);
break;
case X86II::MRM_C8:
EmitByte(BaseOpcode, CurByte, OS);
EmitByte(0xC8, CurByte, OS);
break;
case X86II::MRM_C9:
EmitByte(BaseOpcode, CurByte, OS);
EmitByte(0xC9, CurByte, OS);
break;
case X86II::MRM_E8:
EmitByte(BaseOpcode, CurByte, OS);
EmitByte(0xE8, CurByte, OS);
break;
case X86II::MRM_F0:
EmitByte(BaseOpcode, CurByte, OS);
EmitByte(0xF0, CurByte, OS);
break;
}
// If there is a remaining operand, it must be a trailing immediate. Emit it

View File

@ -47,7 +47,8 @@ namespace X86Local {
D8 = 3, D9 = 4, DA = 5, DB = 6,
DC = 7, DD = 8, DE = 9, DF = 10,
XD = 11, XS = 12,
T8 = 13, TA = 14
T8 = 13, P_TA = 14,
P_0F_AE = 16, P_0F_01 = 17
};
}
@ -639,7 +640,7 @@ void RecognizableInstr::emitDecodePath(DisassemblerTables &tables) const {
filter = new DumbFilter();
opcodeToSet = Opcode;
break;
case X86Local::TA:
case X86Local::P_TA:
opcodeType = THREEBYTE_3A;
if (needsModRMForDecode(Form))
filter = new ModFilter(isRegFormat(Form));