In order for /var/db/pkg/*/*/CFLAGS and CXXFLAGS to be useful for determining whether or not a package would change if recompiled, the dyn_compile() function in ebuild.sh should be modified so that the values of those variables are stored BEFORE being modified by the ebuild. That way one can easily check if that package was compiled on the current configuration or before, without checking the ebuild file for any filters or unset's.
This is going to be handled by sticky flags.