-fcatch-undefined-behavior: store the type name directly at the end of a type descriptor. 5% binary size reduction due to fewer relocations.

llvm-svn: 165572
This commit is contained in:
Richard Smith 2012-10-09 23:55:19 +00:00
parent b6fb381dba
commit 683398a3b6
1 changed files with 5 additions and 5 deletions

View File

@ -1941,11 +1941,11 @@ LValue CodeGenFunction::EmitPredefinedLValue(const PredefinedExpr *E) {
/// 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 @@ llvm::Constant *CodeGenFunction::EmitCheckTypeDescriptor(QualType T) {
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);