From e48fe3dde82632cb721477a4e936bcc4f3db3d48 Mon Sep 17 00:00:00 2001 From: Anton Korobeynikov Date: Fri, 27 Jun 2008 21:22:49 +0000 Subject: [PATCH] Use StringSet instead of std::set llvm-svn: 52836 --- lib/Target/X86/X86AsmPrinter.cpp | 28 +++++++++++++-------------- lib/Target/X86/X86AsmPrinter.h | 7 +++---- lib/Target/X86/X86IntelAsmPrinter.cpp | 16 +++++++-------- 3 files changed, 25 insertions(+), 26 deletions(-) diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp index 9f3f76956dd..409cb20d37c 100644 --- a/lib/Target/X86/X86AsmPrinter.cpp +++ b/lib/Target/X86/X86AsmPrinter.cpp @@ -368,32 +368,32 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) { SwitchToDataSection(".section .drectve"); } - for (std::set::iterator i = DLLExportedGVs.begin(), + for (StringSet<>::iterator i = DLLExportedGVs.begin(), e = DLLExportedGVs.end(); i != e; ++i) { - O << "\t.ascii \" -export:" << *i << ",data\"\n"; - } + O << "\t.ascii \" -export:" << i->getKeyData() << ",data\"\n"; + } if (!DLLExportedFns.empty()) { SwitchToDataSection(".section .drectve"); } - for (std::set::iterator i = DLLExportedFns.begin(), + for (StringSet<>::iterator i = DLLExportedFns.begin(), e = DLLExportedFns.end(); i != e; ++i) { - O << "\t.ascii \" -export:" << *i << "\"\n"; - } + O << "\t.ascii \" -export:" << i->getKeyData() << "\"\n"; + } if (Subtarget->isTargetDarwin()) { SwitchToDataSection(""); // Output stubs for dynamically-linked functions unsigned j = 1; - for (std::set::iterator i = FnStubs.begin(), e = FnStubs.end(); + for (StringSet<>::iterator i = FnStubs.begin(), e = FnStubs.end(); i != e; ++i, ++j) { SwitchToDataSection("\t.section __IMPORT,__jump_table,symbol_stubs," "self_modifying_code+pure_instructions,5", 0); - std::string p = *i; + std::string p = i->getKeyData(); printSuffixedName(p, "$stub"); O << ":\n"; O << "\t.indirect_symbol " << p << "\n"; @@ -416,9 +416,9 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) { if (!GVStubs.empty()) SwitchToDataSection( "\t.section __IMPORT,__pointers,non_lazy_symbol_pointers"); - for (std::set::iterator i = GVStubs.begin(), e = GVStubs.end(); + for (StringSet<>::iterator i = GVStubs.begin(), e = GVStubs.end(); i != e; ++i) { - std::string p = *i; + std::string p = i->getKeyData(); printSuffixedName(p, "$non_lazy_ptr"); O << ":\n"; O << "\t.indirect_symbol " << p << "\n"; @@ -436,16 +436,16 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) { O << "\t.subsections_via_symbols\n"; } else if (Subtarget->isTargetCygMing()) { // Emit type information for external functions - for (std::set::iterator i = FnStubs.begin(), e = FnStubs.end(); + for (StringSet<>::iterator i = FnStubs.begin(), e = FnStubs.end(); i != e; ++i) { - O << "\t.def\t " << *i + O << "\t.def\t " << i->getKeyData() << ";\t.scl\t" << COFF::C_EXT << ";\t.type\t" << (COFF::DT_FCN << COFF::N_BTSHFT) << ";\t.endef\n"; } - + // Emit final debug information. - DW.EndModule(); + DW.EndModule(); } else if (Subtarget->isTargetELF()) { // Emit final debug information. DW.EndModule(); diff --git a/lib/Target/X86/X86AsmPrinter.h b/lib/Target/X86/X86AsmPrinter.h index 6c47e0c27e8..95e24605505 100644 --- a/lib/Target/X86/X86AsmPrinter.h +++ b/lib/Target/X86/X86AsmPrinter.h @@ -19,12 +19,11 @@ #include "X86.h" #include "X86MachineFunctionInfo.h" #include "X86TargetMachine.h" +#include "llvm/ADT/StringSet.h" #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/DwarfWriter.h" #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/Support/Compiler.h" -#include - namespace llvm { @@ -70,10 +69,10 @@ struct VISIBILITY_HIDDEN X86SharedAsmPrinter : public AsmPrinter { const X86Subtarget *Subtarget; // Necessary for Darwin to print out the apprioriate types of linker stubs - std::set FnStubs, GVStubs, LinkOnceStubs; + StringSet<> FnStubs, GVStubs, LinkOnceStubs; // Necessary for dllexport support - std::set DLLExportedFns, DLLExportedGVs; + StringSet<> DLLExportedFns, DLLExportedGVs; inline static bool isScale(const MachineOperand &MO) { return MO.isImmediate() && diff --git a/lib/Target/X86/X86IntelAsmPrinter.cpp b/lib/Target/X86/X86IntelAsmPrinter.cpp index 09a40b8ee7f..842f9e4ba42 100644 --- a/lib/Target/X86/X86IntelAsmPrinter.cpp +++ b/lib/Target/X86/X86IntelAsmPrinter.cpp @@ -425,23 +425,23 @@ bool X86IntelAsmPrinter::doFinalization(Module &M) { O << "_drectve\t segment info alias('.drectve')\n"; } - for (std::set::iterator i = DLLExportedGVs.begin(), + for (StringSet<>::iterator i = DLLExportedGVs.begin(), e = DLLExportedGVs.end(); i != e; ++i) { - O << "\t db ' /EXPORT:" << *i << ",data'\n"; - } + O << "\t db ' /EXPORT:" << i->getKeyData() << ",data'\n"; + } - for (std::set::iterator i = DLLExportedFns.begin(), + for (StringSet<>::iterator i = DLLExportedFns.begin(), e = DLLExportedFns.end(); i != e; ++i) { - O << "\t db ' /EXPORT:" << *i << "'\n"; - } + O << "\t db ' /EXPORT:" << i->getKeyData() << "'\n"; + } if (!DLLExportedGVs.empty() || !DLLExportedFns.empty()) { - O << "_drectve\t ends\n"; + O << "_drectve\t ends\n"; } - + // Bypass X86SharedAsmPrinter::doFinalization(). bool Result = AsmPrinter::doFinalization(M); SwitchToDataSection("");