From d930f913e6a7cef110d9b62e8218c8845fe8e026 Mon Sep 17 00:00:00 2001 From: Gordon Henriksen Date: Sun, 17 Aug 2008 18:44:35 +0000 Subject: Rename some GC classes so that their roll will hopefully be clearer. In particular, Collector was confusing to implementors. Several thought that this compile-time class was the place to implement their runtime GC heap. Of course, it doesn't even exist at runtime. Specifically, the renames are: Collector -> GCStrategy CollectorMetadata -> GCFunctionInfo CollectorModuleMetadata -> GCModuleInfo CollectorRegistry -> GCRegistry Function::getCollector -> getGC (setGC, hasGC, clearGC) Several accessors and nested types have also been renamed to be consistent. These changes should be obvious. llvm-svn: 54899 --- llvm/lib/VMCore/AsmWriter.cpp | 4 +-- llvm/lib/VMCore/Core.cpp | 12 ++++----- llvm/lib/VMCore/Function.cpp | 62 ++++++++++++++++++++++--------------------- llvm/lib/VMCore/Verifier.cpp | 4 +-- 4 files changed, 42 insertions(+), 40 deletions(-) (limited to 'llvm/lib/VMCore') diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp index 282f47bec15..f16ae08ef1f 100644 --- a/llvm/lib/VMCore/AsmWriter.cpp +++ b/llvm/lib/VMCore/AsmWriter.cpp @@ -1184,8 +1184,8 @@ void AssemblyWriter::printFunction(const Function *F) { Out << " section \"" << F->getSection() << '"'; if (F->getAlignment()) Out << " align " << F->getAlignment(); - if (F->hasCollector()) - Out << " gc \"" << F->getCollector() << '"'; + if (F->hasGC()) + Out << " gc \"" << F->getGC() << '"'; if (F->isDeclaration()) { Out << "\n"; diff --git a/llvm/lib/VMCore/Core.cpp b/llvm/lib/VMCore/Core.cpp index bc7137b9d00..8517a41d7ce 100644 --- a/llvm/lib/VMCore/Core.cpp +++ b/llvm/lib/VMCore/Core.cpp @@ -719,17 +719,17 @@ void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC) { return unwrap(Fn)->setCallingConv(CC); } -const char *LLVMGetCollector(LLVMValueRef Fn) { +const char *LLVMGetGC(LLVMValueRef Fn) { Function *F = unwrap(Fn); - return F->hasCollector()? F->getCollector() : 0; + return F->hasGC()? F->getGC() : 0; } -void LLVMSetCollector(LLVMValueRef Fn, const char *Coll) { +void LLVMSetGC(LLVMValueRef Fn, const char *GC) { Function *F = unwrap(Fn); - if (Coll) - F->setCollector(Coll); + if (GC) + F->setGC(GC); else - F->clearCollector(); + F->clearGC(); } /*--.. Operations on parameters ............................................--*/ diff --git a/llvm/lib/VMCore/Function.cpp b/llvm/lib/VMCore/Function.cpp index f819a18e1eb..c1a96de0a77 100644 --- a/llvm/lib/VMCore/Function.cpp +++ b/llvm/lib/VMCore/Function.cpp @@ -182,8 +182,8 @@ Function::~Function() { ArgumentList.clear(); delete SymTab; - // Remove the function from the on-the-side collector table. - clearCollector(); + // Remove the function from the on-the-side GC table. + clearGC(); } void Function::BuildLazyArguments() const { @@ -240,39 +240,39 @@ void Function::removeParamAttr(unsigned i, ParameterAttributes attr) { setParamAttrs(PAL); } -// Maintain the collector name for each function in an on-the-side table. This -// saves allocating an additional word in Function for programs which do not use -// GC (i.e., most programs) at the cost of increased overhead for clients which -// do use GC. -static DenseMap *CollectorNames; -static StringPool *CollectorNamePool; +// Maintain the GC name for each function in an on-the-side table. This saves +// allocating an additional word in Function for programs which do not use GC +// (i.e., most programs) at the cost of increased overhead for clients which do +// use GC. +static DenseMap *GCNames; +static StringPool *GCNamePool; -bool Function::hasCollector() const { - return CollectorNames && CollectorNames->count(this); +bool Function::hasGC() const { + return GCNames && GCNames->count(this); } -const char *Function::getCollector() const { - assert(hasCollector() && "Function has no collector"); - return *(*CollectorNames)[this]; +const char *Function::getGC() const { + assert(hasGC() && "Function has no collector"); + return *(*GCNames)[this]; } -void Function::setCollector(const char *Str) { - if (!CollectorNamePool) - CollectorNamePool = new StringPool(); - if (!CollectorNames) - CollectorNames = new DenseMap(); - (*CollectorNames)[this] = CollectorNamePool->intern(Str); +void Function::setGC(const char *Str) { + if (!GCNamePool) + GCNamePool = new StringPool(); + if (!GCNames) + GCNames = new DenseMap(); + (*GCNames)[this] = GCNamePool->intern(Str); } -void Function::clearCollector() { - if (CollectorNames) { - CollectorNames->erase(this); - if (CollectorNames->empty()) { - delete CollectorNames; - CollectorNames = 0; - if (CollectorNamePool->empty()) { - delete CollectorNamePool; - CollectorNamePool = 0; +void Function::clearGC() { + if (GCNames) { + GCNames->erase(this); + if (GCNames->empty()) { + delete GCNames; + GCNames = 0; + if (GCNamePool->empty()) { + delete GCNamePool; + GCNamePool = 0; } } } @@ -286,8 +286,10 @@ void Function::copyAttributesFrom(const GlobalValue *Src) { const Function *SrcF = cast(Src); setCallingConv(SrcF->getCallingConv()); setParamAttrs(SrcF->getParamAttrs()); - if (SrcF->hasCollector()) - setCollector(SrcF->getCollector()); + if (SrcF->hasGC()) + setGC(SrcF->getGC()); + else + clearGC(); } /// getIntrinsicID - This method returns the ID number of the specified diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp index b1b413c68bb..fb48814c003 100644 --- a/llvm/lib/VMCore/Verifier.cpp +++ b/llvm/lib/VMCore/Verifier.cpp @@ -1308,8 +1308,8 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) { break; } - Assert1(CI.getParent()->getParent()->hasCollector(), - "Enclosing function does not specify a collector algorithm.", + Assert1(CI.getParent()->getParent()->hasGC(), + "Enclosing function does not use GC.", &CI); } break; case Intrinsic::init_trampoline: -- cgit v1.2.3