mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 17:40:39 +00:00
Handle ret not being in last basic block
This commit is contained in:
@@ -1406,6 +1406,8 @@ Program::Program(const byte *bytes, size_t length)
|
||||
m_Symbols.push_back({SymbolType::Instruction, f.instructions.size()});
|
||||
}
|
||||
|
||||
curBlock++;
|
||||
|
||||
f.instructions.push_back(inst);
|
||||
}
|
||||
else if(op.type == FunctionRecord::INST_BINOP)
|
||||
@@ -2256,6 +2258,8 @@ Program::Program(const byte *bytes, size_t length)
|
||||
}
|
||||
}
|
||||
|
||||
RDCASSERT(curBlock == f.blocks.size());
|
||||
|
||||
size_t resultID = 0;
|
||||
|
||||
if(f.blocks[0].name.empty())
|
||||
@@ -2277,9 +2281,13 @@ Program::Program(const byte *bytes, size_t length)
|
||||
|
||||
if(f.instructions[i].op == Instruction::Branch ||
|
||||
f.instructions[i].op == Instruction::Unreachable ||
|
||||
f.instructions[i].op == Instruction::Switch)
|
||||
f.instructions[i].op == Instruction::Switch || f.instructions[i].op == Instruction::Ret)
|
||||
{
|
||||
curBlock++;
|
||||
|
||||
if(i == f.instructions.size() - 1)
|
||||
break;
|
||||
|
||||
if(f.blocks[curBlock].name.empty())
|
||||
f.blocks[curBlock].resultID = (uint32_t)resultID++;
|
||||
continue;
|
||||
|
||||
@@ -595,8 +595,10 @@ void Program::MakeDisassemblyString()
|
||||
instructionLine++;
|
||||
}
|
||||
|
||||
for(Instruction &inst : func.instructions)
|
||||
for(size_t funcIdx = 0; funcIdx < func.instructions.size(); funcIdx++)
|
||||
{
|
||||
Instruction &inst = func.instructions[funcIdx];
|
||||
|
||||
inst.disassemblyLine = instructionLine;
|
||||
m_Disassembly += " ";
|
||||
if(!inst.name.empty())
|
||||
@@ -1326,8 +1328,12 @@ void Program::MakeDisassemblyString()
|
||||
m_Disassembly += "\n";
|
||||
instructionLine++;
|
||||
|
||||
// if this is the last instruction don't print the next block's label
|
||||
if(funcIdx == func.instructions.size() - 1)
|
||||
break;
|
||||
|
||||
if(inst.op == Instruction::Branch || inst.op == Instruction::Unreachable ||
|
||||
inst.op == Instruction::Switch)
|
||||
inst.op == Instruction::Switch || inst.op == Instruction::Ret)
|
||||
{
|
||||
m_Disassembly += "\n";
|
||||
instructionLine++;
|
||||
|
||||
Reference in New Issue
Block a user