diff options
author | Gordon Henriksen <gordonhenriksen@mac.com> | 2008-08-17 18:44:35 +0000 |
---|---|---|
committer | Gordon Henriksen <gordonhenriksen@mac.com> | 2008-08-17 18:44:35 +0000 |
commit | 1aed599aac357d2aaf0df6f4683d59f6455bae0d (patch) | |
tree | 5406e0182a3a20726e00eec044bbca1199e673b9 /lib/VMCore/Function.cpp | |
parent | 9612506854ed28726adf97e849d06964ad2ff99d (diff) | |
download | external_llvm-1aed599aac357d2aaf0df6f4683d59f6455bae0d.zip external_llvm-1aed599aac357d2aaf0df6f4683d59f6455bae0d.tar.gz external_llvm-1aed599aac357d2aaf0df6f4683d59f6455bae0d.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54899 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Function.cpp')
-rw-r--r-- | lib/VMCore/Function.cpp | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index f819a18..c1a96de 100644 --- a/lib/VMCore/Function.cpp +++ b/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<const Function*,PooledStringPtr> *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<const Function*,PooledStringPtr> *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<const Function*,PooledStringPtr>(); - (*CollectorNames)[this] = CollectorNamePool->intern(Str); +void Function::setGC(const char *Str) { + if (!GCNamePool) + GCNamePool = new StringPool(); + if (!GCNames) + GCNames = new DenseMap<const Function*,PooledStringPtr>(); + (*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<Function>(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 |