mirror of
https://github.com/RPCS3/llvm.git
synced 2025-03-03 08:07:51 +00:00
walk type symbol table also, so we get:
type opaque ; type %0 %C = type { %0, %0 } instead of: %C = type { opaque, opaque } when appropriate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65742 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
585cfb6821
commit
884858608b
@ -332,6 +332,13 @@ namespace {
|
|||||||
: TP(tp), NumberedTypes(numberedTypes) {}
|
: TP(tp), NumberedTypes(numberedTypes) {}
|
||||||
|
|
||||||
void Run(const Module &M) {
|
void Run(const Module &M) {
|
||||||
|
// Get types from the type symbol table. This gets opaque types referened
|
||||||
|
// only through derived named types.
|
||||||
|
const TypeSymbolTable &ST = M.getTypeSymbolTable();
|
||||||
|
for (TypeSymbolTable::const_iterator TI = ST.begin(), E = ST.end();
|
||||||
|
TI != E; ++TI)
|
||||||
|
IncorporateType(TI->second);
|
||||||
|
|
||||||
// Get types from global variables.
|
// Get types from global variables.
|
||||||
for (Module::const_global_iterator I = M.global_begin(),
|
for (Module::const_global_iterator I = M.global_begin(),
|
||||||
E = M.global_end(); I != E; ++I) {
|
E = M.global_end(); I != E; ++I) {
|
||||||
@ -368,11 +375,12 @@ namespace {
|
|||||||
private:
|
private:
|
||||||
void IncorporateType(const Type *Ty) {
|
void IncorporateType(const Type *Ty) {
|
||||||
// Check to see if we're already visited this type.
|
// Check to see if we're already visited this type.
|
||||||
if (!VisitedTypes.insert(Ty).second || TP.hasTypeName(Ty))
|
if (!VisitedTypes.insert(Ty).second)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// If this is a structure or opaque type, add a name for the type.
|
// If this is a structure or opaque type, add a name for the type.
|
||||||
if (isa<StructType>(Ty) || isa<OpaqueType>(Ty)) {
|
if ((isa<StructType>(Ty) || isa<OpaqueType>(Ty))
|
||||||
|
&& !TP.hasTypeName(Ty)) {
|
||||||
TP.addTypeName(Ty, "%"+utostr(unsigned(NumberedTypes.size())));
|
TP.addTypeName(Ty, "%"+utostr(unsigned(NumberedTypes.size())));
|
||||||
NumberedTypes.push_back(Ty);
|
NumberedTypes.push_back(Ty);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user