llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
This adds location info for all llvm_unreachable calls (which is a macro now) in
!NDEBUG builds.
In NDEBUG builds location info and the message is off (it only prints
"UREACHABLE executed").


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75640 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp
index 226cd4f..9f27338 100644
--- a/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -421,7 +421,7 @@
           const_cast<GlobalVariable *>(dyn_cast<GlobalVariable>(GV)))
     EmitGlobalVariable(GVar);
   else
-    LLVM_UNREACHABLE("Global hasn't had an address allocated yet!");
+    llvm_unreachable("Global hasn't had an address allocated yet!");
   return state.getGlobalAddressMap(locked)[GV];
 }
 
@@ -548,7 +548,7 @@
       GenericValue GV = getConstantValue(Op0);
       const Type* DestTy = CE->getType();
       switch (Op0->getType()->getTypeID()) {
-        default: LLVM_UNREACHABLE("Invalid bitcast operand");
+        default: llvm_unreachable("Invalid bitcast operand");
         case Type::IntegerTyID:
           assert(DestTy->isFloatingPoint() && "invalid bitcast");
           if (DestTy == Type::FloatTy)
@@ -587,10 +587,10 @@
       GenericValue RHS = getConstantValue(CE->getOperand(1));
       GenericValue GV;
       switch (CE->getOperand(0)->getType()->getTypeID()) {
-      default: LLVM_UNREACHABLE("Bad add type!");
+      default: llvm_unreachable("Bad add type!");
       case Type::IntegerTyID:
         switch (CE->getOpcode()) {
-          default: LLVM_UNREACHABLE("Invalid integer opcode");
+          default: llvm_unreachable("Invalid integer opcode");
           case Instruction::Add: GV.IntVal = LHS.IntVal + RHS.IntVal; break;
           case Instruction::Sub: GV.IntVal = LHS.IntVal - RHS.IntVal; break;
           case Instruction::Mul: GV.IntVal = LHS.IntVal * RHS.IntVal; break;
@@ -605,7 +605,7 @@
         break;
       case Type::FloatTyID:
         switch (CE->getOpcode()) {
-          default: LLVM_UNREACHABLE("Invalid float opcode");
+          default: llvm_unreachable("Invalid float opcode");
           case Instruction::FAdd:
             GV.FloatVal = LHS.FloatVal + RHS.FloatVal; break;
           case Instruction::FSub:
@@ -620,7 +620,7 @@
         break;
       case Type::DoubleTyID:
         switch (CE->getOpcode()) {
-          default: LLVM_UNREACHABLE("Invalid double opcode");
+          default: llvm_unreachable("Invalid double opcode");
           case Instruction::FAdd:
             GV.DoubleVal = LHS.DoubleVal + RHS.DoubleVal; break;
           case Instruction::FSub:
@@ -638,7 +638,7 @@
       case Type::FP128TyID: {
         APFloat apfLHS = APFloat(LHS.IntVal);
         switch (CE->getOpcode()) {
-          default: LLVM_UNREACHABLE("Invalid long double opcode");llvm_unreachable();
+          default: llvm_unreachable("Invalid long double opcode");llvm_unreachable(0);
           case Instruction::FAdd:
             apfLHS.add(APFloat(RHS.IntVal), APFloat::rmNearestTiesToEven);
             GV.IntVal = apfLHS.bitcastToAPInt();
@@ -698,7 +698,7 @@
     else if (const GlobalVariable* GV = dyn_cast<GlobalVariable>(C))
       Result = PTOGV(getOrEmitGlobalVariable(const_cast<GlobalVariable*>(GV)));
     else
-      LLVM_UNREACHABLE("Unknown constant pointer type!");
+      llvm_unreachable("Unknown constant pointer type!");
     break;
   default:
     std::string msg;
@@ -881,7 +881,7 @@
   }
 
   cerr << "Bad Type: " << *Init->getType() << "\n";
-  LLVM_UNREACHABLE("Unknown constant type to initialize memory with!");
+  llvm_unreachable("Unknown constant type to initialize memory with!");
 }
 
 /// EmitGlobals - Emit all of the global variables to memory, storing their
diff --git a/lib/ExecutionEngine/ExecutionEngineBindings.cpp b/lib/ExecutionEngine/ExecutionEngineBindings.cpp
index 43389e0..4ee2622 100644
--- a/lib/ExecutionEngine/ExecutionEngineBindings.cpp
+++ b/lib/ExecutionEngine/ExecutionEngineBindings.cpp
@@ -46,7 +46,7 @@
     GenVal->DoubleVal = N;
     break;
   default:
-    LLVM_UNREACHABLE("LLVMGenericValueToFloat supports only float and double.");
+    llvm_unreachable("LLVMGenericValueToFloat supports only float and double.");
   }
   return wrap(GenVal);
 }
@@ -75,7 +75,7 @@
   case Type::DoubleTyID:
     return unwrap(GenVal)->DoubleVal;
   default:
-    LLVM_UNREACHABLE("LLVMGenericValueToFloat supports only float and double.");
+    llvm_unreachable("LLVMGenericValueToFloat supports only float and double.");
     break;
   }
   return 0; // Not reached
diff --git a/lib/ExecutionEngine/Interpreter/Execution.cpp b/lib/ExecutionEngine/Interpreter/Execution.cpp
index 4a6cafe..b351ba2 100644
--- a/lib/ExecutionEngine/Interpreter/Execution.cpp
+++ b/lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -58,7 +58,7 @@
     IMPLEMENT_BINARY_OPERATOR(+, Double);
   default:
     cerr << "Unhandled type for FAdd instruction: " << *Ty << "\n";
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
 }
 
@@ -69,7 +69,7 @@
     IMPLEMENT_BINARY_OPERATOR(-, Double);
   default:
     cerr << "Unhandled type for FSub instruction: " << *Ty << "\n";
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
 }
 
