Cleanup.
Added LogicMdTest.
Added LogicMdTest to test suite.
Made MD_NOT register aware.
Added missing variation for MD_EXPAND.
Fixed registers being spilled too late on function calls.