diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2024-07-27 23:34:35 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2024-10-23 18:26:01 +0000 |
commit | 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583 (patch) | |
tree | 6cf5ab1f05330c6773b1f3f64799d56a9c7a1faa /contrib/llvm-project/llvm/lib/Target/CSKY | |
parent | 6b9f7133aba44189d9625c352bc2c2a59baf18ef (diff) | |
parent | ac9a064cb179f3425b310fa2847f8764ac970a4d (diff) |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Target/CSKY')
15 files changed, 45 insertions, 52 deletions
diff --git a/contrib/llvm-project/llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp b/contrib/llvm-project/llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp index 4711e58bbed6..30bd3dcefa60 100644 --- a/contrib/llvm-project/llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp +++ b/contrib/llvm-project/llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp @@ -400,7 +400,7 @@ public: /// Gets location of the last token of this operand. SMLoc getEndLoc() const override { return EndLoc; } - unsigned getReg() const override { + MCRegister getReg() const override { assert(Kind == Register && "Invalid type access!"); return Reg.RegNum; } diff --git a/contrib/llvm-project/llvm/lib/Target/CSKY/CSKY.h b/contrib/llvm-project/llvm/lib/Target/CSKY/CSKY.h index 7ca630c9abaa..21ebf13f2064 100644 --- a/contrib/llvm-project/llvm/lib/Target/CSKY/CSKY.h +++ b/contrib/llvm-project/llvm/lib/Target/CSKY/CSKY.h @@ -27,7 +27,7 @@ FunctionPass *createCSKYISelDag(CSKYTargetMachine &TM, FunctionPass *createCSKYConstantIslandPass(); void initializeCSKYConstantIslandsPass(PassRegistry &); -void initializeCSKYDAGToDAGISelPass(PassRegistry &); +void initializeCSKYDAGToDAGISelLegacyPass(PassRegistry &); } // namespace llvm diff --git a/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYConstantIslandPass.cpp b/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYConstantIslandPass.cpp index 4acdd571f6c9..97bdd4c45a8c 100644 --- a/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYConstantIslandPass.cpp +++ b/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYConstantIslandPass.cpp @@ -218,7 +218,7 @@ public: bool runOnMachineFunction(MachineFunction &F) override; void getAnalysisUsage(AnalysisUsage &AU) const override { - AU.addRequired<MachineDominatorTree>(); + AU.addRequired<MachineDominatorTreeWrapperPass>(); MachineFunctionPass::getAnalysisUsage(AU); } diff --git a/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYISelDAGToDAG.cpp b/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYISelDAGToDAG.cpp index c0c23a45d155..22da80b3eddc 100644 --- a/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYISelDAGToDAG.cpp +++ b/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYISelDAGToDAG.cpp @@ -28,10 +28,8 @@ class CSKYDAGToDAGISel : public SelectionDAGISel { const CSKYSubtarget *Subtarget; public: - static char ID; - explicit CSKYDAGToDAGISel(CSKYTargetMachine &TM, CodeGenOptLevel OptLevel) - : SelectionDAGISel(ID, TM, OptLevel) {} + : SelectionDAGISel(TM, OptLevel) {} bool runOnMachineFunction(MachineFunction &MF) override { // Reset the subtarget each time through. @@ -54,11 +52,20 @@ public: #include "CSKYGenDAGISel.inc" }; + +class CSKYDAGToDAGISelLegacy : public SelectionDAGISelLegacy { +public: + static char ID; + explicit CSKYDAGToDAGISelLegacy(CSKYTargetMachine &TM, + CodeGenOptLevel OptLevel) + : SelectionDAGISelLegacy( + ID, std::make_unique<CSKYDAGToDAGISel>(TM, OptLevel)) {} +}; } // namespace -char CSKYDAGToDAGISel::ID = 0; +char CSKYDAGToDAGISelLegacy::ID = 0; -INITIALIZE_PASS(CSKYDAGToDAGISel, DEBUG_TYPE, PASS_NAME, false, false) +INITIALIZE_PASS(CSKYDAGToDAGISelLegacy, DEBUG_TYPE, PASS_NAME, false, false) void CSKYDAGToDAGISel::Select(SDNode *N) { // If we have a custom node, we have already selected @@ -401,5 +408,5 @@ bool CSKYDAGToDAGISel::SelectInlineAsmMemoryOperand( FunctionPass *llvm::createCSKYISelDag(CSKYTargetMachine &TM, CodeGenOptLevel OptLevel) { - return new CSKYDAGToDAGISel(TM, OptLevel); + return new CSKYDAGToDAGISelLegacy(TM, OptLevel); } diff --git a/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYISelLowering.cpp b/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYISelLowering.cpp index 90f70b83a02d..c3fc9f9ead5e 100644 --- a/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYISelLowering.cpp +++ b/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYISelLowering.cpp @@ -556,7 +556,7 @@ SDValue CSKYTargetLowering::LowerCall(CallLoweringInfo &CLI, Chain = DAG.getMemcpy(Chain, DL, FIPtr, Arg, SizeNode, Alignment, /*IsVolatile=*/false, - /*AlwaysInline=*/false, IsTailCall, + /*AlwaysInline=*/false, /*CI=*/nullptr, IsTailCall, MachinePointerInfo(), MachinePointerInfo()); ByValArgs.push_back(FIPtr); } @@ -649,8 +649,7 @@ SDValue CSKYTargetLowering::LowerCall(CallLoweringInfo &CLI, if (GlobalAddressSDNode *S = dyn_cast<GlobalAddressSDNode>(Callee)) { const GlobalValue *GV = S->getGlobal(); - bool IsLocal = - getTargetMachine().shouldAssumeDSOLocal(*GV->getParent(), GV); + bool IsLocal = getTargetMachine().shouldAssumeDSOLocal(GV); if (isPositionIndependent() || !Subtarget.has2E3()) { IsRegCall = true; @@ -662,8 +661,7 @@ SDValue CSKYTargetLowering::LowerCall(CallLoweringInfo &CLI, cast<GlobalAddressSDNode>(Callee), Ty, DAG, CSKYII::MO_None)); } } else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(Callee)) { - bool IsLocal = getTargetMachine().shouldAssumeDSOLocal( - *MF.getFunction().getParent(), nullptr); + bool IsLocal = getTargetMachine().shouldAssumeDSOLocal(nullptr); if (isPositionIndependent() || !Subtarget.has2E3()) { IsRegCall = true; @@ -1153,7 +1151,7 @@ SDValue CSKYTargetLowering::LowerGlobalAddress(SDValue Op, int64_t Offset = N->getOffset(); const GlobalValue *GV = N->getGlobal(); - bool IsLocal = getTargetMachine().shouldAssumeDSOLocal(*GV->getParent(), GV); + bool IsLocal = getTargetMachine().shouldAssumeDSOLocal(GV); SDValue Addr = getAddr<GlobalAddressSDNode, false>(N, DAG, IsLocal); // In order to maximise the opportunity for common subexpression elimination, diff --git a/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYInstrInfo.cpp b/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYInstrInfo.cpp index e5581bcdc397..6baca84ab3d0 100644 --- a/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYInstrInfo.cpp +++ b/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYInstrInfo.cpp @@ -330,7 +330,7 @@ Register CSKYInstrInfo::movImm(MachineBasicBlock &MBB, return DstReg; } -unsigned CSKYInstrInfo::isLoadFromStackSlot(const MachineInstr &MI, +Register CSKYInstrInfo::isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) const { switch (MI.getOpcode()) { default: @@ -360,7 +360,7 @@ unsigned CSKYInstrInfo::isLoadFromStackSlot(const MachineInstr &MI, return 0; } -unsigned CSKYInstrInfo::isStoreToStackSlot(const MachineInstr &MI, +Register CSKYInstrInfo::isStoreToStackSlot(const MachineInstr &MI, int &FrameIndex) const { switch (MI.getOpcode()) { default: diff --git a/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYInstrInfo.h b/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYInstrInfo.h index dbb69a7a8798..4e3866b1188c 100644 --- a/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYInstrInfo.h +++ b/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYInstrInfo.h @@ -35,9 +35,9 @@ protected: public: explicit CSKYInstrInfo(CSKYSubtarget &STI); - unsigned isLoadFromStackSlot(const MachineInstr &MI, + Register isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) const override; - unsigned isStoreToStackSlot(const MachineInstr &MI, + Register isStoreToStackSlot(const MachineInstr &MI, int &FrameIndex) const override; void storeRegToStackSlot(MachineBasicBlock &MBB, diff --git a/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYTargetMachine.cpp b/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYTargetMachine.cpp index 8c268dc31614..a756061e307a 100644 --- a/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYTargetMachine.cpp +++ b/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYTargetMachine.cpp @@ -30,7 +30,7 @@ extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeCSKYTarget() { PassRegistry *Registry = PassRegistry::getPassRegistry(); initializeCSKYConstantIslandsPass(*Registry); - initializeCSKYDAGToDAGISelPass(*Registry); + initializeCSKYDAGToDAGISelLegacyPass(*Registry); } static std::string computeDataLayout(const Triple &TT) { @@ -118,7 +118,7 @@ TargetPassConfig *CSKYTargetMachine::createPassConfig(PassManagerBase &PM) { } void CSKYPassConfig::addIRPasses() { - addPass(createAtomicExpandPass()); + addPass(createAtomicExpandLegacyPass()); TargetPassConfig::addIRPasses(); } diff --git a/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.cpp b/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.cpp index bceb41a26745..dd06971e1cf9 100644 --- a/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.cpp +++ b/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.cpp @@ -9,7 +9,6 @@ #include "CSKYAsmBackend.h" #include "MCTargetDesc/CSKYMCTargetDesc.h" #include "llvm/ADT/DenseMap.h" -#include "llvm/MC/MCAsmLayout.h" #include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCFixupKindInfo.h" @@ -171,10 +170,10 @@ static uint64_t adjustFixupValue(const MCFixup &Fixup, uint64_t Value, } } -bool CSKYAsmBackend::fixupNeedsRelaxationAdvanced(const MCFixup &Fixup, +bool CSKYAsmBackend::fixupNeedsRelaxationAdvanced(const MCAssembler &Asm, + const MCFixup &Fixup, bool Resolved, uint64_t Value, const MCRelaxableFragment *DF, - const MCAsmLayout &Layout, const bool WasForced) const { // Return true if the symbol is actually unresolved. // Resolved could be always false when shouldForceRelocation return true. @@ -284,9 +283,8 @@ bool CSKYAsmBackend::shouldForceRelocation(const MCAssembler &Asm, return false; } -bool CSKYAsmBackend::fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value, - const MCRelaxableFragment *DF, - const MCAsmLayout &Layout) const { +bool CSKYAsmBackend::fixupNeedsRelaxation(const MCFixup &Fixup, + uint64_t Value) const { return false; } diff --git a/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.h b/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.h index 5fa0c8c01185..4b659f401d25 100644 --- a/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.h +++ b/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.h @@ -33,9 +33,8 @@ public: const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override; - bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value, - const MCRelaxableFragment *DF, - const MCAsmLayout &Layout) const override; + bool fixupNeedsRelaxation(const MCFixup &Fixup, + uint64_t Value) const override; void relaxInstruction(MCInst &Inst, const MCSubtargetInfo &STI) const override; @@ -43,10 +42,10 @@ public: bool mayNeedRelaxation(const MCInst &Inst, const MCSubtargetInfo &STI) const override; - bool fixupNeedsRelaxationAdvanced(const MCFixup &Fixup, bool Resolved, + bool fixupNeedsRelaxationAdvanced(const MCAssembler &Asm, + const MCFixup &Fixup, bool Resolved, uint64_t Value, const MCRelaxableFragment *DF, - const MCAsmLayout &Layout, const bool WasForced) const override; bool writeNopData(raw_ostream &OS, uint64_t Count, diff --git a/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFStreamer.cpp b/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFStreamer.cpp index 059c3c143c31..a77e3be5eba6 100644 --- a/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFStreamer.cpp +++ b/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFStreamer.cpp @@ -31,10 +31,10 @@ using namespace llvm; CSKYTargetELFStreamer::CSKYTargetELFStreamer(MCStreamer &S, const MCSubtargetInfo &STI) : CSKYTargetStreamer(S), CurrentVendor("csky") { - MCAssembler &MCA = getStreamer().getAssembler(); + ELFObjectWriter &W = getStreamer().getWriter(); const FeatureBitset &Features = STI.getFeatureBits(); - unsigned EFlags = MCA.getELFHeaderEFlags(); + unsigned EFlags = W.getELFHeaderEFlags(); EFlags |= ELF::EF_CSKY_ABIV2; @@ -62,7 +62,7 @@ CSKYTargetELFStreamer::CSKYTargetELFStreamer(MCStreamer &S, EFlags |= ELF::EF_CSKY_EFV1; - MCA.setELFHeaderEFlags(EFlags); + W.setELFHeaderEFlags(EFlags); } MCELFStreamer &CSKYTargetELFStreamer::getStreamer() { @@ -168,8 +168,7 @@ void CSKYELFStreamer::EmitMappingSymbol(StringRef Name) { State = (Name == "$t" ? EMS_Text : EMS_Data); - auto *Symbol = cast<MCSymbolELF>(getContext().getOrCreateSymbol( - Name + "." + Twine(MappingSymbolCounter++))); + auto *Symbol = cast<MCSymbolELF>(getContext().createLocalSymbol(Name)); emitLabel(Symbol); Symbol->setType(ELF::STT_NOTYPE); diff --git a/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFStreamer.h b/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFStreamer.h index b7931e922279..1392fc9b5cca 100644 --- a/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFStreamer.h +++ b/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFStreamer.h @@ -99,8 +99,6 @@ public: }; class CSKYELFStreamer : public MCELFStreamer { - int64_t MappingSymbolCounter = 0; - void EmitMappingSymbol(StringRef Name); public: @@ -138,7 +136,6 @@ public: MCELFStreamer::emitValueImpl(Value, Size, Loc); } void reset() override { - MappingSymbolCounter = 0; State = EMS_None; MCELFStreamer::reset(); } diff --git a/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.cpp b/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.cpp index b9989822dc36..d96b700eaaa0 100644 --- a/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.cpp +++ b/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.cpp @@ -109,10 +109,9 @@ void CSKYMCExpr::fixELFSymbolsInTLSFixups(MCAssembler &Asm) const { fixELFSymbolsInTLSFixupsImpl(getSubExpr(), Asm); } -bool CSKYMCExpr::evaluateAsRelocatableImpl(MCValue &Res, - const MCAsmLayout *Layout, +bool CSKYMCExpr::evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm, const MCFixup *Fixup) const { - if (!getSubExpr()->evaluateAsRelocatable(Res, Layout, Fixup)) + if (!getSubExpr()->evaluateAsRelocatable(Res, Asm, Fixup)) return false; // Some custom fixup types are not valid with symbol difference expressions diff --git a/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.h b/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.h index 9e5b4ca7d9bb..73aebc72869c 100644 --- a/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.h +++ b/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.h @@ -55,7 +55,7 @@ public: void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override; - bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout, + bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm, const MCFixup *Fixup) const override; void visitUsedExpr(MCStreamer &Streamer) const override; diff --git a/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCTargetDesc.cpp b/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCTargetDesc.cpp index 64f01cd1c9fa..bb122f683644 100644 --- a/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCTargetDesc.cpp +++ b/contrib/llvm-project/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCTargetDesc.cpp @@ -88,20 +88,16 @@ createCSKYObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI) { static MCStreamer *createELFStreamer(const Triple &T, MCContext &Ctx, std::unique_ptr<MCAsmBackend> &&MAB, std::unique_ptr<MCObjectWriter> &&OW, - std::unique_ptr<MCCodeEmitter> &&Emitter, - bool RelaxAll) { + std::unique_ptr<MCCodeEmitter> &&Emitter) { CSKYELFStreamer *S = new CSKYELFStreamer(Ctx, std::move(MAB), std::move(OW), std::move(Emitter)); - if (RelaxAll) - S->getAssembler().setRelaxAll(true); return S; } -static MCTargetStreamer *createCSKYAsmTargetStreamer(MCStreamer &S, - formatted_raw_ostream &OS, - MCInstPrinter *InstPrinter, - bool isVerboseAsm) { +static MCTargetStreamer * +createCSKYAsmTargetStreamer(MCStreamer &S, formatted_raw_ostream &OS, + MCInstPrinter *InstPrinter) { return new CSKYTargetAsmStreamer(S, OS); } |