Skip to content

Commit 190b1f4

Browse files
jgu222igcbot
authored andcommitted
Minor change to visa disas
Minor refactor to visa disaa. No functional change.
1 parent 6552fba commit 190b1f4

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

visa/IsaDisassembly.cpp

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -909,11 +909,11 @@ static std::string printInstructionCommon(
909909
static std::string printInstructionControlFlow(
910910
const print_format_provider_t* header,
911911
const CISA_INST* inst,
912-
const Options *opt)
912+
const Options* opt)
913913
{
914914
ISA_Opcode opcode = (ISA_Opcode)inst->opcode;
915915
unsigned i = 0;
916-
uint16_t label_id = 0;
916+
uint16_t label_id = 0;
917917

918918
std::stringstream sstr;
919919

@@ -965,11 +965,14 @@ static std::string printInstructionControlFlow(
965965
}
966966
else
967967
{
968-
sstr << printPredicate(inst->opcode, inst->pred)
969-
<< ISA_Inst_Table[opcode].str
970-
<< " "
971-
<< printExecutionSize(inst->opcode, inst->execsize);
972-
968+
auto printInstName = [](std::stringstream& SS, const CISA_INST* I, const char* IName) {
969+
SS << printPredicate(I->opcode, I->pred)
970+
<< ISA_Inst_Table[I->opcode].str
971+
<< " "
972+
<< printExecutionSize(I->opcode, I->execsize);
973+
};
974+
975+
const char* InstName = ISA_Inst_Table[opcode].str;
973976
switch (opcode)
974977
{
975978
case ISA_JMP:
@@ -980,6 +983,13 @@ static std::string printInstructionControlFlow(
980983
/// label / function id to jump / call to.
981984
label_id = getPrimitiveOperand<uint16_t>(inst, i++);
982985

986+
// If it is fccall, using "fccall" as text name.
987+
bool is_fccall = false; // (opcode == ISA_CALL && header->getLabel(label_id)->kind == LABEL_FC);
988+
InstName = is_fccall ? "fccall" : InstName;
989+
990+
// print instruction name, etc
991+
printInstName(sstr, inst, InstName);
992+
983993
if (opcode == ISA_FCALL)
984994
{
985995
/// function name in string
@@ -1005,6 +1015,9 @@ static std::string printInstructionControlFlow(
10051015
}
10061016
case ISA_IFCALL:
10071017
{
1018+
// print instruction name, etc
1019+
printInstName(sstr, inst, InstName);
1020+
10081021
sstr << printOperand(header, inst, i++, opt);
10091022
/// arg size
10101023
sstr << " " << getPrimitiveOperand<unsigned>(inst, i++);
@@ -1014,6 +1027,9 @@ static std::string printInstructionControlFlow(
10141027
}
10151028
case ISA_FADDR:
10161029
{
1030+
// print instruction name, etc
1031+
printInstName(sstr, inst, InstName);
1032+
10171033
/// symbol name in string
10181034
sstr << header->getString(getPrimitiveOperand<uint16_t>(inst, i++));
10191035
/// dst
@@ -1022,6 +1038,9 @@ static std::string printInstructionControlFlow(
10221038
}
10231039
case ISA_SWITCHJMP:
10241040
{
1041+
// print instruction name, etc
1042+
printInstName(sstr, inst, InstName);
1043+
10251044
/// skip num_labels
10261045
i++;
10271046
/// index

0 commit comments

Comments
 (0)