Query on Global analysis followed by Global transformation

We are trying to implement data layout optimizations in LLVM. This requires us to do a global analysis followed by global transformations. What is the best way to structure the pass(es) in such a scenario?

thanks,
-Prashantha