Skip to content

Commit 0ef44d5

Browse files
committed
[𝘀𝗽𝗿] changes to main this commit is based on
Created using spr 1.3.5-bogner [skip ci]
1 parent 009971a commit 0ef44d5

File tree

10 files changed

+18
-57
lines changed

10 files changed

+18
-57
lines changed

llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -591,16 +591,7 @@ struct RISCVOperand final : public MCParsedAsmOperand {
591591
(VK == RISCVMCExpr::VK_CALL || VK == RISCVMCExpr::VK_CALL_PLT);
592592
}
593593

594-
bool isPseudoQCJumpSymbol() const {
595-
int64_t Imm;
596-
// Must be of 'immediate' type but not a constant.
597-
if (!isImm() || evaluateConstantImm(getImm(), Imm))
598-
return false;
599-
600-
RISCVMCExpr::Specifier VK = RISCVMCExpr::VK_None;
601-
return RISCVAsmParser::classifySymbolRef(getImm(), VK) &&
602-
VK == RISCVMCExpr::VK_QC_E_JUMP_PLT;
603-
}
594+
bool isPseudoQCJumpSymbol() const { return isBareSymbol(); }
604595

605596
bool isPseudoJumpSymbol() const {
606597
int64_t Imm;
@@ -2157,25 +2148,10 @@ ParseStatus RISCVAsmParser::parsePseudoQCJumpSymbol(OperandVector &Operands) {
21572148

21582149
std::string Identifier(getTok().getIdentifier());
21592150
SMLoc E = getTok().getEndLoc();
2160-
2161-
if (getLexer().peekTok().is(AsmToken::At)) {
2162-
Lex();
2163-
Lex();
2164-
SMLoc PLTLoc = getLoc();
2165-
StringRef PLT;
2166-
E = getTok().getEndLoc();
2167-
if (getParser().parseIdentifier(PLT) || PLT != "plt")
2168-
return Error(PLTLoc,
2169-
"'@plt' is the only valid operand for this instruction");
2170-
} else {
2171-
Lex();
2172-
}
2173-
2174-
RISCVMCExpr::Specifier Kind = RISCVMCExpr::VK_QC_E_JUMP_PLT;
2151+
Lex();
21752152

21762153
MCSymbol *Sym = getContext().getOrCreateSymbol(Identifier);
21772154
Res = MCSymbolRefExpr::create(Sym, getContext());
2178-
Res = RISCVMCExpr::create(Res, Kind, getContext());
21792155
Operands.push_back(RISCVOperand::createImm(Res, S, E, isRV64()));
21802156
return ParseStatus::Success;
21812157
}

llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ RISCVAsmBackend::getFixupKindInfo(MCFixupKind Kind) const {
9595
{"fixup_riscv_qc_e_branch", 0, 48, MCFixupKindInfo::FKF_IsPCRel},
9696
{"fixup_riscv_qc_e_32", 16, 32, 0},
9797
{"fixup_riscv_qc_abs20_u", 12, 20, 0},
98-
{"fixup_riscv_qc_e_jump_plt", 0, 48, MCFixupKindInfo::FKF_IsPCRel},
98+
{"fixup_riscv_qc_e_jump", 0, 48, MCFixupKindInfo::FKF_IsPCRel},
9999
};
100100
static_assert((std::size(Infos)) == RISCV::NumTargetFixupKinds,
101101
"Not all fixup kinds added to Infos array");
@@ -576,7 +576,7 @@ static uint64_t adjustFixupValue(const MCFixup &Fixup, uint64_t Value,
576576
Value = (Bit19 << 31) | (Bit14_0 << 16) | (Bit18_15 << 12);
577577
return Value;
578578
}
579-
case RISCV::fixup_riscv_qc_e_jump_plt: {
579+
case RISCV::fixup_riscv_qc_e_jump: {
580580
if (!isInt<32>(Value))
581581
Ctx.reportError(Fixup.getLoc(), "fixup value out of range");
582582
if (Value & 0x1)

llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFObjectWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ unsigned RISCVELFObjectWriter::getRelocType(MCContext &Ctx,
119119
return ELF::R_RISCV_CALL_PLT;
120120
case RISCV::fixup_riscv_qc_e_branch:
121121
return ELF::R_RISCV_QC_E_BRANCH;
122-
case RISCV::fixup_riscv_qc_e_jump_plt:
122+
case RISCV::fixup_riscv_qc_e_jump:
123123
return ELF::R_RISCV_QC_E_JUMP_PLT;
124124
}
125125
}

llvm/lib/Target/RISCV/MCTargetDesc/RISCVFixupKinds.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ enum Fixups {
8585
// 20-bit fixup for symbol references in the 32-bit qc.li instruction
8686
fixup_riscv_qc_abs20_u,
8787
// 32-bit fixup for symbol references in the 48-bit qc.j/qc.jal instructions
88-
fixup_riscv_qc_e_jump_plt,
88+
fixup_riscv_qc_e_jump,
8989

9090
// Used as a sentinel, must be the last
9191
fixup_riscv_invalid,

llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,9 +685,6 @@ uint64_t RISCVMCCodeEmitter::getImmOpValue(const MCInst &MI, unsigned OpNo,
685685
case RISCVMCExpr::VK_QC_ABS20:
686686
FixupKind = RISCV::fixup_riscv_qc_abs20_u;
687687
break;
688-
case RISCVMCExpr::VK_QC_E_JUMP_PLT:
689-
FixupKind = RISCV::fixup_riscv_qc_e_jump_plt;
690-
break;
691688
}
692689
} else if (Kind == MCExpr::SymbolRef || Kind == MCExpr::Binary) {
693690
// FIXME: Sub kind binary exprs have chance of underflow.
@@ -705,6 +702,8 @@ uint64_t RISCVMCCodeEmitter::getImmOpValue(const MCInst &MI, unsigned OpNo,
705702
FixupKind = RISCV::fixup_riscv_qc_e_branch;
706703
} else if (MIFrm == RISCVII::InstFormatQC_EAI) {
707704
FixupKind = RISCV::fixup_riscv_qc_e_32;
705+
} else if (MIFrm == RISCVII::InstFormatQC_EJ) {
706+
FixupKind = RISCV::fixup_riscv_qc_e_jump;
708707
}
709708
}
710709

llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ const RISCVMCExpr *RISCVMCExpr::create(const MCExpr *Expr, Specifier S,
3434

3535
void RISCVMCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const {
3636
Specifier S = getSpecifier();
37-
bool HasVariant = ((S != VK_None) && (S != VK_CALL) && (S != VK_CALL_PLT) &&
38-
(S != VK_QC_E_JUMP_PLT));
37+
bool HasVariant = ((S != VK_None) && (S != VK_CALL) && (S != VK_CALL_PLT));
3938

4039
if (HasVariant)
4140
OS << '%' << getSpecifierName(S) << '(';
@@ -168,8 +167,6 @@ StringRef RISCVMCExpr::getSpecifierName(Specifier S) {
168167
return "pltpcrel";
169168
case VK_QC_ABS20:
170169
return "qc.abs20";
171-
case VK_QC_E_JUMP_PLT:
172-
return "qc_e_jump_plt";
173170
}
174171
llvm_unreachable("Invalid ELF symbol kind");
175172
}

llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ class RISCVMCExpr : public MCTargetExpr {
4444
VK_TLSDESC_ADD_LO,
4545
VK_TLSDESC_CALL,
4646
VK_QC_ABS20,
47-
VK_QC_E_JUMP_PLT
4847
};
4948

5049
private:

llvm/lib/Target/RISCV/RISCVInstrInfoXqci.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def PseudoQCJumpSymbol : AsmOperandClass {
158158
let RenderMethod = "addImmOperands";
159159
let DiagnosticType = "InvalidPseudoQCJumpSymbol";
160160
let DiagnosticString = "operand must be a valid jump target";
161-
let ParserMethod = "parsePseudoQCJumpSymbol";
161+
let ParserMethod = "parseBareSymbol";
162162
}
163163

164164
def pseudo_qc_jump_symbol : Operand<XLenVT> {

llvm/test/MC/RISCV/xqcilb-invalid.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ qc.e.jal 2147483649
2323
# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcilb' (Qualcomm uC Long Branch Extension)
2424
qc.e.jal 2147483640
2525

26-
# CHECK: :[[@LINE+1]]:12: error: '@plt' is the only valid operand for this instruction
27-
qc.e.j foo@rlt
26+
# CHECK: :[[@LINE+1]]:11: error: unexpected token
27+
qc.e.j foo@plt

llvm/test/MC/RISCV/xqcilb-relocations.s

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,42 +13,32 @@
1313
qc.e.j foo
1414
# RELOC: R_RISCV_CUSTOM195 foo 0x0
1515
# INSTR: qc.e.j foo
16-
# FIXUP: fixup A - offset: 0, value: foo, kind: fixup_riscv_qc_e_jump_plt
17-
18-
qc.e.j foo@plt
19-
# RELOC: R_RISCV_CUSTOM195 foo 0x0
20-
# INSTR: qc.e.j foo
21-
# FIXUP: fixup A - offset: 0, value: foo, kind: fixup_riscv_qc_e_jump_plt
22-
23-
qc.e.jal foo@plt
24-
# RELOC: R_RISCV_CUSTOM195 foo 0x0
25-
# INSTR: qc.e.jal foo
26-
# FIXUP: fixup A - offset: 0, value: foo, kind: fixup_riscv_qc_e_jump_plt
16+
# FIXUP: fixup A - offset: 0, value: foo, kind: fixup_riscv_qc_e_jump
2717

2818
qc.e.jal foo
2919
# RELOC: R_RISCV_CUSTOM195 foo 0x0
3020
# INSTR: qc.e.jal foo
31-
# FIXUP: fixup A - offset: 0, value: foo, kind: fixup_riscv_qc_e_jump_plt
21+
# FIXUP: fixup A - offset: 0, value: foo, kind: fixup_riscv_qc_e_jump
3222

3323
# Check that a label in a different section is handled similar to an undefined symbol
3424
qc.e.j .bar
3525
# RELOC: R_RISCV_CUSTOM195 .bar 0x0
3626
# INSTR: qc.e.j .bar
37-
# FIXUP: fixup A - offset: 0, value: .bar, kind: fixup_riscv_qc_e_jump_plt
27+
# FIXUP: fixup A - offset: 0, value: .bar, kind: fixup_riscv_qc_e_jump
3828

3929
qc.e.jal .bar
4030
# RELOC: R_RISCV_CUSTOM195 .bar 0x0
4131
# INSTR: qc.e.jal .bar
42-
# FIXUP: fixup A - offset: 0, value: .bar, kind: fixup_riscv_qc_e_jump_plt
32+
# FIXUP: fixup A - offset: 0, value: .bar, kind: fixup_riscv_qc_e_jump
4333

4434
# Check that jumps to a defined symbol are handled correctly
4535
qc.e.j .L1
4636
# INSTR:qc.e.j .L1
47-
# FIXUP: fixup A - offset: 0, value: .L1, kind: fixup_riscv_qc_e_jump_plt
37+
# FIXUP: fixup A - offset: 0, value: .L1, kind: fixup_riscv_qc_e_jump
4838

4939
qc.e.jal .L1
5040
# INSTR:qc.e.jal .L1
51-
# FIXUP: fixup A - offset: 0, value: .L1, kind: fixup_riscv_qc_e_jump_plt
41+
# FIXUP: fixup A - offset: 0, value: .L1, kind: fixup_riscv_qc_e_jump
5242

5343
.L1:
5444
ret

0 commit comments

Comments
 (0)