|
|
|
|
@ -122,6 +122,11 @@ static std::unique_ptr<Instruction> CloneInstruction(
|
|
|
|
|
return std::make_unique<CastInst>(op, inst->GetType(),
|
|
|
|
|
map(cast->GetOperandValue()), ctx.NextTemp());
|
|
|
|
|
}
|
|
|
|
|
case Opcode::SIToFP: case Opcode::FPToSI: {
|
|
|
|
|
auto* cast = static_cast<CastInst*>(inst);
|
|
|
|
|
return std::make_unique<CastInst>(op, inst->GetType(),
|
|
|
|
|
map(cast->GetOperandValue()), ctx.NextTemp());
|
|
|
|
|
}
|
|
|
|
|
case Opcode::Br: {
|
|
|
|
|
auto* br = static_cast<BranchInst*>(inst);
|
|
|
|
|
return std::make_unique<BranchInst>(inst->GetType(), br->GetTarget());
|
|
|
|
|
@ -223,6 +228,8 @@ void RunLoopUnroll(Module& module) {
|
|
|
|
|
int unrolled = 0;
|
|
|
|
|
for (auto& func : module.GetFunctions()) {
|
|
|
|
|
if (func->IsExternal()) continue;
|
|
|
|
|
// 只处理 i32 返回值函数(float 循环体含不支持克隆的操作)
|
|
|
|
|
if (!func->GetType()->IsInt32()) continue;
|
|
|
|
|
bool changed = true;
|
|
|
|
|
while (changed) {
|
|
|
|
|
changed = false;
|
|
|
|
|
|