Commit 080bc4de authored by Lu Yahan's avatar Lu Yahan Committed by V8 LUCI CQ

[riscv64] Fix unreachable break

This is causing a warning on newer build configs (crrev.com/c/3117087)

Change-Id: I8cf7644861c27b9959283510163ecf8acdb6bdc8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3124174
Auto-Submit: Yahan Lu <yahan@iscas.ac.cn>
Commit-Queue: Ji Qiu <qiuji@iscas.ac.cn>
Reviewed-by: 's avatarJi Qiu <qiuji@iscas.ac.cn>
Cr-Commit-Position: refs/heads/main@{#76523}
parent c9261f6a
...@@ -377,7 +377,7 @@ int Assembler::target_at(int pos, bool is_internal) { ...@@ -377,7 +377,7 @@ int Assembler::target_at(int pos, bool is_internal) {
} else { } else {
return pos + imm13; return pos + imm13;
} }
} break; }
case JAL: { case JAL: {
int32_t imm21 = JumpOffset(instr); int32_t imm21 = JumpOffset(instr);
if (imm21 == kEndOfJumpChain) { if (imm21 == kEndOfJumpChain) {
...@@ -386,7 +386,7 @@ int Assembler::target_at(int pos, bool is_internal) { ...@@ -386,7 +386,7 @@ int Assembler::target_at(int pos, bool is_internal) {
} else { } else {
return pos + imm21; return pos + imm21;
} }
} break; }
case JALR: { case JALR: {
int32_t imm12 = instr >> 20; int32_t imm12 = instr >> 20;
if (imm12 == kEndOfJumpChain) { if (imm12 == kEndOfJumpChain) {
...@@ -395,7 +395,7 @@ int Assembler::target_at(int pos, bool is_internal) { ...@@ -395,7 +395,7 @@ int Assembler::target_at(int pos, bool is_internal) {
} else { } else {
return pos + imm12; return pos + imm12;
} }
} break; }
case LUI: { case LUI: {
Address pc = reinterpret_cast<Address>(buffer_start_ + pos); Address pc = reinterpret_cast<Address>(buffer_start_ + pos);
pc = target_address_at(pc); pc = target_address_at(pc);
...@@ -409,7 +409,7 @@ int Assembler::target_at(int pos, bool is_internal) { ...@@ -409,7 +409,7 @@ int Assembler::target_at(int pos, bool is_internal) {
DCHECK(pos > delta); DCHECK(pos > delta);
return pos - delta; return pos - delta;
} }
} break; }
case AUIPC: { case AUIPC: {
Instr instr_auipc = instr; Instr instr_auipc = instr;
Instr instr_I = instr_at(pos + 4); Instr instr_I = instr_at(pos + 4);
...@@ -417,18 +417,18 @@ int Assembler::target_at(int pos, bool is_internal) { ...@@ -417,18 +417,18 @@ int Assembler::target_at(int pos, bool is_internal) {
int32_t offset = BrachlongOffset(instr_auipc, instr_I); int32_t offset = BrachlongOffset(instr_auipc, instr_I);
if (offset == kEndOfJumpChain) return kEndOfChain; if (offset == kEndOfJumpChain) return kEndOfChain;
return offset + pos; return offset + pos;
} break; }
case RO_C_J: { case RO_C_J: {
int32_t offset = instruction->RvcImm11CJValue(); int32_t offset = instruction->RvcImm11CJValue();
if (offset == kEndOfJumpChain) return kEndOfChain; if (offset == kEndOfJumpChain) return kEndOfChain;
return offset + pos; return offset + pos;
} break; }
case RO_C_BNEZ: case RO_C_BNEZ:
case RO_C_BEQZ: { case RO_C_BEQZ: {
int32_t offset = instruction->RvcImm8BValue(); int32_t offset = instruction->RvcImm8BValue();
if (offset == kEndOfJumpChain) return kEndOfChain; if (offset == kEndOfJumpChain) return kEndOfChain;
return pos + offset; return pos + offset;
} break; }
default: { default: {
if (instr == kEndOfJumpChain) { if (instr == kEndOfJumpChain) {
return kEndOfChain; return kEndOfChain;
...@@ -437,7 +437,7 @@ int Assembler::target_at(int pos, bool is_internal) { ...@@ -437,7 +437,7 @@ int Assembler::target_at(int pos, bool is_internal) {
((instr & static_cast<int32_t>(kImm16Mask)) << 16) >> 14; ((instr & static_cast<int32_t>(kImm16Mask)) << 16) >> 14;
return (imm18 + pos); return (imm18 + pos);
} }
} break; }
} }
} }
...@@ -2766,7 +2766,6 @@ int Assembler::RelocateInternalReference(RelocInfo::Mode rmode, Address pc, ...@@ -2766,7 +2766,6 @@ int Assembler::RelocateInternalReference(RelocInfo::Mode rmode, Address pc,
return 8; // Number of instructions patched. return 8; // Number of instructions patched.
} else { } else {
UNIMPLEMENTED(); UNIMPLEMENTED();
return 1;
} }
} }
......
...@@ -2452,7 +2452,6 @@ void TurboAssembler::CompareI(Register rd, Register rs, const Operand& rt, ...@@ -2452,7 +2452,6 @@ void TurboAssembler::CompareI(Register rd, Register rs, const Operand& rt,
break; break;
case cc_always: case cc_always:
UNREACHABLE(); UNREACHABLE();
break;
default: default:
UNREACHABLE(); UNREACHABLE();
} }
...@@ -3018,7 +3017,6 @@ bool TurboAssembler::BranchShortCheck(int32_t offset, Label* L, Condition cond, ...@@ -3018,7 +3017,6 @@ bool TurboAssembler::BranchShortCheck(int32_t offset, Label* L, Condition cond,
DCHECK_EQ(offset, 0); DCHECK_EQ(offset, 0);
return BranchShortHelper(0, L, cond, rs, rt); return BranchShortHelper(0, L, cond, rs, rt);
} }
return false;
} }
void TurboAssembler::BranchShort(int32_t offset, Condition cond, Register rs, void TurboAssembler::BranchShort(int32_t offset, Condition cond, Register rs,
...@@ -3134,7 +3132,6 @@ bool TurboAssembler::BranchAndLinkShortCheck(int32_t offset, Label* L, ...@@ -3134,7 +3132,6 @@ bool TurboAssembler::BranchAndLinkShortCheck(int32_t offset, Label* L,
DCHECK_EQ(offset, 0); DCHECK_EQ(offset, 0);
return BranchAndLinkShortHelper(0, L, cond, rs, rt); return BranchAndLinkShortHelper(0, L, cond, rs, rt);
} }
return false;
} }
void TurboAssembler::LoadFromConstantsTable(Register destination, void TurboAssembler::LoadFromConstantsTable(Register destination,
......
...@@ -106,7 +106,6 @@ class RiscvOperandConverter final : public InstructionOperandConverter { ...@@ -106,7 +106,6 @@ class RiscvOperandConverter final : public InstructionOperandConverter {
constant.ToDelayedStringConstant()); constant.ToDelayedStringConstant());
case Constant::kRpoNumber: case Constant::kRpoNumber:
UNREACHABLE(); // TODO(titzer): RPO immediates UNREACHABLE(); // TODO(titzer): RPO immediates
break;
} }
UNREACHABLE(); UNREACHABLE();
} }
...@@ -1919,7 +1918,6 @@ void AssembleBranchToLabels(CodeGenerator* gen, TurboAssembler* tasm, ...@@ -1919,7 +1918,6 @@ void AssembleBranchToLabels(CodeGenerator* gen, TurboAssembler* tasm,
break; break;
default: default:
UNSUPPORTED_COND(instr->arch_opcode(), condition); UNSUPPORTED_COND(instr->arch_opcode(), condition);
break;
} }
} else if (instr->arch_opcode() == kRiscvMulOvf32) { } else if (instr->arch_opcode() == kRiscvMulOvf32) {
// Overflow occurs if overflow register is not zero // Overflow occurs if overflow register is not zero
...@@ -1932,7 +1930,6 @@ void AssembleBranchToLabels(CodeGenerator* gen, TurboAssembler* tasm, ...@@ -1932,7 +1930,6 @@ void AssembleBranchToLabels(CodeGenerator* gen, TurboAssembler* tasm,
break; break;
default: default:
UNSUPPORTED_COND(kRiscvMulOvf32, condition); UNSUPPORTED_COND(kRiscvMulOvf32, condition);
break;
} }
} else if (instr->arch_opcode() == kRiscvCmp) { } else if (instr->arch_opcode() == kRiscvCmp) {
cc = FlagsConditionToConditionCmp(condition); cc = FlagsConditionToConditionCmp(condition);
...@@ -2597,7 +2594,6 @@ void CodeGenerator::AssembleMove(InstructionOperand* source, ...@@ -2597,7 +2594,6 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
} }
case Constant::kRpoNumber: case Constant::kRpoNumber:
UNREACHABLE(); // TODO(titzer): loading RPO numbers UNREACHABLE(); // TODO(titzer): loading RPO numbers
break;
} }
if (destination->IsStackSlot()) __ Sd(dst, g.ToMemOperand(destination)); if (destination->IsStackSlot()) __ Sd(dst, g.ToMemOperand(destination));
} else if (src.type() == Constant::kFloat32) { } else if (src.type() == Constant::kFloat32) {
......
...@@ -563,7 +563,6 @@ void InstructionSelector::VisitStore(Node* node) { ...@@ -563,7 +563,6 @@ void InstructionSelector::VisitStore(Node* node) {
break; break;
#else #else
UNREACHABLE(); UNREACHABLE();
break;
#endif #endif
case MachineRepresentation::kMapWord: // Fall through. case MachineRepresentation::kMapWord: // Fall through.
case MachineRepresentation::kNone: case MachineRepresentation::kNone:
......
...@@ -1882,7 +1882,7 @@ const char* NameConverter::NameOfXMMRegister(int reg) const { ...@@ -1882,7 +1882,7 @@ const char* NameConverter::NameOfXMMRegister(int reg) const {
const char* NameConverter::NameOfByteCPURegister(int reg) const { const char* NameConverter::NameOfByteCPURegister(int reg) const {
UNREACHABLE(); // RISC-V does not have the concept of a byte register. UNREACHABLE(); // RISC-V does not have the concept of a byte register.
return "nobytereg"; //return "nobytereg";
} }
const char* NameConverter::NameInCode(byte* addr) const { const char* NameConverter::NameInCode(byte* addr) const {
......
...@@ -172,7 +172,6 @@ bool RiscvDebugger::GetValue(const char* desc, int64_t* value) { ...@@ -172,7 +172,6 @@ bool RiscvDebugger::GetValue(const char* desc, int64_t* value) {
} else { } else {
return SScanF(desc, "%" SCNu64, reinterpret_cast<uint64_t*>(value)) == 1; return SScanF(desc, "%" SCNu64, reinterpret_cast<uint64_t*>(value)) == 1;
} }
return false;
} }
#define REG_INFO(name) \ #define REG_INFO(name) \
...@@ -1424,7 +1423,6 @@ void Simulator::SoftwareInterrupt() { ...@@ -1424,7 +1423,6 @@ void Simulator::SoftwareInterrupt() {
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();
break;
} }
} }
switch (redirection->type()) { switch (redirection->type()) {
...@@ -1459,7 +1457,6 @@ void Simulator::SoftwareInterrupt() { ...@@ -1459,7 +1457,6 @@ void Simulator::SoftwareInterrupt() {
} }
default: default:
UNREACHABLE(); UNREACHABLE();
break;
} }
if (::v8::internal::FLAG_trace_sim) { if (::v8::internal::FLAG_trace_sim) {
switch (redirection->type()) { switch (redirection->type()) {
...@@ -1473,7 +1470,6 @@ void Simulator::SoftwareInterrupt() { ...@@ -1473,7 +1470,6 @@ void Simulator::SoftwareInterrupt() {
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();
break;
} }
} }
} else if (redirection->type() == ExternalReference::DIRECT_API_CALL) { } else if (redirection->type() == ExternalReference::DIRECT_API_CALL) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment