[llvm-commits] [dragonegg] r149873 - in /dragonegg/trunk: include/dragonegg/ABI.h src/Backend.cpp src/Constants.cpp src/Convert.cpp src/arm/Target.cpp src/x86/Target.cpp
Duncan Sands
baldrick at free.fr
Mon Feb 6 09:37:59 PST 2012
Author: baldrick
Date: Mon Feb 6 11:33:42 2012
New Revision: 149873
URL: http://llvm.org/viewvc/llvm-project?rev=149873&view=rev
Log:
Turn various instances of "assert(0" into llvm_unreachable, since it seems
this is the LLVM style now.
Modified:
dragonegg/trunk/include/dragonegg/ABI.h
dragonegg/trunk/src/Backend.cpp
dragonegg/trunk/src/Constants.cpp
dragonegg/trunk/src/Convert.cpp
dragonegg/trunk/src/arm/Target.cpp
dragonegg/trunk/src/x86/Target.cpp
Modified: dragonegg/trunk/include/dragonegg/ABI.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/dragonegg/ABI.h?rev=149873&r1=149872&r2=149873&view=diff
==============================================================================
--- dragonegg/trunk/include/dragonegg/ABI.h (original)
+++ dragonegg/trunk/include/dragonegg/ABI.h Mon Feb 6 11:33:42 2012
@@ -302,7 +302,7 @@
void llvm_default_extract_multiple_return_value(Value * /*Src*/, Value * /*Dest*/,
bool /*isVolatile*/,
LLVMBuilder &/*Builder*/) {
- assert (0 && "LLVM_EXTRACT_MULTIPLE_RETURN_VALUE is not implemented!");
+ llvm_unreachable("LLVM_EXTRACT_MULTIPLE_RETURN_VALUE is not implemented!");
}
/// DefaultABI - This class implements the default LLVM ABI where structures are
Modified: dragonegg/trunk/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=149873&r1=149872&r2=149873&view=diff
==============================================================================
--- dragonegg/trunk/src/Backend.cpp (original)
+++ dragonegg/trunk/src/Backend.cpp Mon Feb 6 11:33:42 2012
@@ -1513,7 +1513,7 @@
IDENTIFIER_POINTER(target),
TheModule);
else
- assert(0 && "Unsuported global value");
+ llvm_unreachable("Unsuported global value");
} else {
Aliasee = cast<GlobalValue>(DEFINITION_LLVM(target));
}
Modified: dragonegg/trunk/src/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Constants.cpp?rev=149873&r1=149872&r2=149873&view=diff
==============================================================================
--- dragonegg/trunk/src/Constants.cpp (original)
+++ dragonegg/trunk/src/Constants.cpp Mon Feb 6 11:33:42 2012
@@ -783,7 +783,7 @@
ByteSwap_32(InStr[i])));
}
} else {
- assert(0 && "Unknown character type!");
+ llvm_unreachable("Unknown character type!");
}
unsigned LenInElts = Len /
Modified: dragonegg/trunk/src/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=149873&r1=149872&r2=149873&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Mon Feb 6 11:33:42 2012
@@ -3218,8 +3218,10 @@
while (!DoneModifiers) {
switch (*Constraint) {
default: DoneModifiers = true; break;
- case '=': assert(0 && "Should be after '='s");
- case '+': assert(0 && "'+' should already be expanded");
+ case '=':
+ llvm_unreachable("Should be after '='s");
+ case '+':
+ llvm_unreachable("'+' should already be expanded");
case '*':
case '?':
case '!':
Modified: dragonegg/trunk/src/arm/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/arm/Target.cpp?rev=149873&r1=149872&r2=149873&view=diff
==============================================================================
--- dragonegg/trunk/src/arm/Target.cpp (original)
+++ dragonegg/trunk/src/arm/Target.cpp Mon Feb 6 11:33:42 2012
@@ -186,7 +186,7 @@
break;
default:
- assert(0 && "What type is this?");
+ llvm_unreachable("What type is this?");
}
// Walk through fdt_counts. This is a homogeneous aggregate if
@@ -262,7 +262,7 @@
return true;
}
else
- assert(0 && "what type was this?");
+ llvm_unreachable("what type was this?");
return false;
}
Modified: dragonegg/trunk/src/x86/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/x86/Target.cpp?rev=149873&r1=149872&r2=149873&view=diff
==============================================================================
--- dragonegg/trunk/src/x86/Target.cpp (original)
+++ dragonegg/trunk/src/x86/Target.cpp Mon Feb 6 11:33:42 2012
@@ -1128,7 +1128,7 @@
Elts.push_back (Type::getFloatTy(Context));
Bytes -= 4;
} else
- assert(0 && "Not yet handled!");
+ llvm_unreachable("Not yet handled!");
} else if ((NumClasses-i) == 2) {
if (Class[i+1] == X86_64_SSEUP_CLASS) {
Type *Ty = ConvertType(TreeType);
@@ -1181,10 +1181,10 @@
Elts.push_back(Type::getVoidTy(Context));
Bytes -= 16;
} else
- assert(0 && "Not yet handled!");
+ llvm_unreachable("Not yet handled!");
++i; // Already handled the next one.
} else
- assert(0 && "Not yet handled!");
+ llvm_unreachable("Not yet handled!");
break;
case X86_64_SSESF_CLASS:
totallyEmpty = false;
@@ -1206,7 +1206,7 @@
Elts.push_back(Type::getVoidTy(Context));
Bytes -= 8;
break;
- default: assert(0 && "Unexpected register class!");
+ default: llvm_unreachable("Unexpected register class!");
}
}
@@ -1400,7 +1400,7 @@
else
return Type::getInt8Ty(Context);
}
- assert(0 && "Unexpected type!");
+ llvm_unreachable("Unexpected type!");
}
if (NumClasses == 2) {
if (Class[1] == X86_64_NO_CLASS) {
@@ -1412,7 +1412,7 @@
return Type::getDoubleTy(Context);
else if (Class[0] == X86_64_SSESF_CLASS)
return Type::getFloatTy(Context);
- assert(0 && "Unexpected type!");
+ llvm_unreachable("Unexpected type!");
}
if (Class[0] == X86_64_NO_CLASS) {
*Offset = 8;
@@ -1423,11 +1423,11 @@
return Type::getDoubleTy(Context);
else if (Class[1] == X86_64_SSESF_CLASS)
return Type::getFloatTy(Context);
- assert(0 && "Unexpected type!");
+ llvm_unreachable("Unexpected type!");
}
- assert(0 && "Unexpected type!");
+ llvm_unreachable("Unexpected type!");
}
- assert(0 && "Unexpected type!");
+ llvm_unreachable("Unexpected type!");
} else {
if (Size <= 8)
return Type::getInt64Ty(Context);
@@ -1452,15 +1452,13 @@
HOST_WIDE_INT Bytes =
(Mode == BLKmode) ? int_size_in_bytes(TreeType) : (int) GET_MODE_SIZE(Mode);
int NumClasses = classify_argument(Mode, TreeType, Class, 0);
- if (!NumClasses)
- assert(0 && "This type does not need multiple return registers!");
+ assert(NumClasses && "This type does not need multiple return registers!");
- if (NumClasses == 1 && Class[0] == X86_64_INTEGERSI_CLASS)
- // This will fit in one i32 register.
- assert(0 && "This type does not need multiple return registers!");
+ assert((NumClasses != 1 || Class[0] != X86_64_INTEGERSI_CLASS) &&
+ "This will fit in one i32 register!");
- if (NumClasses == 1 && Class[0] == X86_64_INTEGER_CLASS)
- assert(0 && "This type does not need multiple return registers!");
+ assert((NumClasses != 1 || Class[0] != X86_64_INTEGER_CLASS) &&
+ "This type does not need multiple return registers!");
// classify_argument uses a single X86_64_NO_CLASS as a special case for
// empty structs. Recognize it and don't add any return values in that
@@ -1492,7 +1490,7 @@
Elts.push_back(Type::getFloatTy(Context));
Bytes -= 4;
} else
- assert(0 && "Not yet handled!");
+ llvm_unreachable("Not yet handled!");
} else if ((NumClasses-i) == 2) {
if (Class[i+1] == X86_64_SSEUP_CLASS) {
Type *Ty = ConvertType(TreeType);
@@ -1541,11 +1539,11 @@
Elts.push_back(Type::getDoubleTy(Context));
Bytes -= 16;
} else {
- assert(0 && "Not yet handled!");
+ llvm_unreachable("Not yet handled!");
}
++i; // Already handled the next one.
} else
- assert(0 && "Not yet handled!");
+ llvm_unreachable("Not yet handled!");
break;
case X86_64_SSESF_CLASS:
Elts.push_back(Type::getFloatTy(Context));
@@ -1564,7 +1562,7 @@
// padding bytes.
Elts.push_back(Type::getInt64Ty(Context));
break;
- default: assert(0 && "Unexpected register class!");
+ default: llvm_unreachable("Unexpected register class!");
}
}
}
More information about the llvm-commits
mailing list