@@ -80,7 +80,7 @@
     IMPLEMENT_BINARY_OPERATOR(*, Double);
   default:
     cerr << "Unhandled type for FMul instruction: " << *Ty << "\n";
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
 }
 
@@ -91,7 +91,7 @@
     IMPLEMENT_BINARY_OPERATOR(/, Double);
   default:
     cerr << "Unhandled type for FDiv instruction: " << *Ty << "\n";
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
 }
 
@@ -106,7 +106,7 @@
     break;
   default:
     cerr << "Unhandled type for Rem instruction: " << *Ty << "\n";
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
 }
 
@@ -133,7 +133,7 @@
     IMPLEMENT_POINTER_ICMP(==);
   default:
     cerr << "Unhandled type for ICMP_EQ predicate: " << *Ty << "\n";
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
   return Dest;
 }
@@ -146,7 +146,7 @@
     IMPLEMENT_POINTER_ICMP(!=);
   default:
     cerr << "Unhandled type for ICMP_NE predicate: " << *Ty << "\n";
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
   return Dest;
 }
@@ -159,7 +159,7 @@
     IMPLEMENT_POINTER_ICMP(<);
   default:
     cerr << "Unhandled type for ICMP_ULT predicate: " << *Ty << "\n";
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
   return Dest;
 }
@@ -172,7 +172,7 @@
     IMPLEMENT_POINTER_ICMP(<);
   default:
     cerr << "Unhandled type for ICMP_SLT predicate: " << *Ty << "\n";
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
   return Dest;
 }
@@ -185,7 +185,7 @@
     IMPLEMENT_POINTER_ICMP(>);
   default:
     cerr << "Unhandled type for ICMP_UGT predicate: " << *Ty << "\n";
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
   return Dest;
 }
@@ -198,7 +198,7 @@
     IMPLEMENT_POINTER_ICMP(>);
   default:
     cerr << "Unhandled type for ICMP_SGT predicate: " << *Ty << "\n";
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
   return Dest;
 }
@@ -211,7 +211,7 @@
     IMPLEMENT_POINTER_ICMP(<=);
   default:
     cerr << "Unhandled type for ICMP_ULE predicate: " << *Ty << "\n";
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
   return Dest;
 }
@@ -224,7 +224,7 @@
     IMPLEMENT_POINTER_ICMP(<=);
   default:
     cerr << "Unhandled type for ICMP_SLE predicate: " << *Ty << "\n";
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
   return Dest;
 }
@@ -237,7 +237,7 @@
     IMPLEMENT_POINTER_ICMP(>=);
   default:
     cerr << "Unhandled type for ICMP_UGE predicate: " << *Ty << "\n";
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
   return Dest;
 }
@@ -250,7 +250,7 @@
     IMPLEMENT_POINTER_ICMP(>=);
   default:
     cerr << "Unhandled type for ICMP_SGE predicate: " << *Ty << "\n";
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
   return Dest;
 }
