diff options
author | Torok Edwin <edwintorok@gmail.com> | 2009-07-11 20:10:48 +0000 |
---|---|---|
committer | Torok Edwin <edwintorok@gmail.com> | 2009-07-11 20:10:48 +0000 |
commit | c25e7581b9b8088910da31702d4ca21c4734c6d7 (patch) | |
tree | e4bb95c96a33fda5d5204f2c9d1b906084760415 /lib/Target/MSP430 | |
parent | d51ffcf303070b0a5aea7f365b85f6f969c384cb (diff) | |
download | external_llvm-c25e7581b9b8088910da31702d4ca21c4734c6d7.tar.gz external_llvm-c25e7581b9b8088910da31702d4ca21c4734c6d7.tar.bz2 external_llvm-c25e7581b9b8088910da31702d4ca21c4734c6d7.zip |
assert(0) -> LLVM_UNREACHABLE.
Make llvm_unreachable take an optional string, thus moving the cerr<< out of
line.
LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for
NDEBUG builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75379 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/MSP430')
-rw-r--r-- | lib/Target/MSP430/MSP430AsmPrinter.cpp | 11 | ||||
-rw-r--r-- | lib/Target/MSP430/MSP430ISelLowering.cpp | 10 | ||||
-rw-r--r-- | lib/Target/MSP430/MSP430InstrInfo.cpp | 7 | ||||
-rw-r--r-- | lib/Target/MSP430/MSP430RegisterInfo.cpp | 7 |
4 files changed, 19 insertions, 16 deletions
diff --git a/lib/Target/MSP430/MSP430AsmPrinter.cpp b/lib/Target/MSP430/MSP430AsmPrinter.cpp index b1fa3f0e7d..0f711abc4f 100644 --- a/lib/Target/MSP430/MSP430AsmPrinter.cpp +++ b/lib/Target/MSP430/MSP430AsmPrinter.cpp @@ -31,6 +31,7 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/Mangler.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Support/ErrorHandling.h" using namespace llvm; @@ -99,7 +100,7 @@ void MSP430AsmPrinter::emitFunctionHeader(const MachineFunction &MF) { EmitAlignment(FnAlign, F); switch (F->getLinkage()) { - default: assert(0 && "Unknown linkage type!"); + default: LLVM_UNREACHABLE("Unknown linkage type!"); case Function::InternalLinkage: // Symbols default to internal. case Function::PrivateLinkage: break; @@ -161,7 +162,7 @@ void MSP430AsmPrinter::printMachineInstruction(const MachineInstr *MI) { if (printInstruction(MI)) return; - assert(0 && "Should not happen"); + LLVM_UNREACHABLE("Should not happen"); } void MSP430AsmPrinter::printOperand(const MachineInstr *MI, int OpNum, @@ -206,7 +207,7 @@ void MSP430AsmPrinter::printOperand(const MachineInstr *MI, int OpNum, return; } default: - assert(0 && "Not implemented yet!"); + LLVM_UNREACHABLE("Not implemented yet!"); } } @@ -230,7 +231,7 @@ void MSP430AsmPrinter::printSrcMemOperand(const MachineInstr *MI, int OpNum, printOperand(MI, OpNum); } } else - assert(0 && "Unsupported memory operand"); + LLVM_UNREACHABLE("Unsupported memory operand"); } void MSP430AsmPrinter::printCCOperand(const MachineInstr *MI, int OpNum) { @@ -238,7 +239,7 @@ void MSP430AsmPrinter::printCCOperand(const MachineInstr *MI, int OpNum) { switch (CC) { default: - assert(0 && "Unsupported CC code"); + LLVM_UNREACHABLE("Unsupported CC code"); break; case MSP430::COND_E: O << "eq"; diff --git a/lib/Target/MSP430/MSP430ISelLowering.cpp b/lib/Target/MSP430/MSP430ISelLowering.cpp index 1522e5006d..69d9caea94 100644 --- a/lib/Target/MSP430/MSP430ISelLowering.cpp +++ b/lib/Target/MSP430/MSP430ISelLowering.cpp @@ -123,7 +123,7 @@ SDValue MSP430TargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) { case ISD::SELECT_CC: return LowerSELECT_CC(Op, DAG); case ISD::SIGN_EXTEND: return LowerSIGN_EXTEND(Op, DAG); default: - assert(0 && "unimplemented operand"); + LLVM_UNREACHABLE("unimplemented operand"); return SDValue(); } } @@ -144,7 +144,7 @@ SDValue MSP430TargetLowering::LowerFORMAL_ARGUMENTS(SDValue Op, unsigned CC = cast<ConstantSDNode>(Op.getOperand(1))->getZExtValue(); switch (CC) { default: - assert(0 && "Unsupported calling convention"); + LLVM_UNREACHABLE("Unsupported calling convention"); case CallingConv::C: case CallingConv::Fast: return LowerCCCArguments(Op, DAG); @@ -156,7 +156,7 @@ SDValue MSP430TargetLowering::LowerCALL(SDValue Op, SelectionDAG &DAG) { unsigned CallingConv = TheCall->getCallingConv(); switch (CallingConv) { default: - assert(0 && "Unsupported calling convention"); + LLVM_UNREACHABLE("Unsupported calling convention"); case CallingConv::Fast: case CallingConv::C: return LowerCCCCallTo(Op, DAG, CallingConv); @@ -331,7 +331,7 @@ SDValue MSP430TargetLowering::LowerCCCCallTo(SDValue Op, SelectionDAG &DAG, // Promote the value if needed. switch (VA.getLocInfo()) { - default: assert(0 && "Unknown loc info!"); + default: LLVM_UNREACHABLE("Unknown loc info!"); case CCValAssign::Full: break; case CCValAssign::SExt: Arg = DAG.getNode(ISD::SIGN_EXTEND, dl, VA.getLocVT(), Arg); @@ -516,7 +516,7 @@ static SDValue EmitCMP(SDValue &LHS, SDValue &RHS, unsigned &TargetCC, // FIXME: Handle jump negative someday TargetCC = MSP430::COND_INVALID; switch (CC) { - default: assert(0 && "Invalid integer condition!"); + default: LLVM_UNREACHABLE("Invalid integer condition!"); case ISD::SETEQ: TargetCC = MSP430::COND_E; // aka COND_Z break; diff --git a/lib/Target/MSP430/MSP430InstrInfo.cpp b/lib/Target/MSP430/MSP430InstrInfo.cpp index 91112c3d73..8dc71df7b1 100644 --- a/lib/Target/MSP430/MSP430InstrInfo.cpp +++ b/lib/Target/MSP430/MSP430InstrInfo.cpp @@ -21,6 +21,7 @@ #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/PseudoSourceValue.h" +#include "llvm/Support/ErrorHandling.h" using namespace llvm; @@ -44,7 +45,7 @@ void MSP430InstrInfo::storeRegToStackSlot(MachineBasicBlock &MBB, .addFrameIndex(FrameIdx).addImm(0) .addReg(SrcReg, getKillRegState(isKill)); else - assert(0 && "Cannot store this register to stack slot!"); + LLVM_UNREACHABLE("Cannot store this register to stack slot!"); } void MSP430InstrInfo::loadRegFromStackSlot(MachineBasicBlock &MBB, @@ -61,7 +62,7 @@ void MSP430InstrInfo::loadRegFromStackSlot(MachineBasicBlock &MBB, BuildMI(MBB, MI, DL, get(MSP430::MOV8rm)) .addReg(DestReg).addFrameIndex(FrameIdx).addImm(0); else - assert(0 && "Cannot store this register to stack slot!"); + LLVM_UNREACHABLE("Cannot store this register to stack slot!"); } bool MSP430InstrInfo::copyRegToReg(MachineBasicBlock &MBB, @@ -171,7 +172,7 @@ MSP430InstrInfo::InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, // Conditional branch. unsigned Count = 0; - assert(0 && "Implement conditional branches!"); + LLVM_UNREACHABLE("Implement conditional branches!"); return Count; } diff --git a/lib/Target/MSP430/MSP430RegisterInfo.cpp b/lib/Target/MSP430/MSP430RegisterInfo.cpp index d40bac73ea..2c96f85aaf 100644 --- a/lib/Target/MSP430/MSP430RegisterInfo.cpp +++ b/lib/Target/MSP430/MSP430RegisterInfo.cpp @@ -23,6 +23,7 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetOptions.h" #include "llvm/ADT/BitVector.h" +#include "llvm/Support/ErrorHandling.h" using namespace llvm; @@ -291,7 +292,7 @@ void MSP430RegisterInfo::emitEpilogue(MachineFunction &MF, switch (RetOpcode) { case MSP430::RET: break; // These are ok default: - assert(0 && "Can only insert epilog into returning blocks"); + LLVM_UNREACHABLE("Can only insert epilog into returning blocks"); } // Get the number of bytes to allocate from the FrameInfo @@ -327,7 +328,7 @@ void MSP430RegisterInfo::emitEpilogue(MachineFunction &MF, // mergeSPUpdatesUp(MBB, MBBI, StackPtr, &NumBytes); if (MFI->hasVarSizedObjects()) { - assert(0 && "Not implemented yet!"); + LLVM_UNREACHABLE("Not implemented yet!"); } else { // adjust stack pointer back: SPW += numbytes if (NumBytes) { @@ -349,7 +350,7 @@ unsigned MSP430RegisterInfo::getFrameRegister(MachineFunction &MF) const { } int MSP430RegisterInfo::getDwarfRegNum(unsigned RegNum, bool isEH) const { - assert(0 && "Not implemented yet!"); + LLVM_UNREACHABLE("Not implemented yet!"); return 0; } |