X86: Make disassembly use the final register index. Add bits to indicate whether or not register indexes should be "folded".

--HG--
extra : convert_revision : 4b46e71ca91e480f6e1662b7f37b75240d6598e9
This commit is contained in:
Gabe Black 2007-07-30 13:23:33 -07:00
parent 9b5421dcba
commit d8beeff324
5 changed files with 19 additions and 10 deletions

View file

@ -66,13 +66,13 @@ namespace X86ISA
std::stringstream response; std::stringstream response;
printMnemonic(response, instMnem, mnemonic); printMnemonic(response, instMnem, mnemonic);
printReg(response, data, dataSize); printDestReg(response, 0, dataSize);
response << ", "; response << ", ";
printSegment(response, segment); printSegment(response, segment);
ccprintf(response, ":[%d*", scale); ccprintf(response, ":[%d*", scale);
printReg(response, index, addressSize); printSrcReg(response, 0, addressSize);
response << " + "; response << " + ";
printReg(response, base, addressSize); printSrcReg(response, 1, addressSize);
ccprintf(response, " + %#x]", disp); ccprintf(response, " + %#x]", disp);
return response.str(); return response.str();
} }

View file

@ -76,6 +76,7 @@ namespace X86ISA
const RegIndex data; const RegIndex data;
const uint8_t dataSize; const uint8_t dataSize;
const uint8_t addressSize; const uint8_t addressSize;
RegIndex foldOBit, foldABit;
//Constructor //Constructor
LdStOp(ExtMachInst _machInst, LdStOp(ExtMachInst _machInst,
@ -92,7 +93,11 @@ namespace X86ISA
disp(_disp), segment(_segment), disp(_disp), segment(_segment),
data(_data), data(_data),
dataSize(_dataSize), addressSize(_addressSize) dataSize(_dataSize), addressSize(_addressSize)
{} {
foldOBit = (dataSize == 1 && !_machInst.rex.present) ? 1 << 6 : 0;
foldABit =
(addressSize == 1 && !_machInst.rex.present) ? 1 << 6 : 0;
}
std::string generateDisassembly(Addr pc, std::string generateDisassembly(Addr pc,
const SymbolTable *symtab) const; const SymbolTable *symtab) const;

View file

@ -173,11 +173,11 @@ namespace X86ISA
std::stringstream response; std::stringstream response;
printMnemonic(response, instMnem, mnemonic); printMnemonic(response, instMnem, mnemonic);
printReg(response, dest, dataSize); printDestReg(response, 0, dataSize);
response << ", "; response << ", ";
printReg(response, src1, dataSize); printSrcReg(response, 0, dataSize);
response << ", "; response << ", ";
printReg(response, src2, dataSize); printSrcReg(response, 1, dataSize);
return response.str(); return response.str();
} }
@ -187,9 +187,9 @@ namespace X86ISA
std::stringstream response; std::stringstream response;
printMnemonic(response, instMnem, mnemonic); printMnemonic(response, instMnem, mnemonic);
printReg(response, dest, dataSize); printDestReg(response, 0, dataSize);
response << ", "; response << ", ";
printReg(response, src1, dataSize); printSrcReg(response, 0, dataSize);
ccprintf(response, ", %#x", imm8); ccprintf(response, ", %#x", imm8);
return response.str(); return response.str();
} }

View file

@ -113,6 +113,7 @@ namespace X86ISA
const RegIndex dest; const RegIndex dest;
const uint8_t dataSize; const uint8_t dataSize;
const uint16_t ext; const uint16_t ext;
RegIndex foldOBit;
// Constructor // Constructor
RegOpBase(ExtMachInst _machInst, RegOpBase(ExtMachInst _machInst,
@ -128,6 +129,7 @@ namespace X86ISA
src1(_src1), dest(_dest), src1(_src1), dest(_dest),
dataSize(_dataSize), ext(_ext) dataSize(_dataSize), ext(_ext)
{ {
foldOBit = (dataSize == 1 && !_machInst.rex.present) ? 1 << 6 : 0;
} }
//Figure out what the condition code flags should be. //Figure out what the condition code flags should be.

View file

@ -78,6 +78,7 @@ def template MicroLimmOpDeclare {{
const RegIndex dest; const RegIndex dest;
const uint64_t imm; const uint64_t imm;
const uint8_t dataSize; const uint8_t dataSize;
RegIndex foldOBit;
void buildMe(); void buildMe();
std::string generateDisassembly(Addr pc, std::string generateDisassembly(Addr pc,
@ -104,7 +105,7 @@ def template MicroLimmOpDisassembly {{
std::stringstream response; std::stringstream response;
printMnemonic(response, instMnem, mnemonic); printMnemonic(response, instMnem, mnemonic);
printReg(response, dest, dataSize); printDestReg(response, 0, dataSize);
response << ", "; response << ", ";
ccprintf(response, "%#x", imm); ccprintf(response, "%#x", imm);
return response.str(); return response.str();
@ -115,6 +116,7 @@ def template MicroLimmOpConstructor {{
inline void %(class_name)s::buildMe() inline void %(class_name)s::buildMe()
{ {
foldOBit = (dataSize == 1 && !machInst.rex.present) ? 1 << 6 : 0;
%(constructor)s; %(constructor)s;
} }