aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorGordon Henriksen <gordonhenriksen@mac.com>2008-08-17 18:44:35 +0000
committerGordon Henriksen <gordonhenriksen@mac.com>2008-08-17 18:44:35 +0000
commit1aed599aac357d2aaf0df6f4683d59f6455bae0d (patch)
tree5406e0182a3a20726e00eec044bbca1199e673b9 /lib/VMCore
parent9612506854ed28726adf97e849d06964ad2ff99d (diff)
downloadexternal_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')
-rw-r--r--lib/VMCore/AsmWriter.cpp4
-rw-r--r--lib/VMCore/Core.cpp12
-rw-r--r--lib/VMCore/Function.cpp62
-rw-r--r--lib/VMCore/Verifier.cpp4
4 files changed, 42 insertions, 40 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 282f47b..f16ae08 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/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/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp
index bc7137b..8517a41 100644
--- a/lib/VMCore/Core.cpp
+++ b/lib/VMCore/Core.cpp
@@ -719,17 +719,17 @@ void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC) {
return unwrap<Function>(Fn)->setCallingConv(CC);
}
-const char *LLVMGetCollector(LLVMValueRef Fn) {
+const char *LLVMGetGC(LLVMValueRef Fn) {
Function *F = unwrap<Function>(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<Function>(Fn);
- if (Coll)
- F->setCollector(Coll);
+ if (GC)
+ F->setGC(GC);
else
- F->clearCollector();
+ F->clearGC();
}
/*--.. Operations on parameters ............................................--*/
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
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index b1b413c..fb48814 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/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: