The LLVM backend of the Clang/LLVM compiler runs various pass on the IR (intermediate representation) for optimisations.
All of the logic on related to optimization pipeline construction is concentrated in PassBuilder.cpp. There you can see direct conditions on optimization levels.
Sure, just add it to that source file.
LLVM developers try to make all of the passes independent (and they are for the most part, as far as I know). If you want to use information from some pass, that pass should be registered as Analysis (i.e. a pass that does not transform the code, but gathers the info). You can read more about analysis dependency in here.
I hope this answers your question!