1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00

Use StringSet instead of std::set<std::string>

llvm-svn: 52836
This commit is contained in:
Anton Korobeynikov 2008-06-27 21:22:49 +00:00
parent a943d9f402
commit e48fe3dde8
3 changed files with 25 additions and 26 deletions

View File

@ -368,32 +368,32 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
SwitchToDataSection(".section .drectve"); SwitchToDataSection(".section .drectve");
} }
for (std::set<std::string>::iterator i = DLLExportedGVs.begin(), for (StringSet<>::iterator i = DLLExportedGVs.begin(),
e = DLLExportedGVs.end(); e = DLLExportedGVs.end();
i != e; ++i) { i != e; ++i) {
O << "\t.ascii \" -export:" << *i << ",data\"\n"; O << "\t.ascii \" -export:" << i->getKeyData() << ",data\"\n";
} }
if (!DLLExportedFns.empty()) { if (!DLLExportedFns.empty()) {
SwitchToDataSection(".section .drectve"); SwitchToDataSection(".section .drectve");
} }
for (std::set<std::string>::iterator i = DLLExportedFns.begin(), for (StringSet<>::iterator i = DLLExportedFns.begin(),
e = DLLExportedFns.end(); e = DLLExportedFns.end();
i != e; ++i) { i != e; ++i) {
O << "\t.ascii \" -export:" << *i << "\"\n"; O << "\t.ascii \" -export:" << i->getKeyData() << "\"\n";
} }
if (Subtarget->isTargetDarwin()) { if (Subtarget->isTargetDarwin()) {
SwitchToDataSection(""); SwitchToDataSection("");
// Output stubs for dynamically-linked functions // Output stubs for dynamically-linked functions
unsigned j = 1; unsigned j = 1;
for (std::set<std::string>::iterator i = FnStubs.begin(), e = FnStubs.end(); for (StringSet<>::iterator i = FnStubs.begin(), e = FnStubs.end();
i != e; ++i, ++j) { i != e; ++i, ++j) {
SwitchToDataSection("\t.section __IMPORT,__jump_table,symbol_stubs," SwitchToDataSection("\t.section __IMPORT,__jump_table,symbol_stubs,"
"self_modifying_code+pure_instructions,5", 0); "self_modifying_code+pure_instructions,5", 0);
std::string p = *i; std::string p = i->getKeyData();
printSuffixedName(p, "$stub"); printSuffixedName(p, "$stub");
O << ":\n"; O << ":\n";
O << "\t.indirect_symbol " << p << "\n"; O << "\t.indirect_symbol " << p << "\n";
@ -416,9 +416,9 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
if (!GVStubs.empty()) if (!GVStubs.empty())
SwitchToDataSection( SwitchToDataSection(
"\t.section __IMPORT,__pointers,non_lazy_symbol_pointers"); "\t.section __IMPORT,__pointers,non_lazy_symbol_pointers");
for (std::set<std::string>::iterator i = GVStubs.begin(), e = GVStubs.end(); for (StringSet<>::iterator i = GVStubs.begin(), e = GVStubs.end();
i != e; ++i) { i != e; ++i) {
std::string p = *i; std::string p = i->getKeyData();
printSuffixedName(p, "$non_lazy_ptr"); printSuffixedName(p, "$non_lazy_ptr");
O << ":\n"; O << ":\n";
O << "\t.indirect_symbol " << p << "\n"; O << "\t.indirect_symbol " << p << "\n";
@ -436,16 +436,16 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
O << "\t.subsections_via_symbols\n"; O << "\t.subsections_via_symbols\n";
} else if (Subtarget->isTargetCygMing()) { } else if (Subtarget->isTargetCygMing()) {
// Emit type information for external functions // Emit type information for external functions
for (std::set<std::string>::iterator i = FnStubs.begin(), e = FnStubs.end(); for (StringSet<>::iterator i = FnStubs.begin(), e = FnStubs.end();
i != e; ++i) { i != e; ++i) {
O << "\t.def\t " << *i O << "\t.def\t " << i->getKeyData()
<< ";\t.scl\t" << COFF::C_EXT << ";\t.scl\t" << COFF::C_EXT
<< ";\t.type\t" << (COFF::DT_FCN << COFF::N_BTSHFT) << ";\t.type\t" << (COFF::DT_FCN << COFF::N_BTSHFT)
<< ";\t.endef\n"; << ";\t.endef\n";
} }
// Emit final debug information. // Emit final debug information.
DW.EndModule(); DW.EndModule();
} else if (Subtarget->isTargetELF()) { } else if (Subtarget->isTargetELF()) {
// Emit final debug information. // Emit final debug information.
DW.EndModule(); DW.EndModule();

View File

@ -19,12 +19,11 @@
#include "X86.h" #include "X86.h"
#include "X86MachineFunctionInfo.h" #include "X86MachineFunctionInfo.h"
#include "X86TargetMachine.h" #include "X86TargetMachine.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/DwarfWriter.h" #include "llvm/CodeGen/DwarfWriter.h"
#include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/Support/Compiler.h" #include "llvm/Support/Compiler.h"
#include <set>
namespace llvm { namespace llvm {
@ -70,10 +69,10 @@ struct VISIBILITY_HIDDEN X86SharedAsmPrinter : public AsmPrinter {
const X86Subtarget *Subtarget; const X86Subtarget *Subtarget;
// Necessary for Darwin to print out the apprioriate types of linker stubs // Necessary for Darwin to print out the apprioriate types of linker stubs
std::set<std::string> FnStubs, GVStubs, LinkOnceStubs; StringSet<> FnStubs, GVStubs, LinkOnceStubs;
// Necessary for dllexport support // Necessary for dllexport support
std::set<std::string> DLLExportedFns, DLLExportedGVs; StringSet<> DLLExportedFns, DLLExportedGVs;
inline static bool isScale(const MachineOperand &MO) { inline static bool isScale(const MachineOperand &MO) {
return MO.isImmediate() && return MO.isImmediate() &&

View File

@ -425,23 +425,23 @@ bool X86IntelAsmPrinter::doFinalization(Module &M) {
O << "_drectve\t segment info alias('.drectve')\n"; O << "_drectve\t segment info alias('.drectve')\n";
} }
for (std::set<std::string>::iterator i = DLLExportedGVs.begin(), for (StringSet<>::iterator i = DLLExportedGVs.begin(),
e = DLLExportedGVs.end(); e = DLLExportedGVs.end();
i != e; ++i) { i != e; ++i) {
O << "\t db ' /EXPORT:" << *i << ",data'\n"; O << "\t db ' /EXPORT:" << i->getKeyData() << ",data'\n";
} }
for (std::set<std::string>::iterator i = DLLExportedFns.begin(), for (StringSet<>::iterator i = DLLExportedFns.begin(),
e = DLLExportedFns.end(); e = DLLExportedFns.end();
i != e; ++i) { i != e; ++i) {
O << "\t db ' /EXPORT:" << *i << "'\n"; O << "\t db ' /EXPORT:" << i->getKeyData() << "'\n";
} }
if (!DLLExportedGVs.empty() || if (!DLLExportedGVs.empty() ||
!DLLExportedFns.empty()) { !DLLExportedFns.empty()) {
O << "_drectve\t ends\n"; O << "_drectve\t ends\n";
} }
// Bypass X86SharedAsmPrinter::doFinalization(). // Bypass X86SharedAsmPrinter::doFinalization().
bool Result = AsmPrinter::doFinalization(M); bool Result = AsmPrinter::doFinalization(M);
SwitchToDataSection(""); SwitchToDataSection("");