mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-13 22:58:50 +00:00
generate side-effect info
llvm-svn: 26672
This commit is contained in:
parent
d5d29512ee
commit
fa0acde009
@ -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";
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user