diff options
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/AsmWriter.cpp | 4 | ||||
-rw-r--r-- | lib/VMCore/Core.cpp | 12 | ||||
-rw-r--r-- | lib/VMCore/Function.cpp | 62 | ||||
-rw-r--r-- | lib/VMCore/Verifier.cpp | 4 |
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: |