diff options
author | Duncan Sands <baldrick@free.fr> | 2009-02-14 10:56:35 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2009-02-14 10:56:35 +0000 |
commit | 555ddcff7291272adc65a0a44ec849e187ee1981 (patch) | |
tree | af61eb3497d043f8b767efa3130d280330182285 /utils | |
parent | ec16abd4ec52abd8cf1d99761bcfae01fe49f3d1 (diff) | |
download | external_llvm-555ddcff7291272adc65a0a44ec849e187ee1981.zip external_llvm-555ddcff7291272adc65a0a44ec849e187ee1981.tar.gz external_llvm-555ddcff7291272adc65a0a44ec849e187ee1981.tar.bz2 |
Generalize some alias analysis logic from atomic
intrinsics to any IntrWriteArgMem intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64551 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/TableGen/IntrinsicEmitter.cpp | 34 | ||||
-rw-r--r-- | utils/TableGen/IntrinsicEmitter.h | 2 |
2 files changed, 36 insertions, 0 deletions
diff --git a/utils/TableGen/IntrinsicEmitter.cpp b/utils/TableGen/IntrinsicEmitter.cpp index 53081ff..37fc670 100644 --- a/utils/TableGen/IntrinsicEmitter.cpp +++ b/utils/TableGen/IntrinsicEmitter.cpp @@ -48,6 +48,9 @@ void IntrinsicEmitter::run(std::ostream &OS) { // Emit the intrinsic parameter attributes. EmitAttributes(Ints, OS); + // Emit intrinsic alias analysis mod/ref behavior. + EmitModRefBehavior(Ints, OS); + // Emit a list of intrinsics with corresponding GCC builtins. EmitGCCBuiltinList(Ints, OS); @@ -481,6 +484,37 @@ EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, std::ostream &OS) { OS << "#endif // GET_INTRINSIC_ATTRIBUTES\n\n"; } +/// EmitModRefBehavior - Determine intrinsic alias analysis mod/ref behavior. +void IntrinsicEmitter:: +EmitModRefBehavior(const std::vector<CodeGenIntrinsic> &Ints, std::ostream &OS){ + OS << "// Determine intrinsic alias analysis mod/ref behavior.\n"; + OS << "#ifdef GET_INTRINSIC_MODREF_BEHAVIOR\n"; + OS << "switch (id) {\n"; + OS << "default:\n return UnknownModRefBehavior;\n"; + for (unsigned i = 0, e = Ints.size(); i != e; ++i) { + if (Ints[i].ModRef == CodeGenIntrinsic::WriteMem) + continue; + OS << "case " << TargetPrefix << "Intrinsic::" << Ints[i].EnumName + << ":\n"; + switch (Ints[i].ModRef) { + default: + assert(false && "Unknown Mod/Ref type!"); + case CodeGenIntrinsic::NoMem: + OS << " return DoesNotAccessMemory;\n"; + break; + case CodeGenIntrinsic::ReadArgMem: + case CodeGenIntrinsic::ReadMem: + OS << " return OnlyReadsMemory;\n"; + break; + case CodeGenIntrinsic::WriteArgMem: + OS << " return AccessesArguments;\n"; + break; + } + } + OS << "}\n"; + OS << "#endif // GET_INTRINSIC_MODREF_BEHAVIOR\n\n"; +} + void IntrinsicEmitter:: EmitGCCBuiltinList(const std::vector<CodeGenIntrinsic> &Ints, std::ostream &OS){ OS << "// Get the GCC builtin that corresponds to an LLVM intrinsic.\n"; diff --git a/utils/TableGen/IntrinsicEmitter.h b/utils/TableGen/IntrinsicEmitter.h index 0f3f0e7..4a169ff 100644 --- a/utils/TableGen/IntrinsicEmitter.h +++ b/utils/TableGen/IntrinsicEmitter.h @@ -42,6 +42,8 @@ namespace llvm { std::ostream &OS); void EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, std::ostream &OS); + void EmitModRefBehavior(const std::vector<CodeGenIntrinsic> &Ints, + std::ostream &OS); void EmitGCCBuiltinList(const std::vector<CodeGenIntrinsic> &Ints, std::ostream &OS); void EmitIntrinsicToGCCBuiltinMap(const std::vector<CodeGenIntrinsic> &Ints, |