aboutsummaryrefslogtreecommitdiff
path: root/backend/lib
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-11 20:16:09 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-11 20:16:09 +0800
commitcd2e88b9618ba7c2f6fcfac901e81f4a302a34c9 (patch)
treedffd656415955f1cc7431e790bec6b4e3c7b58ef /backend/lib
parentd53149886f39884efe3da5cae67653f9f86132d6 (diff)
downloadrcc-project-cd2e88b9618ba7c2f6fcfac901e81f4a302a34c9.tar.gz
rcc-project-cd2e88b9618ba7c2f6fcfac901e81f4a302a34c9.tar.xz
[CodeGen] Remove redundant numeric call-site IDs
Diffstat (limited to 'backend/lib')
-rw-r--r--backend/lib/CodeGen/TargetCallLowering.cpp19
-rw-r--r--backend/lib/Target/RISCV/RISCV.rccdesc4
-rw-r--r--backend/lib/Target/RISCV/RISCVCallLowering.cpp10
-rw-r--r--backend/lib/Target/RISCV/RISCVCodeGen.cpp1
-rw-r--r--backend/lib/Target/RISCV/RISCVPseudoExpansion.cpp10
5 files changed, 14 insertions, 30 deletions
diff --git a/backend/lib/CodeGen/TargetCallLowering.cpp b/backend/lib/CodeGen/TargetCallLowering.cpp
index d6a14b7..adbe406 100644
--- a/backend/lib/CodeGen/TargetCallLowering.cpp
+++ b/backend/lib/CodeGen/TargetCallLowering.cpp
@@ -246,28 +246,27 @@ Expected<CallLoweringPlan> CallLoweringPlan::create(CallLoweringPlanDesc Descrip
switch (Description.Kind) {
case CallLoweringPlanKind::FormalArguments:
if (!Description.ReturnAssignments.empty() || Description.Callee || Description.PreservedMask ||
- Description.CallSiteID != 0 || Description.TailDecision != TailCallKind::NotTail ||
- Description.CallFrame.EmitSetup || Description.CallFrame.ReusesIncomingArea ||
- !Description.ByValCopies.empty() || !Description.TailRejectionReason.empty()) {
+ Description.TailDecision != TailCallKind::NotTail || Description.CallFrame.EmitSetup ||
+ Description.CallFrame.ReusesIncomingArea || !Description.ByValCopies.empty() ||
+ !Description.TailRejectionReason.empty()) {
return makeUnexpected(ErrorCode::InvalidArgument,
"formal-argument plan contains call or return state");
}
break;
case CallLoweringPlanKind::Return:
if (!Description.ArgumentAssignments.empty() || Description.Callee ||
- Description.PreservedMask || Description.CallSiteID != 0 ||
- Description.TailDecision != TailCallKind::NotTail || Description.CallFrame.EmitSetup ||
- Description.CallFrame.ReusesIncomingArea || !Description.ByValCopies.empty() ||
- Description.VarArgs.IsVariadic || !Description.TailRejectionReason.empty()) {
+ Description.PreservedMask || Description.TailDecision != TailCallKind::NotTail ||
+ Description.CallFrame.EmitSetup || Description.CallFrame.ReusesIncomingArea ||
+ !Description.ByValCopies.empty() || Description.VarArgs.IsVariadic ||
+ !Description.TailRejectionReason.empty()) {
return makeUnexpected(ErrorCode::InvalidArgument,
"return plan contains formal-argument or call state");
}
break;
case CallLoweringPlanKind::Call:
- if (!Description.Callee || !Description.Callee->isValid() || !Description.PreservedMask ||
- Description.CallSiteID == 0) {
+ if (!Description.Callee || !Description.Callee->isValid() || !Description.PreservedMask) {
return makeUnexpected(ErrorCode::InvalidArgument,
- "call plan requires a callee, call-site ID, and preserved mask");
+ "call plan requires a callee and preserved mask");
}
if (Description.TailDecision == TailCallKind::NotTail) {
if (!Description.CallFrame.EmitSetup || Description.CallFrame.ReusesIncomingArea) {
diff --git a/backend/lib/Target/RISCV/RISCV.rccdesc b/backend/lib/Target/RISCV/RISCV.rccdesc
index ea3a775..ad79073 100644
--- a/backend/lib/Target/RISCV/RISCV.rccdesc
+++ b/backend/lib/Target/RISCV/RISCV.rccdesc
@@ -3375,7 +3375,6 @@ instructions:
name: PseudoCALL
operands:
- { kinds: [global_symbol, external_symbol, register], role: use, allowed_target_flags: 1 }
- - { kinds: [immediate, integer_immediate] }
- { kinds: [register_mask] }
num_explicit_defs: 0
implicit_defs: [{ register: X1 }]
@@ -3389,7 +3388,6 @@ instructions:
name: PseudoTAIL
operands:
- { kinds: [global_symbol, external_symbol, register], role: use, allowed_target_flags: 1 }
- - { kinds: [immediate, integer_immediate] }
- { kinds: [register_mask] }
num_explicit_defs: 0
allow_extra_implicit_operands: true
@@ -3416,7 +3414,6 @@ instructions:
- { kinds: [register], role: def, register_class: GPR, register_bank: GPR, name: RD }
- { kinds: [register], role: use, register_class: GPR, register_bank: GPR, name: RS1 }
- { kinds: [immediate, mc_symbol], immediate_predicate: SIMM12, allowed_target_flags: 4, name: IMM }
- - { kinds: [immediate, integer_immediate] }
- { kinds: [register_mask] }
num_explicit_defs: 1
allow_extra_implicit_operands: true
@@ -3434,7 +3431,6 @@ instructions:
- { kinds: [register], role: def, register_class: GPR, register_bank: GPR, name: RD }
- { kinds: [register], role: use, register_class: GPR, register_bank: GPR, name: RS1 }
- { kinds: [immediate, mc_symbol], immediate_predicate: SIMM12, allowed_target_flags: 4, name: IMM }
- - { kinds: [immediate, integer_immediate] }
- { kinds: [register_mask] }
num_explicit_defs: 1
allow_extra_implicit_operands: true
diff --git a/backend/lib/Target/RISCV/RISCVCallLowering.cpp b/backend/lib/Target/RISCV/RISCVCallLowering.cpp
index 3a5805a..308ba05 100644
--- a/backend/lib/Target/RISCV/RISCVCallLowering.cpp
+++ b/backend/lib/Target/RISCV/RISCVCallLowering.cpp
@@ -574,10 +574,8 @@ Expected<CallLoweringPlan> RISCVCallLowering::planCall(const CallLoweringRequest
return makeUnexpected(ErrorCode::InvalidArgument,
"call request has an invalid fixed/variadic argument boundary");
}
- if (Request.CallSiteID == 0 || !Request.Callee.isValid()) {
- return makeUnexpected(ErrorCode::InvalidArgument,
- "call request requires a valid callee and nonzero call-site ID");
- }
+ if (!Request.Callee.isValid())
+ return makeUnexpected(ErrorCode::InvalidArgument, "call request requires a valid callee");
if (hasStructReturn(Request.Arguments) &&
(Request.Arguments.empty() ||
!Request.Arguments.front().Flags.has(ABIValueFlag::StructReturn))) {
@@ -704,7 +702,6 @@ Expected<CallLoweringPlan> RISCVCallLowering::planCall(const CallLoweringRequest
Plan.ByValCopies = std::move(ByValCopies);
Plan.PreservedMask = createCallPreservedMask();
Plan.Callee = std::move(EffectiveCallee);
- Plan.CallSiteID = Request.CallSiteID;
Plan.TailDecision = Decision;
Plan.TailRejectionReason = std::move(RejectionReason);
return CallLoweringPlan::create(std::move(Plan));
@@ -1337,9 +1334,6 @@ emitOutgoingArguments(MachineIRBuilder &Builder, const CallLoweringPlan &Plan,
auto Callee = addCallTarget(*Instruction, *Plan.callee());
if (!Callee)
return std::unexpected(Callee.error());
- auto CallSite = addUnsignedImmediate(*Instruction, Plan.callSiteID());
- if (!CallSite)
- return std::unexpected(CallSite.error());
auto Mask = Instruction->addRegisterMask(Plan.preservedMask());
if (!Mask)
return std::unexpected(Mask.error());
diff --git a/backend/lib/Target/RISCV/RISCVCodeGen.cpp b/backend/lib/Target/RISCV/RISCVCodeGen.cpp
index c9d14af..bd4e20c 100644
--- a/backend/lib/Target/RISCV/RISCVCodeGen.cpp
+++ b/backend/lib/Target/RISCV/RISCVCodeGen.cpp
@@ -1511,7 +1511,6 @@ void eraseDeadArtifacts(std::span<MachineInstr *const> Candidates,
Request.Arguments = {Value(*Left, 0), Value(*Right, 1)};
Request.Results = {Value(*Destination, 0)};
Request.FixedArgumentCount = Request.Arguments.size();
- Request.CallSiteID = Instruction.stableID().value();
MachineIRBuilder Builder(Function, Target);
auto Point = Builder.setInsertPointBefore(Instruction);
diff --git a/backend/lib/Target/RISCV/RISCVPseudoExpansion.cpp b/backend/lib/Target/RISCV/RISCVPseudoExpansion.cpp
index 8a309e0..ae5e51d 100644
--- a/backend/lib/Target/RISCV/RISCVPseudoExpansion.cpp
+++ b/backend/lib/Target/RISCV/RISCVPseudoExpansion.cpp
@@ -338,9 +338,8 @@ copyRegisters(const MachineInstr &Instruction) {
const TargetDescription &Target, bool IsTail) {
MachineBasicBlock *Block = Instruction.parent();
const MachineOperand *Callee = Instruction.operandAt(0);
- const MachineOperand *CallSite = Instruction.operandAt(1);
- const MachineOperand *Mask = Instruction.operandAt(2);
- if (Block == nullptr || Callee == nullptr || CallSite == nullptr || Mask == nullptr ||
+ const MachineOperand *Mask = Instruction.operandAt(1);
+ if (Block == nullptr || Callee == nullptr || Mask == nullptr ||
Mask->kind() != MachineOperand::Kind::RegisterMask) {
return makeUnexpected(ErrorCode::VerificationError,
"RISC-V call pseudo has malformed explicit operands");
@@ -409,14 +408,11 @@ copyRegisters(const MachineInstr &Instruction) {
Anchor ? LowPending->addMCSymbol(*Anchor, 0, PCRelativeLowFlag) : LowPending->addImmediate(0);
if (!LowOffset)
return std::unexpected(LowOffset.error());
- auto LowCallSite = LowPending->addOperand(CallSite->cloneDetached());
- if (!LowCallSite)
- return std::unexpected(LowCallSite.error());
auto LowMask = LowPending->addOperand(Mask->cloneDetached());
if (!LowMask)
return std::unexpected(LowMask.error());
auto Implicit = copyExtraImplicitOperands(
- Instruction, 3, *LowPending, IsTail ? std::nullopt : std::optional<PhysicalRegister>{*Link},
+ Instruction, 2, *LowPending, IsTail ? std::nullopt : std::optional<PhysicalRegister>{*Link},
std::nullopt);
if (!Implicit)
return std::unexpected(Implicit.error());