-
Notifications
You must be signed in to change notification settings - Fork 15.5k
[RISCV][RegAlloc] Add getCSRFirstUseCost for RISC-V #131349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
9fa4578
bbbd352
ad0a1ec
0f5c06e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
| ; RUN: llc %s -mtriple=riscv64 -regalloc-csr-first-time-cost=0 | FileCheck %s -check-prefix=ZERO-COST | ||
wangpc-pp marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ; RUN: llc %s -mtriple=riscv64 -regalloc-csr-first-time-cost=64 | FileCheck %s -check-prefix=SOME-COST | ||
michaelmaitland marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| define fastcc void @Perl_sv_setnv(ptr %.str.54.3682) nounwind { | ||
| ; ZERO-COST-LABEL: Perl_sv_setnv: | ||
| ; ZERO-COST: # %bb.0: # %entry | ||
| ; ZERO-COST-NEXT: addi sp, sp, -32 | ||
| ; ZERO-COST-NEXT: sd ra, 24(sp) # 8-byte Folded Spill | ||
| ; ZERO-COST-NEXT: sd s0, 16(sp) # 8-byte Folded Spill | ||
| ; ZERO-COST-NEXT: sd s1, 8(sp) # 8-byte Folded Spill | ||
| ; ZERO-COST-NEXT: bnez zero, .LBB0_5 | ||
| ; ZERO-COST-NEXT: # %bb.1: # %entry | ||
| ; ZERO-COST-NEXT: li a1, 1 | ||
| ; ZERO-COST-NEXT: bnez a1, .LBB0_6 | ||
| ; ZERO-COST-NEXT: .LBB0_2: # %entry | ||
| ; ZERO-COST-NEXT: mv s0, a0 | ||
| ; ZERO-COST-NEXT: beqz zero, .LBB0_4 | ||
| ; ZERO-COST-NEXT: # %bb.3: # %sw.bb34.i | ||
| ; ZERO-COST-NEXT: li s0, 0 | ||
| ; ZERO-COST-NEXT: .LBB0_4: # %Perl_sv_reftype.exit | ||
| ; ZERO-COST-NEXT: li s1, 0 | ||
| ; ZERO-COST-NEXT: li a0, 0 | ||
| ; ZERO-COST-NEXT: li a1, 0 | ||
| ; ZERO-COST-NEXT: jalr s1 | ||
| ; ZERO-COST-NEXT: li a0, 0 | ||
| ; ZERO-COST-NEXT: mv a1, s0 | ||
| ; ZERO-COST-NEXT: li a2, 0 | ||
| ; ZERO-COST-NEXT: jalr s1 | ||
| ; ZERO-COST-NEXT: .LBB0_5: # %entry | ||
| ; ZERO-COST-NEXT: beqz zero, .LBB0_2 | ||
| ; ZERO-COST-NEXT: .LBB0_6: # %sw.bb3 | ||
| ; ZERO-COST-NEXT: ld ra, 24(sp) # 8-byte Folded Reload | ||
| ; ZERO-COST-NEXT: ld s0, 16(sp) # 8-byte Folded Reload | ||
| ; ZERO-COST-NEXT: ld s1, 8(sp) # 8-byte Folded Reload | ||
| ; ZERO-COST-NEXT: addi sp, sp, 32 | ||
| ; ZERO-COST-NEXT: ret | ||
| ; | ||
| ; SOME-COST-LABEL: Perl_sv_setnv: | ||
| ; SOME-COST: # %bb.0: # %entry | ||
| ; SOME-COST-NEXT: addi sp, sp, -32 | ||
| ; SOME-COST-NEXT: sd ra, 24(sp) # 8-byte Folded Spill | ||
| ; SOME-COST-NEXT: sd s0, 16(sp) # 8-byte Folded Spill | ||
| ; SOME-COST-NEXT: bnez zero, .LBB0_5 | ||
| ; SOME-COST-NEXT: # %bb.1: # %entry | ||
| ; SOME-COST-NEXT: li a1, 1 | ||
| ; SOME-COST-NEXT: bnez a1, .LBB0_6 | ||
| ; SOME-COST-NEXT: .LBB0_2: # %entry | ||
| ; SOME-COST-NEXT: sd a0, 8(sp) # 8-byte Folded Spill | ||
| ; SOME-COST-NEXT: beqz zero, .LBB0_4 | ||
| ; SOME-COST-NEXT: # %bb.3: # %sw.bb34.i | ||
| ; SOME-COST-NEXT: sd zero, 8(sp) # 8-byte Folded Spill | ||
| ; SOME-COST-NEXT: .LBB0_4: # %Perl_sv_reftype.exit | ||
| ; SOME-COST-NEXT: li s0, 0 | ||
| ; SOME-COST-NEXT: li a0, 0 | ||
| ; SOME-COST-NEXT: li a1, 0 | ||
| ; SOME-COST-NEXT: jalr s0 | ||
| ; SOME-COST-NEXT: li a0, 0 | ||
| ; SOME-COST-NEXT: ld a1, 8(sp) # 8-byte Folded Reload | ||
| ; SOME-COST-NEXT: li a2, 0 | ||
| ; SOME-COST-NEXT: jalr s0 | ||
| ; SOME-COST-NEXT: .LBB0_5: # %entry | ||
| ; SOME-COST-NEXT: beqz zero, .LBB0_2 | ||
| ; SOME-COST-NEXT: .LBB0_6: # %sw.bb3 | ||
| ; SOME-COST-NEXT: ld ra, 24(sp) # 8-byte Folded Reload | ||
| ; SOME-COST-NEXT: ld s0, 16(sp) # 8-byte Folded Reload | ||
| ; SOME-COST-NEXT: addi sp, sp, 32 | ||
| ; SOME-COST-NEXT: ret | ||
| entry: | ||
| switch i8 0, label %Perl_sv_reftype.exit [ | ||
|
||
| i8 1, label %sw.bb4 | ||
| i8 12, label %sw.bb34.i | ||
| i8 3, label %sw.bb3 | ||
| i8 0, label %sw.bb3 | ||
| ] | ||
|
|
||
| sw.bb3: ; preds = %entry, %entry | ||
| ret void | ||
|
|
||
| sw.bb4: ; preds = %entry | ||
| br label %Perl_sv_reftype.exit | ||
|
|
||
| sw.bb34.i: ; preds = %entry | ||
| br label %Perl_sv_reftype.exit | ||
|
|
||
| Perl_sv_reftype.exit: ; preds = %sw.bb34.i, %sw.bb4, %entry | ||
| %retval.0.i = phi ptr [ null, %sw.bb34.i ], [ null, %sw.bb4 ], [ %.str.54.3682, %entry ] | ||
| %call17 = tail call fastcc i64 null(ptr null, i32 0) | ||
| tail call void (ptr, ...) null(ptr null, ptr %retval.0.i, ptr null) | ||
| unreachable | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the command line option isn't explicitly set,
CSRFirstTimeCostwill be the default value of 0 so this max will always returnTRI->getCSRFirstUseCost()There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If someone goes in and changes the default value, wouldn't we want the comparison to occur without having to change the code here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess, but I'm not sure why the default of the
CSRFirstTimeCostwould be changed instead of the base class implementation ofTargetRegisterInfo::getCSRFirstUseCost().We can take the code how you have it.