mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
Convert some assert(0) to llvm_unreachable or fold an 'if' condition into the assert.
llvm-svn: 211254
This commit is contained in:
parent
47b0791075
commit
c20830d1c1
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "llvm/Support/Compiler.h"
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/DataStream.h"
|
#include "llvm/Support/DataStream.h"
|
||||||
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
#include "llvm/Support/MemoryObject.h"
|
#include "llvm/Support/MemoryObject.h"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -115,7 +116,7 @@ public:
|
|||||||
// requiring that the bitcode size be known, or otherwise ensuring that
|
// requiring that the bitcode size be known, or otherwise ensuring that
|
||||||
// the memory doesn't go away/get reallocated, but it's
|
// the memory doesn't go away/get reallocated, but it's
|
||||||
// not currently necessary. Users that need the pointer don't stream.
|
// not currently necessary. Users that need the pointer don't stream.
|
||||||
assert(0 && "getPointer in streaming memory objects not allowed");
|
llvm_unreachable("getPointer in streaming memory objects not allowed");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
bool isValidAddress(uint64_t address) const override;
|
bool isValidAddress(uint64_t address) const override;
|
||||||
@ -154,8 +155,8 @@ private:
|
|||||||
kChunkSize);
|
kChunkSize);
|
||||||
BytesRead += bytes;
|
BytesRead += bytes;
|
||||||
if (bytes < kChunkSize) {
|
if (bytes < kChunkSize) {
|
||||||
if (ObjectSize && BytesRead < Pos)
|
assert((!ObjectSize || BytesRead >= Pos) &&
|
||||||
assert(0 && "Unexpected short read fetching bitcode");
|
"Unexpected short read fetching bitcode");
|
||||||
if (BytesRead <= Pos) { // reached EOF/ran out of bytes
|
if (BytesRead <= Pos) { // reached EOF/ran out of bytes
|
||||||
ObjectSize = BytesRead;
|
ObjectSize = BytesRead;
|
||||||
EOFReached = true;
|
EOFReached = true;
|
||||||
|
@ -1574,8 +1574,7 @@ void ELFObjectWriter::WriteSection(MCAssembler &Asm,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
assert(0 && "FIXME: sh_type value not supported!");
|
llvm_unreachable("FIXME: sh_type value not supported!");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TargetObjectWriter->getEMachine() == ELF::EM_ARM &&
|
if (TargetObjectWriter->getEMachine() == ELF::EM_ARM &&
|
||||||
|
@ -811,20 +811,14 @@ Init *UnOpInit::Fold(Record *CurRec, MultiClass *CurMultiClass) const {
|
|||||||
}
|
}
|
||||||
case HEAD: {
|
case HEAD: {
|
||||||
if (ListInit *LHSl = dyn_cast<ListInit>(LHS)) {
|
if (ListInit *LHSl = dyn_cast<ListInit>(LHS)) {
|
||||||
if (LHSl->getSize() == 0) {
|
assert(LHSl->getSize() != 0 && "Empty list in car");
|
||||||
assert(0 && "Empty list in car");
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
return LHSl->getElement(0);
|
return LHSl->getElement(0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TAIL: {
|
case TAIL: {
|
||||||
if (ListInit *LHSl = dyn_cast<ListInit>(LHS)) {
|
if (ListInit *LHSl = dyn_cast<ListInit>(LHS)) {
|
||||||
if (LHSl->getSize() == 0) {
|
assert(LHSl->getSize() != 0 && "Empty list in cdr");
|
||||||
assert(0 && "Empty list in cdr");
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
// Note the +1. We can't just pass the result of getValues()
|
// Note the +1. We can't just pass the result of getValues()
|
||||||
// directly.
|
// directly.
|
||||||
ArrayRef<Init *>::iterator begin = LHSl->getValues().begin()+1;
|
ArrayRef<Init *>::iterator begin = LHSl->getValues().begin()+1;
|
||||||
|
@ -823,8 +823,7 @@ AArch64TargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI,
|
|||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
MI->dump();
|
MI->dump();
|
||||||
#endif
|
#endif
|
||||||
assert(0 && "Unexpected instruction for custom inserter!");
|
llvm_unreachable("Unexpected instruction for custom inserter!");
|
||||||
break;
|
|
||||||
|
|
||||||
case AArch64::F128CSEL:
|
case AArch64::F128CSEL:
|
||||||
return EmitF128CSEL(MI, BB);
|
return EmitF128CSEL(MI, BB);
|
||||||
@ -833,7 +832,6 @@ AArch64TargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI,
|
|||||||
case TargetOpcode::PATCHPOINT:
|
case TargetOpcode::PATCHPOINT:
|
||||||
return emitPatchPoint(MI, BB);
|
return emitPatchPoint(MI, BB);
|
||||||
}
|
}
|
||||||
llvm_unreachable("Unexpected instruction for custom inserter!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
@ -3447,8 +3447,7 @@ bool AArch64AsmParser::showMatchError(SMLoc Loc, unsigned ErrCode) {
|
|||||||
case Match_MnemonicFail:
|
case Match_MnemonicFail:
|
||||||
return Error(Loc, "unrecognized instruction mnemonic");
|
return Error(Loc, "unrecognized instruction mnemonic");
|
||||||
default:
|
default:
|
||||||
assert(0 && "unexpected error code!");
|
llvm_unreachable("unexpected error code!");
|
||||||
return Error(Loc, "invalid instruction format");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,8 +37,7 @@ getVariant(uint64_t LLVMDisassembler_VariantKind) {
|
|||||||
case LLVMDisassembler_VariantKind_ARM64_TLVP:
|
case LLVMDisassembler_VariantKind_ARM64_TLVP:
|
||||||
case LLVMDisassembler_VariantKind_ARM64_TLVOFF:
|
case LLVMDisassembler_VariantKind_ARM64_TLVOFF:
|
||||||
default:
|
default:
|
||||||
assert(0 && "bad LLVMDisassembler_VariantKind");
|
llvm_unreachable("bad LLVMDisassembler_VariantKind");
|
||||||
return MCSymbolRefExpr::VK_None;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,13 +218,9 @@ AArch64MCCodeEmitter::getMachineOpValue(const MCInst &MI, const MCOperand &MO,
|
|||||||
const MCSubtargetInfo &STI) const {
|
const MCSubtargetInfo &STI) const {
|
||||||
if (MO.isReg())
|
if (MO.isReg())
|
||||||
return Ctx.getRegisterInfo()->getEncodingValue(MO.getReg());
|
return Ctx.getRegisterInfo()->getEncodingValue(MO.getReg());
|
||||||
else {
|
|
||||||
assert(MO.isImm() && "did not expect relocated expression");
|
|
||||||
return static_cast<unsigned>(MO.getImm());
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(0 && "Unable to encode MCOperand!");
|
assert(MO.isImm() && "did not expect relocated expression");
|
||||||
return 0;
|
return static_cast<unsigned>(MO.getImm());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<unsigned FixupKind> uint32_t
|
template<unsigned FixupKind> uint32_t
|
||||||
|
@ -321,8 +321,7 @@ unsigned A15SDOptimizer::optimizeSDPattern(MachineInstr *MI) {
|
|||||||
return optimizeAllLanesPattern(MI, MI->getOperand(0).getReg());
|
return optimizeAllLanesPattern(MI, MI->getOperand(0).getReg());
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(0 && "Unhandled update pattern!");
|
llvm_unreachable("Unhandled update pattern!");
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return true if this MachineInstr inserts a scalar (SPR) value into
|
// Return true if this MachineInstr inserts a scalar (SPR) value into
|
||||||
|
@ -1047,8 +1047,7 @@ ARMMCCodeEmitter::getHiLo16ImmOpValue(const MCInst &MI, unsigned OpIdx,
|
|||||||
// we have a movt or a movw, but that led to misleadingly results.
|
// we have a movt or a movw, but that led to misleadingly results.
|
||||||
// This is now disallowed in the the AsmParser in validateInstruction()
|
// This is now disallowed in the the AsmParser in validateInstruction()
|
||||||
// so this should never happen.
|
// so this should never happen.
|
||||||
assert(0 && "expression without :upper16: or :lower16:");
|
llvm_unreachable("expression without :upper16: or :lower16:");
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ARMMCCodeEmitter::
|
uint32_t ARMMCCodeEmitter::
|
||||||
|
@ -1538,14 +1538,13 @@ int HexagonInstrInfo::GetDotOldOp(const int opc) const {
|
|||||||
int NewOp = opc;
|
int NewOp = opc;
|
||||||
if (isPredicated(NewOp) && isPredicatedNew(NewOp)) { // Get predicate old form
|
if (isPredicated(NewOp) && isPredicatedNew(NewOp)) { // Get predicate old form
|
||||||
NewOp = Hexagon::getPredOldOpcode(NewOp);
|
NewOp = Hexagon::getPredOldOpcode(NewOp);
|
||||||
if (NewOp < 0)
|
assert(NewOp >= 0 &&
|
||||||
assert(0 && "Couldn't change predicate new instruction to its old form.");
|
"Couldn't change predicate new instruction to its old form.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isNewValueStore(NewOp)) { // Convert into non-new-value format
|
if (isNewValueStore(NewOp)) { // Convert into non-new-value format
|
||||||
NewOp = Hexagon::getNonNVStore(NewOp);
|
NewOp = Hexagon::getNonNVStore(NewOp);
|
||||||
if (NewOp < 0)
|
assert(NewOp >= 0 && "Couldn't change new-value store to its old form.");
|
||||||
assert(0 && "Couldn't change new-value store to its old form.");
|
|
||||||
}
|
}
|
||||||
return NewOp;
|
return NewOp;
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ public:
|
|||||||
const MCRelaxableFragment *DF,
|
const MCRelaxableFragment *DF,
|
||||||
const MCAsmLayout &Layout) const override {
|
const MCAsmLayout &Layout) const override {
|
||||||
// FIXME.
|
// FIXME.
|
||||||
assert(0 && "RelaxInstruction() unimplemented");
|
llvm_unreachable("RelaxInstruction() unimplemented");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,17 +172,13 @@ uint64_t R600MCCodeEmitter::getMachineOpValue(const MCInst &MI,
|
|||||||
SmallVectorImpl<MCFixup> &Fixup,
|
SmallVectorImpl<MCFixup> &Fixup,
|
||||||
const MCSubtargetInfo &STI) const {
|
const MCSubtargetInfo &STI) const {
|
||||||
if (MO.isReg()) {
|
if (MO.isReg()) {
|
||||||
if (HAS_NATIVE_OPERANDS(MCII.get(MI.getOpcode()).TSFlags)) {
|
if (HAS_NATIVE_OPERANDS(MCII.get(MI.getOpcode()).TSFlags))
|
||||||
return MRI.getEncodingValue(MO.getReg());
|
return MRI.getEncodingValue(MO.getReg());
|
||||||
} else {
|
return getHWReg(MO.getReg());
|
||||||
return getHWReg(MO.getReg());
|
|
||||||
}
|
|
||||||
} else if (MO.isImm()) {
|
|
||||||
return MO.getImm();
|
|
||||||
} else {
|
|
||||||
assert(0);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(MO.isImm());
|
||||||
|
return MO.getImm();
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "AMDGPUGenMCCodeEmitter.inc"
|
#include "AMDGPUGenMCCodeEmitter.inc"
|
||||||
|
@ -173,6 +173,6 @@ void SparcInstPrinter::printCCOperand(const MCInst *MI, int opNum,
|
|||||||
bool SparcInstPrinter::printGetPCX(const MCInst *MI, unsigned opNum,
|
bool SparcInstPrinter::printGetPCX(const MCInst *MI, unsigned opNum,
|
||||||
raw_ostream &O)
|
raw_ostream &O)
|
||||||
{
|
{
|
||||||
assert(0 && "FIXME: Implement SparcInstPrinter::printGetPCX.");
|
llvm_unreachable("FIXME: Implement SparcInstPrinter::printGetPCX.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,7 @@ namespace {
|
|||||||
const MCRelaxableFragment *DF,
|
const MCRelaxableFragment *DF,
|
||||||
const MCAsmLayout &Layout) const override {
|
const MCAsmLayout &Layout) const override {
|
||||||
// FIXME.
|
// FIXME.
|
||||||
assert(0 && "fixupNeedsRelaxation() unimplemented");
|
llvm_unreachable("fixupNeedsRelaxation() unimplemented");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
void relaxInstruction(const MCInst &Inst, MCInst &Res) const override {
|
void relaxInstruction(const MCInst &Inst, MCInst &Res) const override {
|
||||||
|
@ -133,7 +133,7 @@ getMachineOpValue(const MCInst &MI, const MCOperand &MO,
|
|||||||
if (Expr->EvaluateAsAbsolute(Res))
|
if (Expr->EvaluateAsAbsolute(Res))
|
||||||
return Res;
|
return Res;
|
||||||
|
|
||||||
assert(0 && "Unhandled expression!");
|
llvm_unreachable("Unhandled expression!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user