[llvm] r206473 - [AArch64] Implement the getCSRFirstUseCost API, mirroring that in ARM64.

Hal Finkel hfinkel at anl.gov
Sun Apr 20 20:33:20 PDT 2014


Chad,

I understand you're mirroring, but do you have a test case for this? I don't think that Manman had a test case for the original commit either. 

If I understand what is going on correctly, it should be easy to make one. You just need something like this:

entry:
br i1 undef, label %hot, label %cold

cold:
  i32 %v = call i32 whatever() ; this value must be saved, and we should spill here instead of using a callee-saved register
  call void perror(undef) ; just to make this cold; metadata will also work
  call asm ; clobber all caller-saved registers

hot:
  %p = phi [0, %entry, %v, %cold]
  ret i32 %p

 -Hal

----- Original Message -----
> From: "Chad Rosier" <mcrosier at codeaurora.org>
> To: llvm-commits at cs.uiuc.edu
> Sent: Thursday, April 17, 2014 11:19:54 AM
> Subject: [llvm] r206473 - [AArch64] Implement the getCSRFirstUseCost API,	mirroring that in ARM64.
> 
> Author: mcrosier
> Date: Thu Apr 17 11:19:54 2014
> New Revision: 206473
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=206473&view=rev
> Log:
> [AArch64] Implement the getCSRFirstUseCost API, mirroring that in
> ARM64.
> 
> Modified:
>     llvm/trunk/lib/Target/AArch64/AArch64RegisterInfo.h
> 
> Modified: llvm/trunk/lib/Target/AArch64/AArch64RegisterInfo.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64RegisterInfo.h?rev=206473&r1=206472&r2=206473&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/AArch64/AArch64RegisterInfo.h (original)
> +++ llvm/trunk/lib/Target/AArch64/AArch64RegisterInfo.h Thu Apr 17
> 11:19:54 2014
> @@ -30,6 +30,13 @@ struct AArch64RegisterInfo : public AArc
>    const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF = 0)
>    const;
>    const uint32_t *getCallPreservedMask(CallingConv::ID) const;
>  
> +  unsigned getCSRFirstUseCost() const {
> +    // The cost will be compared against BlockFrequency where entry
> has the
> +    // value of 1 << 14. A value of 5 will choose to spill or split
> really
> +    // cold path instead of using a callee-saved register.
> +    return 5;
> +  }
> +
>    const uint32_t *getTLSDescCallPreservedMask() const;
>  
>    BitVector getReservedRegs(const MachineFunction &MF) const;
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-commits mailing list