summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGordon Henriksen <gordonhenriksen@mac.com>2007-12-10 03:18:06 +0000
committerGordon Henriksen <gordonhenriksen@mac.com>2007-12-10 03:18:06 +0000
commit80a75bfae980df96f969f1c05b0c4a80ce975240 (patch)
treeb17b6964d35ffeaa66a62793e9cb123e67b69310 /include
parentafba8fe662d65b25b4baf46bb26cc18e1f9cc0a5 (diff)
downloadllvm-80a75bfae980df96f969f1c05b0c4a80ce975240.tar.gz
llvm-80a75bfae980df96f969f1c05b0c4a80ce975240.tar.bz2
llvm-80a75bfae980df96f969f1c05b0c4a80ce975240.tar.xz
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
Diffstat (limited to 'include')
-rw-r--r--include/llvm-c/Core.h2
-rw-r--r--include/llvm/Bitcode/LLVMBitCodes.h4
-rw-r--r--include/llvm/Function.h7
3 files changed, 12 insertions, 1 deletions
diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h
index a9228bcfc3..d3308eff63 100644
--- a/include/llvm-c/Core.h
+++ b/include/llvm-c/Core.h
@@ -339,6 +339,8 @@ LLVMValueRef LLVMGetParam(LLVMValueRef Fn, unsigned Index);
unsigned LLVMGetIntrinsicID(LLVMValueRef Fn);
unsigned LLVMGetFunctionCallConv(LLVMValueRef Fn);
void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC);
+const char *LLVMGetCollector(LLVMValueRef Fn);
+void LLVMSetCollector(LLVMValueRef Fn, const char *Coll);
/* Operations on basic blocks */
LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef Bb);
diff --git a/include/llvm/Bitcode/LLVMBitCodes.h b/include/llvm/Bitcode/LLVMBitCodes.h
index f62af5e17c..32311b26d9 100644
--- a/include/llvm/Bitcode/LLVMBitCodes.h
+++ b/include/llvm/Bitcode/LLVMBitCodes.h
@@ -58,7 +58,9 @@ namespace bitc {
MODULE_CODE_ALIAS = 9,
/// MODULE_CODE_PURGEVALS: [numvals]
- MODULE_CODE_PURGEVALS = 10
+ MODULE_CODE_PURGEVALS = 10,
+
+ MODULE_CODE_COLLECTORNAME = 11 // COLLECTORNAME: [strchr x N]
};
/// PARAMATTR blocks have code for defining a parameter attribute set.
diff --git a/include/llvm/Function.h b/include/llvm/Function.h
index 20a43e285c..ece095d380 100644
--- a/include/llvm/Function.h
+++ b/include/llvm/Function.h
@@ -153,6 +153,13 @@ public:
/// @brief Set the parameter attributes.
void setParamAttrs(const ParamAttrsList *attrs);
+ /// hasCollector/getCollector/setCollector/clearCollector - The name of the
+ /// garbage collection algorithm to use during code generation.
+ bool hasCollector() const;
+ const char *getCollector() const;
+ void setCollector(const char *Str);
+ void clearCollector();
+
/// @brief Determine whether the function has the given attribute.
bool paramHasAttr(uint16_t i, ParameterAttributes attr) const {
return ParamAttrs && ParamAttrs->paramHasAttr(i, attr);