[PATCH] D107133: [AVR] emit `MCSA_Global` references to `__do_global_ctors` and `__do_global_dtors`

Matt Jacobson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 1 19:08:36 PDT 2021


mhjacobson added a comment.

Sure, I'm open to that.

It's rare for a program not to use any global variables, whereas programs that don't use any constructor/destructor functions are pretty common.  Luckily, though, `__do_global_ctors` is pretty cheap (just a few instructions) if the constructor table is empty.

So I think your suggestion would be fine.

But can you explain more the reason why we don't want this state in AVRAsmPrinter?  If I'm reading correctly, the superclass, AsmPrinter, keeps mutable state, and (AFAICT) it's not unusual for other targets' AsmPrinter subclasses to keep state, either.  I'm admittedly not an expert here though, so I'd like to learn why it's a problem.

Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107133/new/

https://reviews.llvm.org/D107133



More information about the llvm-commits mailing list