Hi, I'm trying to write a pass to erase some useless functions or to put it another way, detect whether a function is pure or not. (Of course I know some passes can do the clean after inline)
Here is the problem I got, If a function satisfy the following points, can it be considered safe to delete? 1. return value is ignored or has no return 2. params are pure 32bit Integer Const or has no params 3. No use of global variable 4. No function call, assembly code, goto statement 5. No cast And in my pass, I try to do these things through these points: 1. check GIMPLE_RETURN statement and check all the function call points 2. check DECL_PARAM(fndecl) and check the input params at all the function call points 3. check that fndecl is not in the global_var->referring list 4. check GIMPLE_CALL, GIMPLE_ASM, GIMPLE_GOTO are not present 5. check that there is no difference between TREE_TYPE(lhs) and TREE_TYPE(rhs1) types in the GIMPLE_ASSIGN statement I would like to ask that if there are any omissions or errors in the prerequisites and corresponding implementation plans I listed above. Thanks Hanke Zhang