How does the IRS classify main residence of a child as a qualifying dependent to file your tax return? Does it use the main residence of the child as far as which parent is legally entitled with primary custody or basically where the child has physically lived for the greater part of a filing year regardless of who has primary custody?