I noticed that I was using LLVM::VisibilityAttr::name when looking for
the attribute on LLVM ops, but LLVM::VisibilityAttr::name is just
"builtin.integer"... Now we switch on the types of the specific ops we would
like to match, and use the getters/setters for the attribute directly instead of
the deprecated setAttr/getAttr.
To support the `-fvisibility=...` option in Flang, we need a pass to
rewrite all the global definitions in the LLVM dialect that have the
default visibility to have the specified visibility. This change adds
such a pass.
Note that I did not add an option for `visiblity=default`; I believe
this makes sense for compiler drivers since users may want to tack an
option on at the end of a compile line to override earlier options, but
I don't think it makes sense for this pass to accept
`visibility=default`--it would just be an early exit IIUC.