diff options
author | Chris Lattner <sabre@nondot.org> | 2009-02-28 21:18:43 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-02-28 21:18:43 +0000 |
commit | 583ffd878744e27b2ced28d67026c6ad83175ef2 (patch) | |
tree | 065f8755fa365ac5bf4debaca4315bef94ffe9a1 /lib | |
parent | 6d4306e63c2ca40a0482bf74a077540bb9cda25e (diff) | |
download | external_llvm-583ffd878744e27b2ced28d67026c6ad83175ef2.zip external_llvm-583ffd878744e27b2ced28d67026c6ad83175ef2.tar.gz external_llvm-583ffd878744e27b2ced28d67026c6ad83175ef2.tar.bz2 |
stop calling Type::getDescription().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65722 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VMCore/AsmWriter.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index 8e0efd0..7748878 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -173,6 +173,10 @@ TypePrinting::TypePrinting(const Module *M, raw_ostream &os) : OS(os) { continue; } + // Likewise don't insert primitives either. + if (Ty->isInteger() || Ty->isPrimitiveType()) + continue; + // Get the name as a string and insert it into TypeNames. std::string NameStr; raw_string_ostream NameOS(NameStr); @@ -186,11 +190,6 @@ TypePrinting::TypePrinting(const Module *M, raw_ostream &os) : OS(os) { void TypePrinting::CalcTypeName(const Type *Ty, SmallVectorImpl<const Type *> &TypeStack, raw_ostream &Result) { - if (Ty->isInteger() || (Ty->isPrimitiveType() && !isa<OpaqueType>(Ty))) { - Result << Ty->getDescription(); // Base case - return; - } - // Check to see if the type is named. std::map<const Type *, std::string>::iterator I = TypeNames.find(Ty); if (I != TypeNames.end() && @@ -215,6 +214,17 @@ void TypePrinting::CalcTypeName(const Type *Ty, TypeStack.push_back(Ty); // Recursive case: Add us to the stack.. switch (Ty->getTypeID()) { + case Type::VoidTyID: Result << "void"; break; + case Type::FloatTyID: Result << "float"; break; + case Type::DoubleTyID: Result << "double"; break; + case Type::X86_FP80TyID: Result << "x86_fp80"; break; + case Type::FP128TyID: Result << "fp128"; break; + case Type::PPC_FP128TyID: Result << "ppc_fp128"; break; + case Type::LabelTyID: Result << "label"; break; + case Type::IntegerTyID: + Result << 'i' << cast<IntegerType>(Ty)->getBitWidth(); + break; + case Type::FunctionTyID: { const FunctionType *FTy = cast<FunctionType>(Ty); CalcTypeName(FTy->getReturnType(), TypeStack, Result); @@ -286,13 +296,6 @@ void TypePrinting::CalcTypeName(const Type *Ty, /// potentially named portion. /// void TypePrinting::print(const Type *Ty) { - // Primitive types always print out their description, regardless of whether - // they have been named or not. - if (Ty->isInteger() || (Ty->isPrimitiveType() && !isa<OpaqueType>(Ty))) { - OS << Ty->getDescription(); - return; - } - // Check to see if the type is named. std::map<const Type*, std::string>::iterator I = TypeNames.find(Ty); if (I != TypeNames.end()) { |