@@ -275,7 +275,7 @@
   case ICmpInst::ICMP_SGE: R = executeICMP_SGE(Src1, Src2, Ty); break;
   default:
     cerr << "Don't know how to handle this ICmp predicate!\n-->" << I;
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
  
   SetValue(&I, R, SF);
@@ -294,7 +294,7 @@
     IMPLEMENT_FCMP(==, Double);
   default:
     cerr << "Unhandled type for FCmp EQ instruction: " << *Ty << "\n";
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
   return Dest;
 }
@@ -308,7 +308,7 @@
 
   default:
     cerr << "Unhandled type for FCmp NE instruction: " << *Ty << "\n";
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
   return Dest;
 }
@@ -321,7 +321,7 @@
     IMPLEMENT_FCMP(<=, Double);
   default:
     cerr << "Unhandled type for FCmp LE instruction: " << *Ty << "\n";
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
   return Dest;
 }
@@ -334,7 +334,7 @@
     IMPLEMENT_FCMP(>=, Double);
   default:
     cerr << "Unhandled type for FCmp GE instruction: " << *Ty << "\n";
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
   return Dest;
 }
@@ -347,7 +347,7 @@
     IMPLEMENT_FCMP(<, Double);
   default:
     cerr << "Unhandled type for FCmp LT instruction: " << *Ty << "\n";
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
   return Dest;
 }
@@ -360,7 +360,7 @@
     IMPLEMENT_FCMP(>, Double);
   default:
     cerr << "Unhandled type for FCmp GT instruction: " << *Ty << "\n";
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
   return Dest;
 }
@@ -469,7 +469,7 @@
   case FCmpInst::FCMP_OGE:   R = executeFCMP_OGE(Src1, Src2, Ty); break;
   default:
     cerr << "Don't know how to handle this FCmp predicate!\n-->" << I;
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
  
   SetValue(&I, R, SF);
@@ -515,7 +515,7 @@
   }
   default:
     cerr << "Unhandled Cmp predicate\n";
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
 }
 
@@ -544,7 +544,7 @@
   case Instruction::Xor:   R.IntVal = Src1.IntVal ^ Src2.IntVal; break;
   default:
     cerr << "Don't know how to handle this binary operator!\n-->" << I;
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
 
   SetValue(&I, R, SF);
@@ -1079,7 +1079,7 @@
     } else if (SrcTy->isInteger()) {
       Dest.IntVal = Src.IntVal;
     } else 
-      LLVM_UNREACHABLE("Invalid BitCast");
+      llvm_unreachable("Invalid BitCast");
   } else if (DstTy == Type::FloatTy) {
     if (SrcTy->isInteger())
       Dest.FloatVal = Src.IntVal.bitsToFloat();
@@ -1091,7 +1091,7 @@
     else
       Dest.DoubleVal = Src.DoubleVal;
   } else
-    LLVM_UNREACHABLE("Invalid Bitcast");
+    llvm_unreachable("Invalid Bitcast");
 
   return Dest;
 }
@@ -1176,7 +1176,7 @@
     IMPLEMENT_VAARG(Double);
   default:
     cerr << "Unhandled dest type for vaarg instruction: " << *Ty << "\n";
-    llvm_unreachable();
+    llvm_unreachable(0);
   }
 
   // Set the Value of this Instruction.
@@ -1263,7 +1263,7 @@
     break;
   default:
     cerr << "Unhandled ConstantExpr: " << *CE << "\n";
-    llvm_unreachable();
+    llvm_unreachable(0);
     return GenericValue();
   }
   return Dest;
