Adding a collector name attribute to Function in the IR. These

methods are new to Function:

  bool hasCollector() const;
  const std::string &getCollector() const;
  void setCollector(const std::string &);
  void clearCollector();

The assembly representation is as such:

  define void @f() gc "shadow-stack" { ...

The implementation uses an on-the-side table to map Functions to 
collector names, such that there is no overhead. A StringPool is 
further used to unique collector names, which are extremely
likely to be unique per process.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44769 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Gordon Henriksen
2007-12-10 03:18:06 +00:00
parent afba8fe662
commit 80a75bfae9
21 changed files with 1468 additions and 1250 deletions

View File

@@ -619,6 +619,19 @@ void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC) {
return unwrap<Function>(Fn)->setCallingConv(CC);
}
const char *LLVMGetCollector(LLVMValueRef Fn) {
Function *F = unwrap<Function>(Fn);
return F->hasCollector()? F->getCollector() : 0;
}
void LLVMSetCollector(LLVMValueRef Fn, const char *Coll) {
Function *F = unwrap<Function>(Fn);
if (Coll)
F->setCollector(Coll);
else
F->clearCollector();
}
/*--.. Operations on basic blocks ..........................................--*/
LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef Bb) {