move all mangle computation (except D mangle) from backend to glue layer

fix format