[llvm-commits] [llvm-gcc-4.2] r53128 - in /llvm-gcc-4.2/trunk/gcc: llvm-debug.cpp llvm-debug.h
Bill Wendling
isanbard at gmail.com
Thu Jul 3 16:36:34 PDT 2008
Author: void
Date: Thu Jul 3 18:36:34 2008
New Revision: 53128
URL: http://llvm.org/viewvc/llvm-project?rev=53128&view=rev
Log:
Use DenseMap for a small speedup.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp
llvm-gcc-4.2/trunk/gcc/llvm-debug.h
Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp?rev=53128&r1=53127&r2=53128&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Thu Jul 3 18:36:34 2008
@@ -452,7 +452,7 @@
if (TREE_CODE(type) == VOID_TYPE) return NULL;
// Check to see if the compile unit already has created this type.
- TypeDesc *&Slot = TypeCache[type];
+ TypeDesc *Slot = TypeCache[type];
if (Slot) return Slot;
// Ty will have contain the resulting type.
@@ -473,7 +473,7 @@
// typedefs are derived from some other type.
DerivedTypeDesc *DerivedTy = new DerivedTypeDesc(DW_TAG_typedef);
// Set the slot early to prevent recursion difficulties.
- Slot = Ty = DerivedTy;
+ TypeCache[type] = Ty = DerivedTy;
// Handle derived type.
TypeDesc *FromTy = getOrCreateType(DECL_ORIGINAL_TYPE(Name), Unit);
DerivedTy->setFromType(FromTy);
@@ -503,7 +503,7 @@
Ty = DerivedTy;
// Set the slot early to prevent recursion difficulties.
// Any other use of the type should include the qualifiers.
- Slot = AddTypeQualifiers(type, Unit, DerivedTy);
+ TypeCache[type] = AddTypeQualifiers(type, Unit, DerivedTy);
// Handle the derived type.
TypeDesc *FromTy = getOrCreateType(TREE_TYPE(type), Unit);
DerivedTy->setFromType(FromTy);
@@ -525,7 +525,7 @@
Ty = SubrTy;
// Set the slot early to prevent recursion difficulties.
// Any other use of the type should include the qualifiers.
- Slot = AddTypeQualifiers(type, Unit, SubrTy);
+ TypeCache[type] = AddTypeQualifiers(type, Unit, SubrTy);
// Prepare to add the arguments for the subroutine.
std::vector<DebugInfoDesc *> &Elements = SubrTy->getElements();
@@ -560,14 +560,14 @@
Ty = ArrayTy = new CompositeTypeDesc(DW_TAG_vector_type);
// Set the slot early to prevent recursion difficulties.
// Any other use of the type should include the qualifiers.
- Slot = AddTypeQualifiers(type, Unit, ArrayTy);
+ TypeCache[type] = AddTypeQualifiers(type, Unit, ArrayTy);
// Use the element type of the from this point.
type = TREE_TYPE(TYPE_FIELDS(TYPE_DEBUG_REPRESENTATION_TYPE(type)));
} else {
Ty = ArrayTy = new CompositeTypeDesc(DW_TAG_array_type);
// Set the slot early to prevent recursion difficulties.
// Any other use of the type should include the qualifiers.
- Slot = AddTypeQualifiers(type, Unit, ArrayTy);
+ TypeCache[type] = AddTypeQualifiers(type, Unit, ArrayTy);
}
// Prepare to add the dimensions of the array.
@@ -603,7 +603,7 @@
CompositeTypeDesc *Enum = new CompositeTypeDesc(DW_TAG_enumeration_type);
Ty = Enum;
// Any other use of the type should include the qualifiers.
- Slot = AddTypeQualifiers(type, Unit, Enum);
+ TypeCache[type] = AddTypeQualifiers(type, Unit, Enum);
// Prepare to add the enumeration values.
std::vector<DebugInfoDesc *> &Elements = Enum->getElements();
@@ -633,7 +633,7 @@
Ty = StructTy;
// Set the slot early to prevent recursion difficulties.
// Any other use of the type should include the qualifiers.
- Slot = AddTypeQualifiers(type, Unit, StructTy);
+ TypeCache[type] = AddTypeQualifiers(type, Unit, StructTy);
// Prepare to add the fields.
std::vector<DebugInfoDesc *> &Elements = StructTy->getElements();
@@ -762,7 +762,7 @@
BasicTypeDesc *BTy = new BasicTypeDesc();
Ty = BTy;
// Any other use of the type should include the qualifiers.
- Slot = AddTypeQualifiers(type, Unit, BTy);
+ TypeCache[type] = AddTypeQualifiers(type, Unit, BTy);
// The encoding specific to the type.
unsigned Encoding = 0;
@@ -818,9 +818,8 @@
Ty->setOffset(Offset);
}
- DEBUGASSERT(Slot && "Unimplemented type");
-
- return Slot;
+ DEBUGASSERT(TypeCache[type] && "Unimplemented type");
+ return TypeCache[type];
}
/// getOrCreateCompileUnit - Get the compile unit from the cache or create a new
Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.h?rev=53128&r1=53127&r2=53128&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-debug.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-debug.h Thu Jul 3 18:36:34 2008
@@ -60,7 +60,7 @@
std::map<std::string, CompileUnitDesc *> CompileUnitCache;
// Cache of previously constructed
// CompileUnits.
- std::map<tree_node *, TypeDesc *> TypeCache;
+ DenseMap<tree_node *, TypeDesc *> TypeCache;
// Cache of previously constructed
// Types.
Function *StopPointFn; // llvm.dbg.stoppoint
More information about the llvm-commits
mailing list