[llvm-commits] [dragonegg] r93054 - /dragonegg/trunk/llvm-types.cpp
Duncan Sands
baldrick at free.fr
Sat Jan 9 08:59:38 PST 2010
Author: baldrick
Date: Sat Jan 9 10:59:37 2010
New Revision: 93054
URL: http://llvm.org/viewvc/llvm-project?rev=93054&view=rev
Log:
Port commit 93053 (baldrick) from llvm-gcc:
Dump details of the problematic type when the GCC and LLVM
type sizes fail to match.
Also: remove the remains of a failed experiment in checking
sizes of types of variable size.
Modified:
dragonegg/trunk/llvm-types.cpp
Modified: dragonegg/trunk/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-types.cpp?rev=93054&r1=93053&r2=93054&view=diff
==============================================================================
--- dragonegg/trunk/llvm-types.cpp (original)
+++ dragonegg/trunk/llvm-types.cpp Sat Jan 9 10:59:37 2010
@@ -74,26 +74,11 @@
// variable size, that the LLVM type is not bigger than any possible value of
// the GCC type.
#ifndef NDEBUG
- if (TYPE_SIZE(Tr) && Ty->isSized()) {
- if (isInt64(TYPE_SIZE(Tr), true)) {
- // Type with constant (and not humongous) size. Sizes must be equal.
- assert(getInt64(TYPE_SIZE(Tr), true) ==
- getTargetData().getTypeAllocSizeInBits(Ty) &&
- "LLVM type size doesn't match GCC type size!");
- } else {
- // Type with variable or humongous size. LLVM size must be smaller or
- // equal to the GCC size.
- // TODO: Implement an effective check here. Size expressions can be too
- // complicated for "fold" to simplify effectively; this mostly seems to be
- // due to Ada's size type and bitsize types being signed (meaning that the
- // folder can't always tell that values are non-negative).
-//TODO tree LLVMSize = build_int_cst(TREE_TYPE(TYPE_SIZE(Tr)),
-//TODO getTargetData().getTypeAllocSizeInBits(Ty));
-//TODO tree isSmaller = fold_build2(LE_EXPR, boolean_type_node, LLVMSize,
-//TODO TYPE_SIZE(Tr));
-//TODO assert(integer_onep(isSmaller) &&
-//TODO "LLVM type may be larger than GCC type!");
- }
+ if (TYPE_SIZE(Tr) && Ty->isSized() && isInt64(TYPE_SIZE(Tr), true) &&
+ getInt64(TYPE_SIZE(Tr), true) !=
+ getTargetData().getTypeAllocSizeInBits(Ty)) {
+ debug_tree(Tr);
+ llvm_unreachable("LLVM type size doesn't match GCC type size!");
}
#endif
More information about the llvm-commits
mailing list