Chiasmus is the reversing the order of words in the second of two parallel phrases. This rhetorical device is also referred to as reverse parallelism, antimetabole or syntactical inversion.
Read more at http://examples.yourdictionary.com/chiasmus-examples.html#W6i0PSKAYB1pBqr9.99