summaryrefslogtreecommitdiff
path: root/utils/TableGen/IntrinsicEmitter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-12 02:41:37 +0000
committerChris Lattner <sabre@nondot.org>2009-01-12 02:41:37 +0000
commitd4a2700fdc5bc8ac50084fcb39155e01e86168d5 (patch)
treebd1286f5ee5e7c217f27ff19cde3b96cf305243f /utils/TableGen/IntrinsicEmitter.cpp
parent10dae94be2ccb187bd4e3da53771be54057acd6c (diff)
downloadllvm-d4a2700fdc5bc8ac50084fcb39155e01e86168d5.tar.gz
llvm-d4a2700fdc5bc8ac50084fcb39155e01e86168d5.tar.bz2
llvm-d4a2700fdc5bc8ac50084fcb39155e01e86168d5.tar.xz
make tblgen autogenerate the nocapture intrinsics for
llvm.memcpy/memset/memmove. This allows removal of some hackish code from basicaa. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62071 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/IntrinsicEmitter.cpp')
-rw-r--r--utils/TableGen/IntrinsicEmitter.cpp29
1 files changed, 22 insertions, 7 deletions
diff --git a/utils/TableGen/IntrinsicEmitter.cpp b/utils/TableGen/IntrinsicEmitter.cpp
index 34bf768890..eda55e1430 100644
--- a/utils/TableGen/IntrinsicEmitter.cpp
+++ b/utils/TableGen/IntrinsicEmitter.cpp
@@ -423,8 +423,7 @@ EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, std::ostream &OS) {
OS << " break;\n";
OS << " }\n";
OS << " AttributeWithIndex AWI[" << MaxArgAttrs+1 << "];\n";
- OS << " AWI[0] = AttributeWithIndex::get(~0, Attr);\n";
- OS << " unsigned NumAttrs = 1;\n";
+ OS << " unsigned NumAttrs = 0;\n";
OS << " switch (id) {\n";
OS << " default: break;\n";
@@ -441,17 +440,33 @@ EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, std::ostream &OS) {
unsigned NumArgsWithAttrs = 0;
- // FIXME: EMIT ATTRS
-
+ while (!ArgAttrs.empty()) {
+ unsigned ArgNo = ArgAttrs[0].first;
+
+ OS << " AWI[" << NumArgsWithAttrs++ << "] = AttributeWithIndex::get("
+ << ArgNo+1 << ", 0";
+
+ while (!ArgAttrs.empty() && ArgAttrs[0].first == ArgNo) {
+ switch (ArgAttrs[0].second) {
+ default: assert(0 && "Unknown arg attribute");
+ case CodeGenIntrinsic::NoCapture:
+ OS << "|Attribute::NoCapture";
+ break;
+ }
+ ArgAttrs.erase(ArgAttrs.begin());
+ }
+ OS << ");\n";
+ }
- OS << " NumAttrs = " << NumArgsWithAttrs+1 << ";\n";
+ OS << " NumAttrs = " << NumArgsWithAttrs << ";\n";
OS << " break;\n";
}
OS << " }\n";
- OS << " return AttrListPtr::get(AWI, NumAttrs);\n";
+ OS << " AWI[NumAttrs] = AttributeWithIndex::get(~0, Attr);\n";
+ OS << " return AttrListPtr::get(AWI, NumAttrs+1);\n";
OS << "}\n";
- OS << "#endif\n\n";
+ OS << "#endif // GET_INTRINSIC_ATTRIBUTES\n\n";
}
void IntrinsicEmitter::