diff --git a/.github/workflows/build-ci-container.yml b/.github/workflows/build-ci-container.yml index ad3d50d4d578ad..6eb4e2e9b19d4d 100644 --- a/.github/workflows/build-ci-container.yml +++ b/.github/workflows/build-ci-container.yml @@ -21,7 +21,7 @@ on: jobs: build-ci-container: if: github.repository_owner == 'llvm' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 permissions: packages: write steps: diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 5936cdc46a902d..922d5b6d60a353 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -49,7 +49,7 @@ on: jobs: check-docs-build: name: "Test documentation build" - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 if: github.repository == 'llvm/llvm-project' steps: # Don't fetch before checking for file changes to force the file changes diff --git a/.github/workflows/issue-release-workflow.yml b/.github/workflows/issue-release-workflow.yml index b09ef6555fa901..45d461d4359008 100644 --- a/.github/workflows/issue-release-workflow.yml +++ b/.github/workflows/issue-release-workflow.yml @@ -32,7 +32,7 @@ env: jobs: backport-commits: name: Backport Commits - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 if: >- (github.repository == 'llvm/llvm-project') && !startswith(github.event.comment.body, '') && @@ -66,7 +66,7 @@ jobs: create-pull-request: name: Create Pull Request - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 if: >- (github.repository == 'llvm/llvm-project') && !startswith(github.event.comment.body, '') && diff --git a/.github/workflows/issue-subscriber.yml b/.github/workflows/issue-subscriber.yml index ef6cd0674e8085..4a37b62773b591 100644 --- a/.github/workflows/issue-subscriber.yml +++ b/.github/workflows/issue-subscriber.yml @@ -10,7 +10,7 @@ permissions: jobs: auto-subscribe: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 if: github.repository == 'llvm/llvm-project' steps: - name: Checkout Automation Script diff --git a/.github/workflows/libclang-abi-tests.yml b/.github/workflows/libclang-abi-tests.yml index 972d21c3bcedf9..06330f7829f9e9 100644 --- a/.github/workflows/libclang-abi-tests.yml +++ b/.github/workflows/libclang-abi-tests.yml @@ -27,7 +27,7 @@ concurrency: jobs: abi-dump-setup: if: github.repository_owner == 'llvm' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 outputs: BASELINE_REF: ${{ steps.vars.outputs.BASELINE_REF }} ABI_HEADERS: ${{ steps.vars.outputs.ABI_HEADERS }} @@ -83,7 +83,7 @@ jobs: abi-dump: if: github.repository_owner == 'llvm' needs: abi-dump-setup - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: matrix: name: @@ -137,7 +137,7 @@ jobs: abi-compare: if: github.repository_owner == 'llvm' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: - abi-dump-setup - abi-dump diff --git a/.github/workflows/libclang-python-tests.yml b/.github/workflows/libclang-python-tests.yml index 497f6ca5c55472..cce57eab1f9abb 100644 --- a/.github/workflows/libclang-python-tests.yml +++ b/.github/workflows/libclang-python-tests.yml @@ -43,5 +43,5 @@ jobs: projects: clang # There is an issue running on "windows-2019". # See https://github.com/llvm/llvm-project/issues/76601#issuecomment-1873049082. - os_list: '["ubuntu-latest"]' + os_list: '["ubuntu-22.04"]' python_version: ${{ matrix.python-version }} diff --git a/.github/workflows/libcxx-check-generated-files.yml b/.github/workflows/libcxx-check-generated-files.yml index 570055624b2a8d..96f3ddbbf75219 100644 --- a/.github/workflows/libcxx-check-generated-files.yml +++ b/.github/workflows/libcxx-check-generated-files.yml @@ -9,7 +9,7 @@ permissions: jobs: check_generated_files: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Fetch LLVM sources uses: actions/checkout@v4 diff --git a/.github/workflows/llvm-bugs.yml b/.github/workflows/llvm-bugs.yml index f592dd6ccd9033..2ccbe1dae2dba0 100644 --- a/.github/workflows/llvm-bugs.yml +++ b/.github/workflows/llvm-bugs.yml @@ -11,7 +11,7 @@ on: jobs: auto-subscribe: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 if: github.repository == 'llvm/llvm-project' steps: - uses: actions/setup-node@v3 diff --git a/.github/workflows/llvm-project-tests.yml b/.github/workflows/llvm-project-tests.yml index ef92cb46c257de..9f597b0ae3aa9f 100644 --- a/.github/workflows/llvm-project-tests.yml +++ b/.github/workflows/llvm-project-tests.yml @@ -14,7 +14,7 @@ on: required: false os_list: required: false - default: '["ubuntu-latest", "windows-2019", "macOS-13"]' + default: '["ubuntu-22.04", "windows-2019", "macOS-13"]' python_version: required: false type: string @@ -39,7 +39,7 @@ on: type: string # Use windows-2019 due to: # https://developercommunity.visualstudio.com/t/Prev-Issue---with-__assume-isnan-/1597317 - default: '["ubuntu-latest", "windows-2019", "macOS-13"]' + default: '["ubuntu-22.04", "windows-2019", "macOS-13"]' python_version: required: false @@ -66,7 +66,7 @@ jobs: fail-fast: false matrix: os: - - ubuntu-latest + - ubuntu-22.04 # Use windows-2019 due to: # https://developercommunity.visualstudio.com/t/Prev-Issue---with-__assume-isnan-/1597317 - windows-2019 diff --git a/.github/workflows/llvm-tests.yml b/.github/workflows/llvm-tests.yml index 94f63cccd2ce7f..e31bff7367741c 100644 --- a/.github/workflows/llvm-tests.yml +++ b/.github/workflows/llvm-tests.yml @@ -56,7 +56,7 @@ jobs: abi-dump-setup: #if: github.repository_owner == 'llvm' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 outputs: BASELINE_REF: ${{ steps.vars.outputs.BASELINE_REF }} ABI_HEADERS: ${{ steps.vars.outputs.ABI_HEADERS }} @@ -100,7 +100,7 @@ jobs: abi-dump: #if: github.repository_owner == 'llvm' needs: abi-dump-setup - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: matrix: name: @@ -170,7 +170,7 @@ jobs: abi-compare: #if: github.repository_owner == 'llvm' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: - abi-dump-setup - abi-dump diff --git a/.github/workflows/new-issues.yml b/.github/workflows/new-issues.yml index ed15fdb9fba6ef..5a204bf230d4ef 100644 --- a/.github/workflows/new-issues.yml +++ b/.github/workflows/new-issues.yml @@ -10,7 +10,7 @@ jobs: automate-issues-labels: permissions: issues: write - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 if: github.repository == 'llvm/llvm-project' steps: - uses: llvm/actions/issue-labeler@main diff --git a/.github/workflows/new-prs.yml b/.github/workflows/new-prs.yml index a60f82ce35d1f3..1713a72c2a5740 100644 --- a/.github/workflows/new-prs.yml +++ b/.github/workflows/new-prs.yml @@ -16,7 +16,7 @@ on: jobs: greeter: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 permissions: pull-requests: write # Only comment on PRs that have been opened for the first time, by someone @@ -56,7 +56,7 @@ jobs: automate-prs-labels: # Greet first so that only the author gets that notification. needs: greeter - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # Ignore PRs with more than 10 commits. Pull requests with a lot of # commits tend to be accidents usually when someone made a mistake while trying # to rebase. We want to ignore these pull requests to avoid excessive diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml index 3d0c23917bd403..852171e4cb92d0 100644 --- a/.github/workflows/pr-code-format.yml +++ b/.github/workflows/pr-code-format.yml @@ -9,7 +9,7 @@ permissions: jobs: code_formatter: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 if: github.repository == 'llvm/llvm-project' steps: - name: Fetch LLVM sources diff --git a/.github/workflows/pr-request-release-note.yml b/.github/workflows/pr-request-release-note.yml index 0fcb95f1fe2949..60f1cba91c2655 100644 --- a/.github/workflows/pr-request-release-note.yml +++ b/.github/workflows/pr-request-release-note.yml @@ -15,7 +15,7 @@ jobs: github.repository_owner == 'llvm' && startsWith(github.ref, 'refs/heads/release') - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: # We need to pull the script from the main branch, so that we ensure # we get the latest version of this script. diff --git a/.github/workflows/pr-subscriber.yml b/.github/workflows/pr-subscriber.yml index 3952493bb698fe..87fb322b7105f2 100644 --- a/.github/workflows/pr-subscriber.yml +++ b/.github/workflows/pr-subscriber.yml @@ -10,7 +10,7 @@ permissions: jobs: auto-subscribe: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 if: github.repository == 'llvm/llvm-project' steps: - name: Checkout Automation Script diff --git a/.github/workflows/release-documentation.yml b/.github/workflows/release-documentation.yml index 64572906988bab..b0f9b802e04dfc 100644 --- a/.github/workflows/release-documentation.yml +++ b/.github/workflows/release-documentation.yml @@ -29,7 +29,7 @@ on: jobs: release-documentation: name: Build and Upload Release Documentation - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 env: upload: ${{ inputs.upload && !contains(inputs.release-version, 'rc') }} steps: diff --git a/.github/workflows/release-doxygen.yml b/.github/workflows/release-doxygen.yml index 5e322849a1d093..e413f9c8817997 100644 --- a/.github/workflows/release-doxygen.yml +++ b/.github/workflows/release-doxygen.yml @@ -29,7 +29,7 @@ on: jobs: release-doxygen: name: Build and Upload Release Doxygen - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 permissions: contents: write env: diff --git a/.github/workflows/release-lit.yml b/.github/workflows/release-lit.yml index 0316ba406041d6..597115dbf7951a 100644 --- a/.github/workflows/release-lit.yml +++ b/.github/workflows/release-lit.yml @@ -21,7 +21,7 @@ on: jobs: release-lit: name: Release Lit - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout LLVM uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 diff --git a/.github/workflows/release-tasks.yml b/.github/workflows/release-tasks.yml index 53da8662b0203a..6e5036d530cc9f 100644 --- a/.github/workflows/release-tasks.yml +++ b/.github/workflows/release-tasks.yml @@ -12,7 +12,7 @@ on: jobs: validate-tag: name: Validate Tag - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 if: github.repository == 'llvm/llvm-project' outputs: release-version: ${{ steps.validate-tag.outputs.release-version }} @@ -26,7 +26,7 @@ jobs: release-create: name: Create a New Release - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: validate-tag steps: diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index b8e8ab26c3ffa6..c10e786faeafeb 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -21,7 +21,7 @@ permissions: jobs: analysis: name: Scorecard analysis - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 if: github.repository == 'llvm/llvm-project' permissions: # Needed to upload the results to code-scanning dashboard. diff --git a/.github/workflows/spirv-tests.yml b/.github/workflows/spirv-tests.yml index 0e1d0caca410cf..8f238d931b4d40 100644 --- a/.github/workflows/spirv-tests.yml +++ b/.github/workflows/spirv-tests.yml @@ -26,4 +26,4 @@ jobs: build_target: check-llvm-codegen-spirv projects: extra_cmake_args: '-DLLVM_TARGETS_TO_BUILD="" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="SPIRV"' - os_list: '["ubuntu-latest"]' + os_list: '["ubuntu-22.04"]' diff --git a/.github/workflows/version-check.yml b/.github/workflows/version-check.yml index c6d779080bbe73..97373d49b3ce91 100644 --- a/.github/workflows/version-check.yml +++ b/.github/workflows/version-check.yml @@ -14,7 +14,7 @@ permissions: jobs: version_check: if: github.repository_owner == 'llvm' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Fetch LLVM sources uses: actions/checkout@v4 diff --git a/llvm/lib/Target/SBF/Disassembler/SBFDisassembler.cpp b/llvm/lib/Target/SBF/Disassembler/SBFDisassembler.cpp index d3cad4bc32321d..a5881c01087924 100644 --- a/llvm/lib/Target/SBF/Disassembler/SBFDisassembler.cpp +++ b/llvm/lib/Target/SBF/Disassembler/SBFDisassembler.cpp @@ -86,7 +86,8 @@ extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSBFDisassembler() { static const unsigned GPRDecoderTable[] = { SBF::R0, SBF::R1, SBF::R2, SBF::R3, SBF::R4, SBF::R5, - SBF::R6, SBF::R7, SBF::R8, SBF::R9, SBF::R10, SBF::R11}; + SBF::R6, SBF::R7, SBF::R8, SBF::R9, SBF::R10 +}; static DecodeStatus DecodeGPRRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t /*Address*/, @@ -101,12 +102,13 @@ static DecodeStatus DecodeGPRRegisterClass(MCInst &Inst, unsigned RegNo, static const unsigned GPR32DecoderTable[] = { SBF::W0, SBF::W1, SBF::W2, SBF::W3, SBF::W4, SBF::W5, - SBF::W6, SBF::W7, SBF::W8, SBF::W9, SBF::W10, SBF::W11}; + SBF::W6, SBF::W7, SBF::W8, SBF::W9, SBF::W10 +}; static DecodeStatus DecodeGPR32RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t /*Address*/, const MCDisassembler * /*Decoder*/) { - if (RegNo > 11) + if (RegNo > 10) return MCDisassembler::Fail; unsigned Reg = GPR32DecoderTable[RegNo]; @@ -118,7 +120,7 @@ static DecodeStatus decodeMemoryOpValue(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder) { unsigned Register = (Insn >> 16) & 0xf; - if (Register > 11) + if (Register > 10) return MCDisassembler::Fail; Inst.addOperand(MCOperand::createReg(GPRDecoderTable[Register])); diff --git a/llvm/lib/Target/SBF/MCTargetDesc/SBFMCTargetDesc.cpp b/llvm/lib/Target/SBF/MCTargetDesc/SBFMCTargetDesc.cpp index 99af4aa9b19bb0..e92e2fcb534e4e 100644 --- a/llvm/lib/Target/SBF/MCTargetDesc/SBFMCTargetDesc.cpp +++ b/llvm/lib/Target/SBF/MCTargetDesc/SBFMCTargetDesc.cpp @@ -48,7 +48,7 @@ static MCInstrInfo *createSBFMCInstrInfo() { static MCRegisterInfo *createSBFMCRegisterInfo(const Triple &TT) { MCRegisterInfo *X = new MCRegisterInfo(); - InitSBFMCRegisterInfo(X, SBF::R11 /* RAReg doesn't exist */); + InitSBFMCRegisterInfo(X, SBF::R10 /* RAReg doesn't exist */); return X; } diff --git a/llvm/lib/Target/SBF/SBFFrameLowering.cpp b/llvm/lib/Target/SBF/SBFFrameLowering.cpp index c29af66e9281f0..177fd06e81fb8d 100644 --- a/llvm/lib/Target/SBF/SBFFrameLowering.cpp +++ b/llvm/lib/Target/SBF/SBFFrameLowering.cpp @@ -29,8 +29,8 @@ void adjustStackPointer(MachineFunction &MF, MachineBasicBlock &MBB, DebugLoc Dl; const SBFInstrInfo &TII = *static_cast(MF.getSubtarget().getInstrInfo()); - BuildMI(MBB, MBBI, Dl, TII.get(SBF::ADD_ri), SBF::R11) - .addReg(SBF::R11) + BuildMI(MBB, MBBI, Dl, TII.get(SBF::ADD_ri), SBF::R10) + .addReg(SBF::R10) .addImm(IsSubtract ? -NumBytes : NumBytes); } } diff --git a/llvm/lib/Target/SBF/SBFFrameLowering.h b/llvm/lib/Target/SBF/SBFFrameLowering.h index 6c4c5aff96eb88..67f98b77da1ea2 100644 --- a/llvm/lib/Target/SBF/SBFFrameLowering.h +++ b/llvm/lib/Target/SBF/SBFFrameLowering.h @@ -21,7 +21,11 @@ class SBFSubtarget; class SBFFrameLowering : public TargetFrameLowering { public: explicit SBFFrameLowering(const SBFSubtarget &sti) - : TargetFrameLowering(TargetFrameLowering::StackGrowsDown, Align(8), 0) {} + : TargetFrameLowering( + TargetFrameLowering::StackGrowsDown, + Align(64), + 0, + Align(64)) {} void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override; void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override; diff --git a/llvm/lib/Target/SBF/SBFISelLowering.cpp b/llvm/lib/Target/SBF/SBFISelLowering.cpp index 4979d552e83364..94b4c3f2bbcc6a 100644 --- a/llvm/lib/Target/SBF/SBFISelLowering.cpp +++ b/llvm/lib/Target/SBF/SBFISelLowering.cpp @@ -63,7 +63,7 @@ SBFTargetLowering::SBFTargetLowering(const TargetMachine &TM, // Compute derived properties from the register classes computeRegisterProperties(STI.getRegisterInfo()); - setStackPointerRegisterToSaveRestore(SBF::R11); + setStackPointerRegisterToSaveRestore(SBF::R10); setOperationAction(ISD::BR_CC, MVT::i64, Custom); setOperationAction(ISD::BR_JT, MVT::Other, Expand); @@ -359,18 +359,13 @@ SDValue SBFTargetLowering::LowerFormalArguments( // Assign locations to all of the incoming arguments. SmallVector ArgLocs; CCState CCInfo(CallConv, IsVarArg, MF, ArgLocs, *DAG.getContext()); - if (Ins.size() > MaxArgs) { - if (Subtarget->getEnableNewCallConvention()) { - // Pass args 1-5 via registers, remaining args via stack. - CCInfo.AnalyzeFormalArguments(Ins, getHasAlu32() ? CC_SBF32 : CC_SBF64); - } else { - // Pass args 1-4 via registers, remaining args via stack, referenced via - // SBF::R5 - CCInfo.AnalyzeFormalArguments(Ins, - getHasAlu32() ? CC_SBF32_X : CC_SBF64_X); - } + if (!Subtarget->getHasDynamicFrames() && Ins.size() > MaxArgs) { + // Pass args 1-4 via registers, remaining args via stack, referenced via + // SBF::R5 + CCInfo.AnalyzeFormalArguments(Ins, + getHasAlu32() ? CC_SBF32_X : CC_SBF64_X); } else { - // Pass all args via registers + // Pass args 1-5 via registers, remaining args via stack, if any. CCInfo.AnalyzeFormalArguments(Ins, getHasAlu32() ? CC_SBF32 : CC_SBF64); } @@ -416,9 +411,9 @@ SDValue SBFTargetLowering::LowerFormalArguments( EVT LocVT = VA.getLocVT(); SDValue SDV; - if (Subtarget->getEnableNewCallConvention()) { - // In the new convention, arguments are in at the start - // of the callee frame + if (Subtarget->getHasDynamicFrames()) { + // In the new convention, arguments are in at the end of the callee + // frame. uint64_t Size = PtrVT.getFixedSizeInBits() / 8; int64_t Offset = -static_cast(VA.getLocMemOffset() + Size); int FrameIndex = @@ -428,14 +423,7 @@ SDValue SBFTargetLowering::LowerFormalArguments( MachinePointerInfo::getFixedStack(MF, FrameIndex, Offset); SDV = DAG.getLoad(LocVT, DL, Chain, DstAddr, DstInfo); } else { - unsigned Offset; - if (Subtarget->getHasDynamicFrames()) { - // In the old convention, the arguments are stored on - // the start of caller the frame. - Offset = VA.getLocMemOffset() + PtrVT.getFixedSizeInBits() / 8; - } else { - Offset = SBFRegisterInfo::FrameLength - VA.getLocMemOffset(); - } + unsigned Offset = SBFRegisterInfo::FrameLength - VA.getLocMemOffset(); // Arguments relative to SBF::R5 unsigned reg = MF.addLiveIn(SBF::R5, &SBF::GPRRegClass); @@ -487,7 +475,7 @@ SDValue SBFTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, SmallVector ArgLocs; CCState CCInfo(CallConv, IsVarArg, MF, ArgLocs, *DAG.getContext()); if (Outs.size() > MaxArgs) { - if (Subtarget->getEnableNewCallConvention()) { + if (Subtarget->getHasDynamicFrames()) { // Pass args 1-5 via registers, remaining args via stack CCInfo.AnalyzeCallOperands(Outs, getHasAlu32() ? CC_SBF32 : CC_SBF64); } else { @@ -563,33 +551,24 @@ SDValue SBFTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, SDValue DstAddr; MachinePointerInfo DstInfo; int FrameIndex; - int64_t Offset; + int64_t Offset = static_cast(VA.getLocMemOffset()); + uint64_t Size = VA.getLocVT().getFixedSizeInBits() / 8; if (Subtarget->getHasDynamicFrames()) { // In the new call convention, arguments are stored in the callee frame - // The positive offset signals that the variable does not occupy space - // in the caller frame. - Offset = static_cast(VA.getLocMemOffset() + - PtrVT.getFixedSizeInBits() / 8); - if (!Subtarget->getEnableNewCallConvention()) - // In the old call convention, we place argument at the start of the - // frame in a fixed stack offset. - Offset = -Offset; - - FrameIndex = MF.getFrameInfo().CreateFixedObject( - VA.getLocVT().getFixedSizeInBits() / 8, Offset, false); - } else { - Offset = static_cast(VA.getLocMemOffset()); - FrameIndex = MF.getFrameInfo().CreateFixedObject( - VA.getLocVT().getFixedSizeInBits() / 8, Offset, false); + // We must increase the offset, simply because offset zero belongs to + // the caller. + Offset += Size; } + FrameIndex = MF.getFrameInfo().CreateFixedObject( + Size, Offset, false); SBFFuncInfo->storeFrameIndexArgument(FrameIndex); DstAddr = DAG.getFrameIndex(FrameIndex, PtrVT); DstInfo = MachinePointerInfo::getFixedStack(MF, FrameIndex, Offset); Chain = DAG.getStore(Chain, CLI.DL, Arg, DstAddr, DstInfo); } - if (!Subtarget->getEnableNewCallConvention()) { + if (!Subtarget->getHasDynamicFrames()) { // Pass the current stack frame pointer via SBF::R5, gluing the // instruction to instructions passing the first 4 arguments in // registers below. diff --git a/llvm/lib/Target/SBF/SBFInstrInfo.td b/llvm/lib/Target/SBF/SBFInstrInfo.td index a2a41da9e0f779..f50a10a89f01ba 100644 --- a/llvm/lib/Target/SBF/SBFInstrInfo.td +++ b/llvm/lib/Target/SBF/SBFInstrInfo.td @@ -648,7 +648,7 @@ let isBranch = 1, isTerminator = 1, hasDelaySlot=0, isBarrier = 1 in { } // Jump and link -let isCall=1, hasDelaySlot=0, Uses = [R11], +let isCall=1, hasDelaySlot=0, Uses = [R10], // Potentially clobbered registers Defs = [R0, R1, R2, R3, R4, R5] in { def JAL : CALL<"call">; @@ -689,7 +689,7 @@ let isReturn = 1, isTerminator = 1, hasDelaySlot=0, isBarrier = 1, } // ADJCALLSTACKDOWN/UP pseudo insns -let Defs = [R11], Uses = [R11], isCodeGenOnly = 1 in { +let Defs = [R10], Uses = [R10], isCodeGenOnly = 1 in { def ADJCALLSTACKDOWN : Pseudo<(outs), (ins i64imm:$amt1, i64imm:$amt2), "#ADJCALLSTACKDOWN $amt1 $amt2", [(SBFcallseq_start timm:$amt1, timm:$amt2)]>; diff --git a/llvm/lib/Target/SBF/SBFRegisterInfo.cpp b/llvm/lib/Target/SBF/SBFRegisterInfo.cpp index de9659bf66f92d..78f598cf9e6f6d 100644 --- a/llvm/lib/Target/SBF/SBFRegisterInfo.cpp +++ b/llvm/lib/Target/SBF/SBFRegisterInfo.cpp @@ -39,7 +39,6 @@ SBFRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const { BitVector SBFRegisterInfo::getReservedRegs(const MachineFunction &MF) const { BitVector Reserved(getNumRegs()); markSuperRegs(Reserved, SBF::W10); // [W|R]10 is read only frame pointer - markSuperRegs(Reserved, SBF::W11); // [W|R]11 is pseudo stack pointer return Reserved; } @@ -149,11 +148,13 @@ int SBFRegisterInfo::resolveInternalFrameIndex( const MachineFrameInfo &MFI = MF.getFrameInfo(); const SBFFunctionInfo *SBFFuncInfo = MF.getInfo(); int Offset = MFI.getObjectOffset(FI); + const SBFSubtarget & SubTarget = MF.getSubtarget(); + uint64_t StackSize = MFI.getStackSize(); - if (!MF.getSubtarget().getHasDynamicFrames() && + if (!SubTarget.getHasDynamicFrames() && SBFFuncInfo->containsFrameIndex(FI)) { Offset = SBFRegisterInfo::FrameLength - Offset; - if (static_cast(Offset) < MFI.getStackSize()) { + if (static_cast(Offset) < StackSize) { dbgs() << "Error: A function call in method " << MF.getFunction().getName() << " overwrites values in the frame. Please, decrease stack usage " @@ -161,13 +162,18 @@ int SBFRegisterInfo::resolveInternalFrameIndex( << "The function call may cause undefined behavior " "during execution.\n\n"; } - Offset = -Offset; - } else if (MF.getSubtarget().getEnableNewCallConvention() && - SBFFuncInfo->containsFrameIndex(FI)) { - uint64_t StackSize = MFI.getStackSize(); - Offset = -static_cast(StackSize) - Offset; - } else if (Imm.has_value()) { - Offset += Imm.value(); + return -Offset; + } + + if (SubTarget.getHasDynamicFrames() && + SBFFuncInfo->containsFrameIndex(FI)) { + return -Offset; + } + + Offset += Imm.value_or(0); + + if (SubTarget.getHasDynamicFrames()) { + return static_cast(StackSize) + Offset; } return Offset; diff --git a/llvm/lib/Target/SBF/SBFRegisterInfo.td b/llvm/lib/Target/SBF/SBFRegisterInfo.td index 7696b0b9731598..2b434f2cea24d3 100644 --- a/llvm/lib/Target/SBF/SBFRegisterInfo.td +++ b/llvm/lib/Target/SBF/SBFRegisterInfo.td @@ -28,7 +28,7 @@ class Ri Enc, string n, list subregs> let SubRegIndices = [sub_32]; } -foreach I = 0-11 in { +foreach I = 0-10 in { // 32-bit Integer (alias to low part of 64-bit register). def W#I : Wi, DwarfRegNum<[I]>; // 64-bit Integer registers @@ -39,13 +39,11 @@ foreach I = 0-11 in { def GPR32 : RegisterClass<"SBF", [i32], 64, (add (sequence "W%u", 1, 9), W0, // Return value - W11, // Stack Ptr W10 // Frame Ptr )>; def GPR : RegisterClass<"SBF", [i64], 64, (add (sequence "R%u", 1, 9), R0, // Return value - R11, // Stack Ptr R10 // Frame Ptr )>; diff --git a/llvm/lib/Target/SBF/SBFSubtarget.cpp b/llvm/lib/Target/SBF/SBFSubtarget.cpp index f6e8c84c46a180..ff2c27df0d7819 100644 --- a/llvm/lib/Target/SBF/SBFSubtarget.cpp +++ b/llvm/lib/Target/SBF/SBFSubtarget.cpp @@ -46,7 +46,6 @@ void SBFSubtarget::initializeEnvironment(const Triple &TT) { NoLddw = false; CallxRegSrc = false; HasPqrClass = false; - NewCallConvention = false; HasStoreImm = false; HasAlu32 = false; HasExplicitSignExt = false; diff --git a/llvm/lib/Target/SBF/SBFSubtarget.h b/llvm/lib/Target/SBF/SBFSubtarget.h index 685bbef2fb7b4a..be578f8e993ce6 100644 --- a/llvm/lib/Target/SBF/SBFSubtarget.h +++ b/llvm/lib/Target/SBF/SBFSubtarget.h @@ -74,9 +74,6 @@ class SBFSubtarget : public SBFGenSubtargetInfo { // Whether we have the PQR instruction class bool HasPqrClass; - // Whether to use the new call convention in SBFv2 - bool NewCallConvention; - // Whether we have store imm instructions bool HasStoreImm; @@ -104,9 +101,6 @@ class SBFSubtarget : public SBFGenSubtargetInfo { bool getNoLddw() const { return NoLddw; } bool getCallXRegSrc() const { return CallxRegSrc; } bool getHasPqrClass() const { return HasPqrClass; } - bool getEnableNewCallConvention() const { - return HasDynamicFrames && NewCallConvention; - } bool getHasStoreImm() const { return HasStoreImm; } bool getHasExplicitSignExt() const { return HasExplicitSignExt; } const SBFInstrInfo *getInstrInfo() const override { return &InstrInfo; } diff --git a/llvm/lib/Target/SBF/SBFTargetFeatures.td b/llvm/lib/Target/SBF/SBFTargetFeatures.td index 351500e73da65c..dc2cf380600b87 100644 --- a/llvm/lib/Target/SBF/SBFTargetFeatures.td +++ b/llvm/lib/Target/SBF/SBFTargetFeatures.td @@ -40,9 +40,6 @@ def FeatureCallxRegSrc : SubtargetFeature<"callx-reg-src", "CallxRegSrc", "true" def FeaturePqrInstr : SubtargetFeature<"pqr-instr", "HasPqrClass", "true", "Enable the PQR instruction class">; -def FeatureCallConv : SubtargetFeature<"new-call-conv", "NewCallConvention", "true", - "Enable new call convetion for SBFv2">; - def FeatureStoreImm : SubtargetFeature<"store-imm", "HasStoreImm", "true", "Enable store imm instructions">; @@ -58,4 +55,4 @@ def : Proc<"v2", []>; def : Proc<"v3", [ALU32]>; def : Proc<"sbfv2", [FeatureDynamicFrames, FeatureRelocAbs64, FeatureStaticSyscalls, FeatureDisableNeg, FeatureReverseSubImm, FeatureDisableLddw, FeatureCallxRegSrc, - FeaturePqrInstr, FeatureCallConv, FeatureExplicitSext]>; \ No newline at end of file + FeaturePqrInstr, FeatureExplicitSext]>; \ No newline at end of file diff --git a/llvm/test/CodeGen/SBF/dynamic_stack_frame_add_not_sub.ll b/llvm/test/CodeGen/SBF/dynamic_stack_frame_add_not_sub.ll index 307c50d0583004..702d3b58ad5e74 100644 --- a/llvm/test/CodeGen/SBF/dynamic_stack_frame_add_not_sub.ll +++ b/llvm/test/CodeGen/SBF/dynamic_stack_frame_add_not_sub.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -march=sbf --mattr=+dynamic-frames | FileCheck %s +; RUN: llc < %s -march=sbf -mattr=+dynamic-frames | FileCheck %s ; ; Source: ; int test_func(int * vec, int idx) { @@ -12,11 +12,11 @@ ; Function Attrs: noinline nounwind optnone ssp uwtable(sync) define i32 @test_func(ptr noundef %vec, i32 noundef %idx) #0 { ; CHECK-LABEL: test_func: -; CHECK: add64 r11, -16 -; CHECK: add64 r11, 16 +; CHECK: add64 r10, -128 +; CHECK: add64 r10, 128 entry: %vec.addr = alloca ptr, align 8 - %idx.addr = alloca i32, align 4 + %idx.addr = alloca i512, align 4 store ptr %vec, ptr %vec.addr, align 8 store i32 %idx, ptr %idx.addr, align 4 %0 = load i32, ptr %idx.addr, align 4 diff --git a/llvm/test/CodeGen/SBF/many_args_new_conv.ll b/llvm/test/CodeGen/SBF/many_args_new_conv.ll index a21a00d60613f5..b2a7fbe5ff863a 100644 --- a/llvm/test/CodeGen/SBF/many_args_new_conv.ll +++ b/llvm/test/CodeGen/SBF/many_args_new_conv.ll @@ -6,7 +6,7 @@ entry: ; CHECK-LABEL: caller_no_alloca ; No changes to the stack pointer -; CHECK-NOT: add64 r11 +; CHECK-NOT: add64 r10 ; Saving arguments on the stack ; CHECK: mov64 r4, 55 @@ -30,26 +30,26 @@ entry: ; Function Attrs: nounwind uwtable define i32 @caller_alloca(i32 %a, i32 %b, i32 %c) #0 { ; CHECK-LABEL: caller_alloca -; CHECK: add64 r11, -24 -; CHECK: ldxw r1, [r10 - 4] +; CHECK: add64 r10, -64 +; CHECK: ldxw r1, [r10 + 60] -; Saving arguments in the stack +; Saving arguments in the callee's frame ; CHECK: mov64 r4, 55 -; Offset in the callee: (-56) - (-24) = -32 -; CHECK: stxdw [r10 - 56], r4 +; Offset in the callee: frame_size - 32 +; CHECK: stxdw [r10 - 32], r4 ; CHECK: mov64 r4, 60 -; Offset in the callee: (-64) - (-24) = -40 -; CHECK: stxdw [r10 - 64], r4 +; Offset in the callee: frame_size - 40 +; CHECK: stxdw [r10 - 40], r4 ; CHECK: mov64 r4, 50 -; Offset in the callee: (-48) - (-24) = -24 -; CHECK: stxdw [r10 - 48], r4 +; Offset in the callee: frame_size - 24 +; CHECK: stxdw [r10 - 24], r4 ; CHECK: mov64 r4, 4 -; Offset in the callee: (-40) - (-24) = -16 -; CHECK: stxdw [r10 - 40], r4 +; Offset in the callee: frame_size - 16 +; CHECK: stxdw [r10 - 16], r4 ; CHECK: mov64 r4, 3 -; Offset in the callee: (-32) - (-24) = -8 -; CHECK: stxdw [r10 - 32], r4 +; Offset in the callee: frame_size - 8 +; CHECK: stxdw [r10 - 8], r4 ; CHECK: mov64 r4, 1 ; CHECK: mov64 r5, 2 ; CHECK: call callee_no_alloca @@ -67,17 +67,19 @@ entry: ; Function Attrs: nounwind uwtable define i32 @callee_alloca(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, i32 %p, i32 %y, i32 %a1, i32 %a2) #1 { ; CHECK-LABEL: callee_alloca +; CHECK: add64 r10, -128 ; Loading arguments -; CHECK: ldxdw r2, [r10 - 8] -; CHECK: ldxdw r2, [r10 - 16] -; CHECK: ldxdw r2, [r10 - 24] -; CHECK: ldxdw r2, [r10 - 32] -; CHECK: ldxdw r2, [r10 - 40] +; CHECK: ldxdw r2, [r10 + 120] +; CHECK: ldxdw r2, [r10 + 112] +; CHECK: ldxdw r2, [r10 + 104] +; CHECK: ldxdw r2, [r10 + 96] +; CHECK: ldxdw r2, [r10 + 88] ; Loading allocated i32 -; CHECK: ldxw r0, [r10 - 44] +; CHECK: ldxw r0, [r10 + 24] +; CHECK: add64 r10, 128 entry: - %o = alloca i32 + %o = alloca i512 %g = add i32 %a, %b %h = sub i32 %g, %c %i = add i32 %h, %d @@ -95,12 +97,15 @@ entry: ; Function Attrs: nounwind uwtable define i32 @callee_no_alloca(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, i32 %p, i32 %y, i32 %a1, i32 %a2) #1 { ; CHECK-LABEL: callee_no_alloca +; CHECK: add64 r10, -64 ; Loading arguments -; CHECK: ldxdw r1, [r10 - 8] -; CHECK: ldxdw r1, [r10 - 16] -; CHECK: ldxdw r1, [r10 - 24] -; CHECK: ldxdw r1, [r10 - 32] -; CHECK: ldxdw r1, [r10 - 40] +; CHECK: ldxdw r1, [r10 + 56] +; CHECK: ldxdw r1, [r10 + 48] +; CHECK: ldxdw r1, [r10 + 40] +; CHECK: ldxdw r1, [r10 + 32] +; CHECK: ldxdw r1, [r10 + 24] + +; CHECK: add64 r10, 64 entry: %g = add i32 %a, %b %h = sub i32 %g, %c diff --git a/llvm/test/CodeGen/SBF/stack_args_v2.ll b/llvm/test/CodeGen/SBF/stack_args_v2.ll index 942bc067562166..ba399b85e6b2b7 100644 --- a/llvm/test/CodeGen/SBF/stack_args_v2.ll +++ b/llvm/test/CodeGen/SBF/stack_args_v2.ll @@ -3,12 +3,10 @@ ; Function Attrs: nounwind uwtable define i32 @foo(i32 %a, i32 %b, i32 %c) #0 { ; CHECK-LABEL: foo: -; CHECK: mov64 r4, 2 -; CHECK: stxdw [r10 - 8], r4 ; CHECK: mov64 r4, 3 -; CHECK: stxdw [r10 - 16], r4 -; CHECK: mov64 r5, r10 +; CHECK: stxdw [r10 - 8], r4 ; CHECK: mov64 r4, 1 +; CHECK: mov64 r5, 2 ; CHECK: call bar entry: %call = tail call i32 @bar(i32 %a, i32 %b, i32 %c, i32 1, i32 2, i32 3) #3 @@ -18,10 +16,15 @@ entry: ; Function Attrs: nounwind uwtable define i32 @bar(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f) #1 { ; CHECK-LABEL: bar: -; CHECK: ldxdw r1, [r5 - 8] -; CHECK: sub64 r0, r1 -; CHECK: ldxdw r1, [r5 - 16] +; CHECK: add64 r10, -64 +; CHECK: mov64 r0, r1 +; CHECK: add64 r0, r2 +; CHECK: sub64 r0, r3 +; CHECK: add64 r0, r4 +; CHECK: sub64 r0, r5 +; CHECK: ldxdw r1, [r10 + 56] ; CHECK: add64 r0, r1 +; CHECK: add64 r10, 64 entry: %g = add i32 %a, %b %h = sub i32 %g, %c diff --git a/llvm/test/MC/Disassembler/SBF/sbf-pqr.txt b/llvm/test/MC/Disassembler/SBF/sbf-pqr.txt index d941711b1987fe..5123ef093b9a56 100644 --- a/llvm/test/MC/Disassembler/SBF/sbf-pqr.txt +++ b/llvm/test/MC/Disassembler/SBF/sbf-pqr.txt @@ -65,8 +65,8 @@ # CHECK: srem32 w3, -98 0xe6,0x03,0x00,0x00,0x9e,0xff,0xff,0xff -# CHECK: srem32 w11, w10 -0xee,0xab,0x00,0x00,0x00,0x00,0x00,0x00 +# CHECK: srem32 w9, w10 +0xee,0xa9,0x00,0x00,0x00,0x00,0x00,0x00 # CHECK: srem64 r7, -987 0xf6,0x07,0x00,0x00,0x25,0xfc,0xff,0xff