[cfe-commits] r165572 - /cfe/trunk/lib/CodeGen/CGExpr.cpp
Richard Smith
richard-llvm at metafoo.co.uk
Tue Oct 9 16:55:19 PDT 2012
Author: rsmith
Date: Tue Oct 9 18:55:19 2012
New Revision: 165572
URL: http://llvm.org/viewvc/llvm-project?rev=165572&view=rev
Log:
-fcatch-undefined-behavior: store the type name directly at the end of a type descriptor. 5% binary size reduction due to fewer relocations.
Modified:
cfe/trunk/lib/CodeGen/CGExpr.cpp
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=165572&r1=165571&r2=165572&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Tue Oct 9 18:55:19 2012
@@ -1941,11 +1941,11 @@
/// format of a type descriptor is
///
/// \code
-/// { i8* Name, i16 TypeKind, i16 TypeInfo }
+/// { i16 TypeKind, i16 TypeInfo }
/// \endcode
///
-/// where TypeKind is 0 for an integer, 1 for a floating point value, and -1 for
-/// anything else.
+/// followed by an array of i8 containing the type name. TypeKind is 0 for an
+/// integer, 1 for a floating point value, and -1 for anything else.
llvm::Constant *CodeGenFunction::EmitCheckTypeDescriptor(QualType T) {
// FIXME: Only emit each type's descriptor once.
uint16_t TypeKind = -1;
@@ -1969,8 +1969,8 @@
ArrayRef<intptr_t>());
llvm::Constant *Components[] = {
- cast<llvm::Constant>(Builder.CreateGlobalStringPtr(Buffer)),
- Builder.getInt16(TypeKind), Builder.getInt16(TypeInfo)
+ Builder.getInt16(TypeKind), Builder.getInt16(TypeInfo),
+ llvm::ConstantDataArray::getString(getLLVMContext(), Buffer)
};
llvm::Constant *Descriptor = llvm::ConstantStruct::getAnon(Components);
More information about the cfe-commits
mailing list