First, most of GCC optimizations happens in its middle-end, on GIMPLE intermediate representations (i.e. an optimization pass transforms GIMPLE to GIMPLE). Only later, in the back-end layer (at RTL level) are assembler instructions generated.
In fact, you'll better think in terms of GCC internal representations (mostly, GIMPLE) than in terms of assembly instruction lifecycle (nearly meaningless).
You might compile with -fdump-tree-all
(and some optimization flags, e.g. -O1
) and you might customize your GCC with MELT (note: I am the main author of MELT).
The Indian GCC resource center contains a lot of resources related to GCC.
My GCC MELT documentation page contains many links and slides describing GCC internals. See also this answer.
PS. I don't work any more on GCC MELT (since 2017). It is an inactive project (tied to old versions of GCC).