[llvm-commits] [PATCH] [MC] .pushsection / .popsection support
Joerg Sonnenberger
joerg at britannica.bec.de
Tue Feb 15 14:16:22 PST 2011
Hi all,
attached is a revised patch:
- CurSection / PrevSection are private to MCStreamer. They are updated
by PopSection and SwitchSection. Code that tried to access CurSection
directly now uses the normal getCurrentSection() accessor function.
- CurSectionStack / PrevSectionStack are maintained by PushSection and
PopSection. Renamed to fit the existing scheme.
- SwitchSection has been split into the maintainance part of CurSection
/ PrevSection and the target specific behavior when the effective
section changes.
- The LoggingStreamer doesn't see the individual SwitchSection calls nor
does it see PushSection / PopSection. I don't believe the diagnostics
justifies making SwitchSection, PushSection and PopSection virtual.
For consideration:
- Move the "Cannot emit before setting section" assertion into
getCurSection(). Assumption here is that InitSections is supposed to
provide a default value and nothing should call getCurSection() that
early. The assembler printer should only print the default section, if
there is some actual content (left as separate issue).
- Removing CurSection / PrevSection adds a lot of complications for no
gain. There is no constructor of MCStreamer to set up the initial
element, so all functions would have to deal with the section stack
being empty. Push would would have to insert an element just after the
top, etc., so it doesn't even simplify anything.
Joerg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pushpop.diff
Type: text/x-diff
Size: 21106 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110215/d5e4c2e8/attachment.diff>
More information about the llvm-commits
mailing list