[llvm] r276874 - [AArch64] Mark various *Info classes as 'final'. NFC.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 2 08:06:34 PDT 2016


On Tue, Aug 2, 2016 at 4:33 AM Ahmed Bougacha <ahmed.bougacha at gmail.com>
wrote:

> On Mon, Aug 1, 2016 at 11:30 AM, David Blaikie <dblaikie at gmail.com> wrote:
> > Any particular reason/motivation for this?
>
> Not really, seemed like free goodness that can only help (I measured
> after the fact, looks like it shaves off a few dozen indirect calls in
> AArch64 passes; don't know how frequent they are though).
>
> Now I'm curious: it's not?
>

Not free? Nah, it's pretty free - we just haven't been in the habit of
marking classes final as a matter of course. If you observed some benefit
(even just statically) & these classes aren't generally intended to be
derived from, seems fine to me. Good to have the motivation here in this
commit list (maybe good to have it in a comment too) so if someone does
decide to derive from it and remove 'final' they aren't worried about extra
gotchas lurking in the API (eg: they don't have to worry that the type has
some fundamental problem with being derived from that may cause issues)

I didn't know we did devirtualize based on 'final' - it's obvious/good, and
good to know we do.

- Dave


>
> -Ahmed
>
> > On Wed, Jul 27, 2016 at 7:39 AM Ahmed Bougacha via llvm-commits
> > <llvm-commits at lists.llvm.org> wrote:
> >>
> >> Author: ab
> >> Date: Wed Jul 27 09:31:46 2016
> >> New Revision: 276874
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=276874&view=rev
> >> Log:
> >> [AArch64] Mark various *Info classes as 'final'. NFC.
> >>
> >> Modified:
> >>     llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.h
> >>     llvm/trunk/lib/Target/AArch64/AArch64MachineFunctionInfo.h
> >>     llvm/trunk/lib/Target/AArch64/AArch64RegisterBankInfo.h
> >>     llvm/trunk/lib/Target/AArch64/AArch64RegisterInfo.h
> >>     llvm/trunk/lib/Target/AArch64/AArch64Subtarget.h
> >>
> >> Modified: llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.h
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.h?rev=276874&r1=276873&r2=276874&view=diff
> >>
> >>
> ==============================================================================
> >> --- llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.h (original)
> >> +++ llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.h Wed Jul 27 09:31:46
> >> 2016
> >> @@ -27,7 +27,7 @@ namespace llvm {
> >>  class AArch64Subtarget;
> >>  class AArch64TargetMachine;
> >>
> >> -class AArch64InstrInfo : public AArch64GenInstrInfo {
> >> +class AArch64InstrInfo final : public AArch64GenInstrInfo {
> >>    const AArch64RegisterInfo RI;
> >>    const AArch64Subtarget &Subtarget;
> >>
> >>
> >> Modified: llvm/trunk/lib/Target/AArch64/AArch64MachineFunctionInfo.h
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64MachineFunctionInfo.h?rev=276874&r1=276873&r2=276874&view=diff
> >>
> >>
> ==============================================================================
> >> --- llvm/trunk/lib/Target/AArch64/AArch64MachineFunctionInfo.h
> (original)
> >> +++ llvm/trunk/lib/Target/AArch64/AArch64MachineFunctionInfo.h Wed Jul
> 27
> >> 09:31:46 2016
> >> @@ -23,7 +23,7 @@ namespace llvm {
> >>
> >>  /// AArch64FunctionInfo - This class is derived from
> MachineFunctionInfo
> >> and
> >>  /// contains private AArch64-specific information for each
> >> MachineFunction.
> >> -class AArch64FunctionInfo : public MachineFunctionInfo {
> >> +class AArch64FunctionInfo final : public MachineFunctionInfo {
> >>
> >>    /// Number of bytes of arguments this function has on the stack. If
> the
> >> callee
> >>    /// is expected to restore the argument stack this should be a
> multiple
> >> of 16,
> >>
> >> Modified: llvm/trunk/lib/Target/AArch64/AArch64RegisterBankInfo.h
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64RegisterBankInfo.h?rev=276874&r1=276873&r2=276874&view=diff
> >>
> >>
> ==============================================================================
> >> --- llvm/trunk/lib/Target/AArch64/AArch64RegisterBankInfo.h (original)
> >> +++ llvm/trunk/lib/Target/AArch64/AArch64RegisterBankInfo.h Wed Jul 27
> >> 09:31:46 2016
> >> @@ -30,7 +30,7 @@ enum {
> >>  } // End AArch64 namespace.
> >>
> >>  /// This class provides the information for the target register banks.
> >> -class AArch64RegisterBankInfo : public RegisterBankInfo {
> >> +class AArch64RegisterBankInfo final : public RegisterBankInfo {
> >>    /// See RegisterBankInfo::applyMapping.
> >>    void applyMappingImpl(const OperandsMapper &OpdMapper) const
> override;
> >>
> >>
> >> Modified: llvm/trunk/lib/Target/AArch64/AArch64RegisterInfo.h
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64RegisterInfo.h?rev=276874&r1=276873&r2=276874&view=diff
> >>
> >>
> ==============================================================================
> >> --- llvm/trunk/lib/Target/AArch64/AArch64RegisterInfo.h (original)
> >> +++ llvm/trunk/lib/Target/AArch64/AArch64RegisterInfo.h Wed Jul 27
> >> 09:31:46 2016
> >> @@ -24,7 +24,7 @@ class RegScavenger;
> >>  class TargetRegisterClass;
> >>  class Triple;
> >>
> >> -class AArch64RegisterInfo : public AArch64GenRegisterInfo {
> >> +class AArch64RegisterInfo final : public AArch64GenRegisterInfo {
> >>    const Triple &TT;
> >>
> >>  public:
> >>
> >> Modified: llvm/trunk/lib/Target/AArch64/AArch64Subtarget.h
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64Subtarget.h?rev=276874&r1=276873&r2=276874&view=diff
> >>
> >>
> ==============================================================================
> >> --- llvm/trunk/lib/Target/AArch64/AArch64Subtarget.h (original)
> >> +++ llvm/trunk/lib/Target/AArch64/AArch64Subtarget.h Wed Jul 27 09:31:46
> >> 2016
> >> @@ -32,7 +32,7 @@ class GlobalValue;
> >>  class StringRef;
> >>  class Triple;
> >>
> >> -class AArch64Subtarget : public AArch64GenSubtargetInfo {
> >> +class AArch64Subtarget final : public AArch64GenSubtargetInfo {
> >>  public:
> >>    enum ARMProcFamilyEnum : uint8_t {
> >>      Others,
> >>
> >>
> >> _______________________________________________
> >> llvm-commits mailing list
> >> llvm-commits at lists.llvm.org
> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160802/61fa1174/attachment.html>


More information about the llvm-commits mailing list