This patch moves the emission of global variables from DwarfDebug::beginModule()
to DwarfDebug::endModule(). Effectively, this changes nothing but the order
of debug entities in the resulting DWARF.
This is needed to simplify DWARF emission in a context of proper support of
function-local static variables (which are globals in terms of LLVM IR)
which comes in the next patch (D144008), making all the globals handled in
a single place, together with other global and local entities.
If this function remains identical, maybe save moving it around for a separate patch to reduce the size/possible changes in this patch?
(similarly, could /possibly/ refactor the globals loop into a function in one patch, move where the call is in another, then move the function around (if you like/to bring it closer to usage) in another - making it clear that moving the call site isn't changing any other behavior)