generate side-effect info

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26672 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2006-03-09 22:37:52 +00:00
parent 06383e948f
commit 4e5f35973c
2 changed files with 27 additions and 0 deletions

View File

@ -100,6 +100,9 @@ void IntrinsicEmitter::run(std::ostream &OS) {
// Emit mod/ref info for each function.
EmitModRefInfo(Ints, OS);
// Emit side effect info for each function.
EmitSideEffectInfo(Ints, OS);
}
void IntrinsicEmitter::EmitEnumInfo(const std::vector<CodeGenIntrinsic> &Ints,
@ -191,3 +194,25 @@ void IntrinsicEmitter::EmitModRefInfo(const std::vector<CodeGenIntrinsic> &Ints,
}
OS << "#endif\n\n";
}
void IntrinsicEmitter::
EmitSideEffectInfo(const std::vector<CodeGenIntrinsic> &Ints, std::ostream &OS){
OS << "// isInstructionTriviallyDead code.\n";
OS << "#ifdef GET_SIDE_EFFECT_INFO\n";
OS << " switch (F->getIntrinsicID()) {\n";
OS << " default: break;\n";
for (unsigned i = 0, e = Ints.size(); i != e; ++i) {
switch (Ints[i].ModRef) {
default: break;
case CodeGenIntrinsic::NoMem:
case CodeGenIntrinsic::ReadArgMem:
case CodeGenIntrinsic::ReadMem:
OS << " case Intrinsic::" << Ints[i].EnumName << ":\n";
break;
}
}
OS << " return true; // These intrinsics have no side effects.\n";
OS << " }\n";
OS << "#endif\n\n";
}

View File

@ -35,6 +35,8 @@ namespace llvm {
std::ostream &OS);
void EmitModRefInfo(const std::vector<CodeGenIntrinsic> &Ints,
std::ostream &OS);
void EmitSideEffectInfo(const std::vector<CodeGenIntrinsic> &Ints,
std::ostream &OS);
};
} // End llvm namespace