Program Analysis For Weak Memory Models