diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-12 02:41:37 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-12 02:41:37 +0000 |
commit | 2089cd09baf11ba3e0914c12467b41a7b3fc37cd (patch) | |
tree | b410247bc8f3d24e89ad72db19d8429f33b84805 /llvm | |
parent | 027c5fbb6d4d13b97edb98e8ed19f5dac5cfacd8 (diff) | |
download | bcm5719-llvm-2089cd09baf11ba3e0914c12467b41a7b3fc37cd.tar.gz bcm5719-llvm-2089cd09baf11ba3e0914c12467b41a7b3fc37cd.zip |
make tblgen autogenerate the nocapture intrinsics for
llvm.memcpy/memset/memmove. This allows removal of some
hackish code from basicaa.
llvm-svn: 62071
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Analysis/BasicAliasAnalysis.cpp | 4 | ||||
-rw-r--r-- | llvm/utils/TableGen/IntrinsicEmitter.cpp | 29 |
2 files changed, 22 insertions, 11 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index 9608a28edd8..92cff8ea969 100644 --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -69,10 +69,6 @@ static bool AddressMightEscape(const Value *V) { if (cast<CallInst>(I)->paramHasAttr(UI.getOperandNo(), Attribute::NoCapture)) continue; - - // FIXME: MemIntrinsics should have their operands marked nocapture! - if (isa<MemIntrinsic>(I)) - continue; // next use return true; case Instruction::Invoke: // If the argument to the call has the nocapture attribute, then the call diff --git a/llvm/utils/TableGen/IntrinsicEmitter.cpp b/llvm/utils/TableGen/IntrinsicEmitter.cpp index 34bf7688904..eda55e1430f 100644 --- a/llvm/utils/TableGen/IntrinsicEmitter.cpp +++ b/llvm/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:: |