@@ -1345,7 +1345,7 @@
       DOUT << "  --> ";
       const GenericValue &Val = SF.Values[&I];
       switch (I.getType()->getTypeID()) {
-      default: LLVM_UNREACHABLE("Invalid GenericValue Type");
+      default: llvm_unreachable("Invalid GenericValue Type");
       case Type::VoidTyID:    DOUT << "void"; break;
       case Type::FloatTyID:   DOUT << "float " << Val.FloatVal; break;
       case Type::DoubleTyID:  DOUT << "double " << Val.DoubleVal; break;
diff --git a/lib/ExecutionEngine/Interpreter/Interpreter.h b/lib/ExecutionEngine/Interpreter/Interpreter.h
index f9d4770..01771cf 100644
--- a/lib/ExecutionEngine/Interpreter/Interpreter.h
+++ b/lib/ExecutionEngine/Interpreter/Interpreter.h
@@ -147,7 +147,7 @@
   void visitStoreInst(StoreInst &I);
   void visitGetElementPtrInst(GetElementPtrInst &I);
   void visitPHINode(PHINode &PN) { 
-    LLVM_UNREACHABLE("PHI nodes already handled!"); 
+    llvm_unreachable("PHI nodes already handled!"); 
   }
   void visitTruncInst(TruncInst &I);
   void visitZExtInst(ZExtInst &I);
@@ -177,7 +177,7 @@
   void visitVAArgInst(VAArgInst &I);
   void visitInstruction(Instruction &I) {
     cerr << I;
-    LLVM_UNREACHABLE("Instruction not interpretable yet!");
+    llvm_unreachable("Instruction not interpretable yet!");
   }
 
   GenericValue callExternalFunction(Function *F,
diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp
index 3edea73..baa8a47 100644
--- a/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/lib/ExecutionEngine/JIT/JIT.cpp
@@ -410,7 +410,7 @@
   if (ArgValues.empty()) {
     GenericValue rv;
     switch (RetTy->getTypeID()) {
-    default: LLVM_UNREACHABLE("Unknown return type for function call!");
+    default: llvm_unreachable("Unknown return type for function call!");
     case Type::IntegerTyID: {
       unsigned BitWidth = cast<IntegerType>(RetTy)->getBitWidth();
       if (BitWidth == 1)
@@ -424,7 +424,7 @@
       else if (BitWidth <= 64)
         rv.IntVal = APInt(BitWidth, ((int64_t(*)())(intptr_t)FPtr)());
       else 
-        LLVM_UNREACHABLE("Integer types > 64 bits not supported");
+        llvm_unreachable("Integer types > 64 bits not supported");
       return rv;
     }
     case Type::VoidTyID:
@@ -439,7 +439,7 @@
     case Type::X86_FP80TyID:
     case Type::FP128TyID:
     case Type::PPC_FP128TyID:
-      LLVM_UNREACHABLE("long double not supported yet");
+      llvm_unreachable("long double not supported yet");
       return rv;
     case Type::PointerTyID:
       return PTOGV(((void*(*)())(intptr_t)FPtr)());
@@ -467,7 +467,7 @@
     const Type *ArgTy = FTy->getParamType(i);
     const GenericValue &AV = ArgValues[i];
     switch (ArgTy->getTypeID()) {
-    default: LLVM_UNREACHABLE("Unknown argument type for function call!");
+    default: llvm_unreachable("Unknown argument type for function call!");
     case Type::IntegerTyID:
         C = ConstantInt::get(AV.IntVal);
         break;
diff --git a/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp b/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp
index 86218f7..c661168 100644
--- a/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp
+++ b/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp
@@ -111,7 +111,7 @@
         
         JCE->emitULEB128Bytes(Offset);
       } else {
-        LLVM_UNREACHABLE("Machine move no supported yet.");
+        llvm_unreachable("Machine move no supported yet.");
       }
     } else if (Src.isReg() &&
       Src.getReg() == MachineLocation::VirtualFP) {
@@ -119,7 +119,7 @@
         JCE->emitByte(dwarf::DW_CFA_def_cfa_register);
         JCE->emitULEB128Bytes(RI->getDwarfRegNum(Dst.getReg(), true));
       } else {
-        LLVM_UNREACHABLE("Machine move no supported yet.");
+        llvm_unreachable("Machine move no supported yet.");
       }
     } else {
       unsigned Reg = RI->getDwarfRegNum(Src.getReg(), true);
@@ -762,7 +762,7 @@
         
         FinalSize += TargetAsmInfo::getULEB128Size(Offset);
       } else {
-        LLVM_UNREACHABLE("Machine move no supported yet.");
+        llvm_unreachable("Machine move no supported yet.");
       }
     } else if (Src.isReg() &&
       Src.getReg() == MachineLocation::VirtualFP) {
@@ -771,7 +771,7 @@
         unsigned RegNum = RI->getDwarfRegNum(Dst.getReg(), true);
         FinalSize += TargetAsmInfo::getULEB128Size(RegNum);
       } else {
-        LLVM_UNREACHABLE("Machine move no supported yet.");
+        llvm_unreachable("Machine move no supported yet.");
       }
     } else {
       unsigned Reg = RI->getDwarfRegNum(Src.getReg(), true);