[llvm-commits] [dragonegg] r151981 - in /dragonegg/trunk: include/dragonegg/Internals.h src/Backend.cpp src/Constants.cpp src/Convert.cpp src/DefaultABI.cpp src/Types.cpp src/x86/Target.cpp
Duncan Sands
baldrick at free.fr
Sat Mar 3 09:18:52 PST 2012
Author: baldrick
Date: Sat Mar 3 11:18:52 2012
New Revision: 151981
URL: http://llvm.org/viewvc/llvm-project?rev=151981&view=rev
Log:
Get rid of DieAbjectly, which doesn't seem like such a good idea anymore.
Modified:
dragonegg/trunk/include/dragonegg/Internals.h
dragonegg/trunk/src/Backend.cpp
dragonegg/trunk/src/Constants.cpp
dragonegg/trunk/src/Convert.cpp
dragonegg/trunk/src/DefaultABI.cpp
dragonegg/trunk/src/Types.cpp
dragonegg/trunk/src/x86/Target.cpp
Modified: dragonegg/trunk/include/dragonegg/Internals.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/dragonegg/Internals.h?rev=151981&r1=151980&r2=151981&view=diff
==============================================================================
--- dragonegg/trunk/include/dragonegg/Internals.h (original)
+++ dragonegg/trunk/include/dragonegg/Internals.h Sat Mar 3 11:18:52 2012
@@ -106,23 +106,6 @@
extern Constant* ConvertMetadataStringToGV(const char *str);
-/// DieAbjectly - An unrecoverable fatal error occurred - throw in the towel,
-/// give up the ghost, quit miserably.
-inline void LLVM_ATTRIBUTE_NORETURN DieAbjectly(const char *Message) {
- (void)Message; // Avoid unused variable warning when assertions are disabled.
- llvm_unreachable(Message);
-}
-inline void LLVM_ATTRIBUTE_NORETURN DieAbjectly(const char *Message,
- union gimple_statement_d *stmt){
- if (stmt) debug_gimple_stmt(stmt);
- DieAbjectly(Message);
-}
-inline void LLVM_ATTRIBUTE_NORETURN DieAbjectly(const char *Message,
- union tree_node *exp) {
- if (exp) debug_tree(exp);
- DieAbjectly(Message);
-}
-
/// AddAnnotateAttrsToGlobal - Adds decls that have a
/// annotate attribute to a vector to be emitted later.
extern void AddAnnotateAttrsToGlobal(GlobalValue *GV, tree_node *decl);
Modified: dragonegg/trunk/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=151981&r1=151980&r2=151981&view=diff
==============================================================================
--- dragonegg/trunk/src/Backend.cpp (original)
+++ dragonegg/trunk/src/Backend.cpp Sat Mar 3 11:18:52 2012
@@ -635,7 +635,7 @@
if (TheTarget->addPassesToEmitFile(*PM, FormattedOutStream,
TargetMachine::CGFT_AssemblyFile,
DisableVerify))
- DieAbjectly("Error interfacing to target machine!");
+ llvm_unreachable("Error interfacing to target machine!");
}
PerFunctionPasses->doInitialization();
@@ -718,7 +718,7 @@
if (TheTarget->addPassesToEmitFile(*PM, FormattedOutStream,
TargetMachine::CGFT_AssemblyFile,
DisableVerify))
- DieAbjectly("Error interfacing to target machine!");
+ llvm_unreachable("Error interfacing to target machine!");
}
}
}
@@ -1065,8 +1065,10 @@
if (TREE_CODE(decl) == PARM_DECL || TREE_CODE(decl) == RESULT_DECL ||
TREE_CODE(decl) == TYPE_DECL || TREE_CODE(decl) == LABEL_DECL ||
(TREE_CODE(decl) == VAR_DECL && !TREE_STATIC(decl) &&
- !TREE_PUBLIC(decl) && !DECL_EXTERNAL(decl) && !DECL_REGISTER(decl)))
- DieAbjectly("Cannot make a global for this kind of declaration!", decl);
+ !TREE_PUBLIC(decl) && !DECL_EXTERNAL(decl) && !DECL_REGISTER(decl))) {
+ debug_tree(decl);
+ llvm_unreachable("Cannot make a global for this kind of declaration!");
+ }
#endif
if (errorcount || sorrycount)
Modified: dragonegg/trunk/src/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Constants.cpp?rev=151981&r1=151980&r2=151981&view=diff
==============================================================================
--- dragonegg/trunk/src/Constants.cpp (original)
+++ dragonegg/trunk/src/Constants.cpp Sat Mar 3 11:18:52 2012
@@ -284,7 +284,7 @@
switch (Ty->getTypeID()) {
default:
- DieAbjectly("Unsupported type!");
+ llvm_unreachable("Unsupported type!");
case Type::PointerTyID: {
// Cast to an integer with the same number of bits and return that.
IntegerType *IntTy = getTargetData().getIntPtrType(Context);
@@ -415,7 +415,7 @@
// The general case.
switch (Ty->getTypeID()) {
default:
- DieAbjectly("Unsupported type!");
+ llvm_unreachable("Unsupported type!");
case Type::IntegerTyID: {
unsigned BitWidth = Ty->getPrimitiveSizeInBits();
unsigned StoreSize = getTargetData().getTypeStoreSizeInBits(Ty);
@@ -509,7 +509,8 @@
switch (TREE_CODE(type)) {
default:
- DieAbjectly("Unknown register type!", type);
+ debug_tree(type);
+ llvm_unreachable("Unknown register type!");
case BOOLEAN_TYPE:
case ENUMERAL_TYPE:
@@ -600,7 +601,8 @@
switch (TREE_CODE(type)) {
default:
- DieAbjectly("Unknown register type!", type);
+ debug_tree(type);
+ llvm_unreachable("Unknown register type!");
case BOOLEAN_TYPE:
case ENUMERAL_TYPE:
@@ -1333,7 +1335,8 @@
switch (TREE_CODE(TREE_TYPE(exp))) {
default:
- DieAbjectly("Unknown constructor!", exp);
+ debug_tree(exp);
+ llvm_unreachable("Unknown constructor!");
case VECTOR_TYPE:
case ARRAY_TYPE: return ConvertArrayCONSTRUCTOR(exp, Folder);
case QUAL_UNION_TYPE:
@@ -1386,7 +1389,8 @@
Constant *Init;
switch (TREE_CODE(exp)) {
default:
- DieAbjectly("Unknown constant to convert!", exp);
+ debug_tree(exp);
+ llvm_unreachable("Unknown constant to convert!");
case COMPLEX_CST:
case INTEGER_CST:
case REAL_CST:
@@ -1435,12 +1439,16 @@
if (Ty->isSized()) {
uint64_t InitSize = getTargetData().getTypeAllocSizeInBits(Init->getType());
uint64_t TypeSize = getTargetData().getTypeAllocSizeInBits(Ty);
- if (InitSize < TypeSize)
- DieAbjectly("Constant too small for type!", exp);
+ if (InitSize < TypeSize) {
+ debug_tree(exp);
+ llvm_unreachable("Constant too small for type!");
+ }
}
if (getTargetData().getABITypeAlignment(Init->getType()) * 8 >
- TYPE_ALIGN(main_type(exp)))
- DieAbjectly("Constant over aligned!", exp);
+ TYPE_ALIGN(main_type(exp))) {
+ debug_tree(exp);
+ llvm_unreachable("Constant over aligned!");
+ }
#endif
// Cache the result of converting the initializer since the same tree is often
@@ -1605,7 +1613,8 @@
switch (TREE_CODE(exp)) {
default:
- DieAbjectly("Unknown constant to take the address of!", exp);
+ debug_tree(exp);
+ llvm_unreachable("Unknown constant to take the address of!");
case COMPLEX_CST:
case FIXED_CST:
case INTEGER_CST:
Modified: dragonegg/trunk/src/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=151981&r1=151980&r2=151981&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Sat Mar 3 11:18:52 2012
@@ -187,7 +187,8 @@
return Res;
}
- DieAbjectly("Don't know how to turn this into a register!", type);
+ debug_tree(type);
+ llvm_unreachable("Don't know how to turn this into a register!");
}
/// Reg2Mem - Convert a value of in-register type (that given by getRegType)
@@ -240,7 +241,8 @@
return Res;
}
- DieAbjectly("Don't know how to turn this into memory!", type);
+ debug_tree(type);
+ llvm_unreachable("Don't know how to turn this into memory!");
}
/// LoadRegisterFromMemory - Loads a value of the given scalar GCC type from
@@ -366,7 +368,8 @@
switch (TREE_CODE(decl)) {
default:
- DieAbjectly("Unhandled local declaration!", decl);
+ debug_tree(decl);
+ llvm_unreachable("Unhandled local declaration!");
case RESULT_DECL:
case VAR_DECL:
@@ -1104,7 +1107,8 @@
NameDef->replaceAllUsesWith(UndefValue::get(NameDef->getType()));
delete NameDef;
} else {
- DieAbjectly("SSA name never defined!", I->first);
+ debug_tree(I->first);
+ llvm_unreachable("SSA name never defined!");
}
}
@@ -1221,7 +1225,8 @@
switch (gimple_code(stmt)) {
default:
- DieAbjectly("Unhandled GIMPLE statement during LLVM emission!", stmt);
+ debug_gimple_stmt(stmt);
+ llvm_unreachable("Unhandled GIMPLE statement during LLVM emission!");
case GIMPLE_ASM:
RenderGIMPLE_ASM(stmt);
@@ -1336,7 +1341,8 @@
switch (TREE_CODE(exp)) {
default:
- DieAbjectly("Unhandled lvalue expression!", exp);
+ debug_tree(exp);
+ llvm_unreachable("Unhandled lvalue expression!");
case PARM_DECL:
case VAR_DECL:
@@ -1942,8 +1948,8 @@
if (DECL_SIZE(decl) == 0) { // Variable with incomplete type.
if (DECL_INITIAL(decl) == 0)
return; // Error message was already done; now avoid a crash.
- else
- DieAbjectly("Initializer will decide the size of this array?", decl);
+ debug_tree(decl);
+ llvm_unreachable("Initializer will decide the size of this array?");
} else if (TREE_CODE(DECL_SIZE_UNIT(decl)) == INTEGER_CST) {
// Variable of fixed size that goes on the stack.
Ty = ConvertType(type);
@@ -2526,9 +2532,10 @@
case ARRAY_TYPE:
case RECORD_TYPE:
default:
- if (elt && VEC_length(constructor_elt, elt))
- DieAbjectly("We don't handle elements yet!", exp);
- return 0;
+ if (!elt || !VEC_length(constructor_elt, elt))
+ return 0;
+ debug_tree(exp);
+ llvm_unreachable("We don't handle elements yet!");
case QUAL_UNION_TYPE:
case UNION_TYPE:
// Store each element of the constructor into the corresponding field of
@@ -4373,7 +4380,7 @@
switch(DECL_FUNCTION_CODE(fndecl)) {
case BUILT_IN_LOCK_RELEASE_16: // not handled; should use SSE on x86
default:
- DieAbjectly("Not handled; should use SSE on x86!");
+ llvm_unreachable("Not handled; should use SSE on x86!");
case BUILT_IN_LOCK_RELEASE_1:
Ty = Type::getInt8Ty(Context); break;
case BUILT_IN_LOCK_RELEASE_2:
@@ -5593,7 +5600,8 @@
LValue LV(ConstantPointerNull::get(PTy), 1);
return LV;
}
- DieAbjectly("Referencing decl that hasn't been laid out!", exp);
+ debug_tree(exp);
+ llvm_unreachable("Referencing decl that hasn't been laid out!");
}
Type *Ty = ConvertType(TREE_TYPE(exp));
@@ -5820,14 +5828,17 @@
/// an LLVM constant. Creates no code, only constants.
Constant *TreeToLLVM::EmitRegisterConstant(tree reg) {
#ifndef NDEBUG
- if (!is_gimple_constant(reg))
- DieAbjectly("Unsupported gimple!", reg);
+ if (!is_gimple_constant(reg)) {
+ debug_tree(reg);
+ llvm_unreachable("Unsupported gimple!");
+ }
#endif
assert(is_gimple_reg_type(TREE_TYPE(reg)) && "Not of register type!");
switch (TREE_CODE(reg)) {
default:
- DieAbjectly("Unhandled GIMPLE constant!", reg);
+ debug_tree(reg);
+ llvm_unreachable("Unhandled GIMPLE constant!");
case INTEGER_CST:
return EmitIntegerRegisterConstant(reg);
@@ -7668,7 +7679,7 @@
switch (region->type) {
default:
- DieAbjectly("Unexpected region type!");
+ llvm_unreachable("Unexpected region type!");
case ERT_ALLOWED_EXCEPTIONS: {
// Filter.
BasicBlock *Dest = getLabelDeclBlock(region->u.allowed.label);
@@ -7925,7 +7936,8 @@
Value *RHS = 0;
switch (code) {
default:
- DieAbjectly("Unsupported GIMPLE assignment!", stmt);
+ debug_gimple_stmt(stmt);
+ llvm_unreachable("Unsupported GIMPLE assignment!");
// Unary expressions.
case ABS_EXPR:
Modified: dragonegg/trunk/src/DefaultABI.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/DefaultABI.cpp?rev=151981&r1=151980&r2=151981&view=diff
==============================================================================
--- dragonegg/trunk/src/DefaultABI.cpp (original)
+++ dragonegg/trunk/src/DefaultABI.cpp Sat Mar 3 11:18:52 2012
@@ -165,7 +165,7 @@
LLVM_SCALAR_TYPE_FOR_STRUCT_RETURN(type, &Offset))
C.HandleAggregateResultAsScalar(ScalarTy, Offset);
else
- DieAbjectly("Unable to determine how to return this aggregate!");
+ llvm_unreachable("Unable to determine how to return this aggregate!");
}
} else {
// If the function is returning a struct or union, we pass the pointer to
@@ -294,7 +294,7 @@
C.ExitField();
}
} else {
- DieAbjectly("Unknown aggregate type!");
+ llvm_unreachable("Unknown aggregate type!");
}
}
Modified: dragonegg/trunk/src/Types.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Types.cpp?rev=151981&r1=151980&r2=151981&view=diff
==============================================================================
--- dragonegg/trunk/src/Types.cpp (original)
+++ dragonegg/trunk/src/Types.cpp Sat Mar 3 11:18:52 2012
@@ -371,7 +371,7 @@
debug_tree(type);
errs() << "LLVM: ";
Ty->print(errs());
- DieAbjectly("\nLLVM type doesn't represent GCC type!");
+ llvm_unreachable("\nLLVM type doesn't represent GCC type!");
}
#endif
@@ -426,7 +426,8 @@
switch (TREE_CODE(type)) {
default:
- DieAbjectly("Unknown register type!", type);
+ debug_tree(type);
+ llvm_unreachable("Unknown register type!");
case BOOLEAN_TYPE:
case ENUMERAL_TYPE:
@@ -464,7 +465,8 @@
// IEEE quad precision.
return Type::getFP128Ty(Context);
#endif
- DieAbjectly("Unknown FP type!", type);
+ debug_tree(type);
+ llvm_unreachable("Unknown FP type!");
case VECTOR_TYPE: {
// LLVM does not support vectors of pointers, so turn any pointers into
@@ -1299,13 +1301,16 @@
inSCC = true;
break;
}
- if (!inSCC)
- DieAbjectly("Type not in SCC!", type);
+ if (!inSCC) {
+ debug_tree(type);
+ llvm_unreachable("Type not in SCC!");
+ }
#endif
switch (TREE_CODE(type)) {
default:
- DieAbjectly("Unexpected type!", type);
+ debug_tree(type);
+ llvm_unreachable("Unexpected type!");
case ARRAY_TYPE:
return RememberTypeConversion(type, ConvertArrayTypeRecursive(type));
@@ -1338,7 +1343,8 @@
switch (TREE_CODE(type)) {
default:
- DieAbjectly("Unknown or recursive type!", type);
+ debug_tree(type);
+ llvm_unreachable("Unknown or recursive type!");
case ARRAY_TYPE:
case FUNCTION_TYPE:
@@ -1382,7 +1388,8 @@
// Caching the type conversion is not worth it.
switch (TYPE_PRECISION(type)) {
default:
- DieAbjectly("Unknown FP type!", type);
+ debug_tree(type);
+ llvm_unreachable("Unknown FP type!");
case 32: return CheckTypeConversion(type, Type::getFloatTy(Context));
case 64: return CheckTypeConversion(type, Type::getDoubleTy(Context));
case 80: return CheckTypeConversion(type, Type::getX86_FP80Ty(Context));
Modified: dragonegg/trunk/src/x86/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/x86/Target.cpp?rev=151981&r1=151980&r2=151981&view=diff
==============================================================================
--- dragonegg/trunk/src/x86/Target.cpp (original)
+++ dragonegg/trunk/src/x86/Target.cpp Sat Mar 3 11:18:52 2012
@@ -138,7 +138,8 @@
switch (Handler) {
case SearchForHandler:
- DieAbjectly("Unexpected builtin code!", stmt);
+ debug_gimple_stmt(stmt);
+ llvm_unreachable("Unexpected builtin code!");
case UnsupportedBuiltin: return false;
case addps:
case addps256:
More information about the llvm-commits
mailing list