diff -Nru llvm-toolchain-13-13.0.1/debian/changelog llvm-toolchain-13-13.0.1/debian/changelog --- llvm-toolchain-13-13.0.1/debian/changelog 2022-06-04 13:30:38.000000000 +0000 +++ llvm-toolchain-13-13.0.1/debian/changelog 2022-07-06 12:01:11.000000000 +0000 @@ -1,47 +1,28 @@ -llvm-toolchain-13 (1:13.0.1-6) unstable; urgency=medium +llvm-toolchain-13 (1:13.0.1-2ubuntu2~20.04.1) focal; urgency=medium - [ John Paul Adrian Glaubitz ] - * Disable compiler-rt built-ins on x32 - - [ Gianfranco Costamagna ] - * Enable grpc on riscv64 - - -- Gianfranco Costamagna Sat, 04 Jun 2022 15:30:38 +0200 + * Backport to focal. (LP: #1980805) + - don't try to build GRPC, some build-deps are too old -llvm-toolchain-13 (1:13.0.1-5) unstable; urgency=medium + -- Timo Aaltonen Wed, 06 Jul 2022 15:01:11 +0300 - [ John Paul Adrian Glaubitz ] - * Enable GRPC build dependency only on supported targets - * Exclude lib{Monitoring,RemoteIndex}*Proto.a on m68k and sparc64 - - [ Gianfranco Costamagna ] - * fix grpc architectures, avoiding to install them where not available - * Break/Replaces the Ubuntu library that moved GRPC binaries into the wrong location - * newline/tab fix in rules - * fix GRPC installation in port architectures - * Add patches from Upstream/Ubuntu to: - - Backport upstream patches to allow building EFI images for Ubuntu Core - for arm64 (LP: #1960300) +llvm-toolchain-13 (1:13.0.1-2ubuntu2) jammy; urgency=medium - -- Gianfranco Costamagna Thu, 26 May 2022 09:30:17 +0200 + * Backport upstream patches to allow building EFI images for Ubuntu Core + for arm64 (LP: #1960300) -llvm-toolchain-13 (1:13.0.1-4) unstable; urgency=medium + -- Alfonso Sanchez-Beato Tue, 15 Mar 2022 13:56:30 +0000 - * Backport D115098 for Rust 1.59 (Closes: #1010150) +llvm-toolchain-13 (1:13.0.1-2ubuntu1) jammy; urgency=medium - -- Sylvestre Ledru Mon, 09 May 2022 20:47:26 +0200 + * Don't build clangd with GRPC support on i386. + * d/rules: Don't remove libRemoteIndex{ServiceProto,Proto}.a nor + libMonitoringServiceProto.a. These are necessary for autopkgtest. + Adjust d/llvm-X.Y-dev.install accordingly when building on + i386 (i.e., don't install libRemoteIndex{ServiceProto,Proto}.a in such + case). + * d/llvm-X.Y-dev.install.in: Install libs mentioned above. -llvm-toolchain-13 (1:13.0.1-3) unstable; urgency=medium - - * Fix a typo in an header (closes: #1005195) - - * Also install usr/lib/llvm-@LLVM_VERSION@/lib/libRemoteIndexProto.a - usr/lib/llvm-@LLVM_VERSION@/lib/libRemoteIndexServiceProto.a - usr/lib/llvm-@LLVM_VERSION@/lib/libMonitoringServiceProto.a - in libclang-X.Y-dev - (Closes: #1005666) - - -- Sylvestre Ledru Tue, 08 Feb 2022 21:39:18 +0100 + -- Sergio Durigan Junior Mon, 07 Feb 2022 16:56:51 -0500 llvm-toolchain-13 (1:13.0.1-2) unstable; urgency=medium @@ -378,15 +359,7 @@ -- Sylvestre Ledru Sat, 30 Jan 2021 17:31:15 +0100 -llvm-toolchain-12 (1:12.0.1-20) unstable; urgency=medium - - * Also install usr/lib/llvm-@LLVM_VERSION@/lib/libRemoteIndexProto.a - usr/lib/llvm-@LLVM_VERSION@/lib/libRemoteIndexServiceProto.a - in libclang-X.Y-dev - - -- Sylvestre Ledru Sun, 13 Feb 2022 14:04:40 +0100 - -llvm-toolchain-12 (1:12.0.1-19) unstable; urgency=medium +llvm-toolchain-12 (1:12.0.1-19) UNRELEASED; urgency=medium * Build clangd with GRPC support Thanks to Sam McCall for the patch diff -Nru llvm-toolchain-13-13.0.1/debian/control llvm-toolchain-13-13.0.1/debian/control --- llvm-toolchain-13-13.0.1/debian/control 2022-06-04 13:30:01.000000000 +0000 +++ llvm-toolchain-13-13.0.1/debian/control 2022-07-06 12:01:11.000000000 +0000 @@ -2,7 +2,8 @@ Section: devel Priority: optional Rules-Requires-Root: no -Maintainer: LLVM Packaging Team +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: LLVM Packaging Team Uploaders: Sylvestre Ledru , Gianfranco Costamagna Build-Depends: debhelper (>= 10.0), cmake, ninja-build, chrpath, texinfo, sharutils, @@ -24,10 +25,6 @@ libpfm4-dev [linux-any], python3-setuptools, libz3-dev, llvm-spirv [ amd64 arm64 armel armhf mips64el mipsel ppc64el s390x ] | hello [!i386], spirv-tools [ linux-any ] | hello [ !i386], - libgrpc++-dev [amd64 arm64 armel armhf mips64el mipsel ppc64 ppc64el powerpc riscv64 s390x], - protobuf-compiler-grpc [amd64 arm64 armel armhf mips64el mipsel ppc64 ppc64el powerpc riscv64 s390x], - libprotobuf-dev [amd64 arm64 armel armhf mips64el mipsel ppc64 ppc64el powerpc riscv64 s390x], - protobuf-compiler [amd64 arm64 armel armhf mips64el mipsel ppc64 ppc64el powerpc riscv64 s390x] # "| hello" is for older buster/bionic distros without spirv support Build-Conflicts: oprofile Standards-Version: 4.2.1 @@ -153,8 +150,6 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, ${dep:devlibs}, ${dep:devlibs-objc}, libclang1-13 (= ${binary:Version}), libclang-common-13-dev (= ${binary:Version}) -Breaks: llvm-13-dev (<< 1:13.0.1-4ubuntu1) -Replaces: llvm-13-dev (<< 1:13.0.1-4ubuntu1) Description: Clang library - Development package Clang project is a C, C++, Objective C and Objective C++ front-end based on the LLVM compiler. Its goal is to offer a replacement to the diff -Nru llvm-toolchain-13-13.0.1/debian/libclang-X.Y-dev.install.in llvm-toolchain-13-13.0.1/debian/libclang-X.Y-dev.install.in --- llvm-toolchain-13-13.0.1/debian/libclang-X.Y-dev.install.in 2022-06-04 13:29:01.000000000 +0000 +++ llvm-toolchain-13-13.0.1/debian/libclang-X.Y-dev.install.in 2021-08-16 19:55:50.000000000 +0000 @@ -1,5 +1,3 @@ -#!/usr/bin/dh-exec - usr/lib/llvm-@LLVM_VERSION@/include/clang usr/lib/llvm-@LLVM_VERSION@/include/clang-c usr/lib/llvm-@LLVM_VERSION@/include/clang-tidy @@ -7,8 +5,3 @@ usr/lib/llvm-@LLVM_VERSION@/lib/libclang.so usr/lib/llvm-@LLVM_VERSION@/lib/libclang-@LLVM_VERSION@*.so usr/lib/llvm-@LLVM_VERSION@/lib/libfindAllSymbols.a - -# clangd grpc architectures -[amd64 arm64 armel armhf mips64el mipsel ppc64 ppc64el powerpc riscv64 s390x] usr/lib/llvm-@LLVM_VERSION@/lib/libRemoteIndexProto.a -[amd64 arm64 armel armhf mips64el mipsel ppc64 ppc64el powerpc riscv64 s390x] usr/lib/llvm-@LLVM_VERSION@/lib/libRemoteIndexServiceProto.a -[amd64 arm64 armel armhf mips64el mipsel ppc64 ppc64el powerpc riscv64 s390x] usr/lib/llvm-@LLVM_VERSION@/lib/libMonitoringServiceProto.a diff -Nru llvm-toolchain-13-13.0.1/debian/llvm-X.Y-dev.install.in llvm-toolchain-13-13.0.1/debian/llvm-X.Y-dev.install.in --- llvm-toolchain-13-13.0.1/debian/llvm-X.Y-dev.install.in 2022-05-23 11:33:59.000000000 +0000 +++ llvm-toolchain-13-13.0.1/debian/llvm-X.Y-dev.install.in 2022-07-06 12:01:11.000000000 +0000 @@ -6,6 +6,9 @@ usr/lib/llvm-@LLVM_VERSION@/lib/libLLVM-@LLVM_VERSION@*.so usr/lib/llvm-@LLVM_VERSION@/lib/libLTO.so usr/lib/llvm-@LLVM_VERSION@/lib/libRemarks.* +#usr/lib/llvm-@LLVM_VERSION@/lib/libRemoteIndexProto.a +#usr/lib/llvm-@LLVM_VERSION@/lib/libRemoteIndexServiceProto.a +#usr/lib/llvm-@LLVM_VERSION@/lib/libMonitoringServiceProto.a usr/lib/llvm-@LLVM_VERSION@/include/llvm/ usr/include/llvm-@LLVM_VERSION@/ usr/lib/llvm-@LLVM_VERSION@/include/llvm-c/ usr/include/llvm-c-@LLVM_VERSION@/ # Explicit debian/tmp since there are multiple declarations diff -Nru llvm-toolchain-13-13.0.1/debian/patches/fix-merge-MergeFunctions-scheduling.diff llvm-toolchain-13-13.0.1/debian/patches/fix-merge-MergeFunctions-scheduling.diff --- llvm-toolchain-13-13.0.1/debian/patches/fix-merge-MergeFunctions-scheduling.diff 2022-06-04 13:29:01.000000000 +0000 +++ llvm-toolchain-13-13.0.1/debian/patches/fix-merge-MergeFunctions-scheduling.diff 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -Index: llvm-toolchain-13-13.0.1/llvm/lib/Passes/PassBuilder.cpp -=================================================================== ---- llvm-toolchain-13-13.0.1.orig/llvm/lib/Passes/PassBuilder.cpp -+++ llvm-toolchain-13-13.0.1/llvm/lib/Passes/PassBuilder.cpp -@@ -1416,23 +1416,6 @@ PassBuilder::buildModuleOptimizationPipe - - addVectorPasses(Level, OptimizePM, /* IsFullLTO */ false); - -- // Split out cold code. Splitting is done late to avoid hiding context from -- // other optimizations and inadvertently regressing performance. The tradeoff -- // is that this has a higher code size cost than splitting early. -- if (EnableHotColdSplit && !LTOPreLink) -- MPM.addPass(HotColdSplittingPass()); -- -- // Search the code for similar regions of code. If enough similar regions can -- // be found where extracting the regions into their own function will decrease -- // the size of the program, we extract the regions, a deduplicate the -- // structurally similar regions. -- if (EnableIROutliner) -- MPM.addPass(IROutlinerPass()); -- -- // Merge functions if requested. -- if (PTO.MergeFunctions) -- MPM.addPass(MergeFunctionsPass()); -- - // LoopSink pass sinks instructions hoisted by LICM, which serves as a - // canonicalization pass that enables other optimizations. As a result, - // LoopSink pass needs to be a very late IR pass to avoid undoing LICM -@@ -1459,6 +1442,23 @@ PassBuilder::buildModuleOptimizationPipe - for (auto &C : OptimizerLastEPCallbacks) - C(MPM, Level); - -+ // Split out cold code. Splitting is done late to avoid hiding context from -+ // other optimizations and inadvertently regressing performance. The tradeoff -+ // is that this has a higher code size cost than splitting early. -+ if (EnableHotColdSplit && !LTOPreLink) -+ MPM.addPass(HotColdSplittingPass()); -+ -+ // Search the code for similar regions of code. If enough similar regions can -+ // be found where extracting the regions into their own function will decrease -+ // the size of the program, we extract the regions, a deduplicate the -+ // structurally similar regions. -+ if (EnableIROutliner) -+ MPM.addPass(IROutlinerPass()); -+ -+ // Merge functions if requested. -+ if (PTO.MergeFunctions) -+ MPM.addPass(MergeFunctionsPass()); -+ - if (PTO.CallGraphProfile) - MPM.addPass(CGProfilePass()); - diff -Nru llvm-toolchain-13-13.0.1/debian/patches/fix-typo.diff llvm-toolchain-13-13.0.1/debian/patches/fix-typo.diff --- llvm-toolchain-13-13.0.1/debian/patches/fix-typo.diff 2022-06-03 10:26:46.000000000 +0000 +++ llvm-toolchain-13-13.0.1/debian/patches/fix-typo.diff 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -Index: llvm-toolchain-13-13.0.1/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h -=================================================================== ---- llvm-toolchain-13-13.0.1.orig/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h -+++ llvm-toolchain-13-13.0.1/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h -@@ -79,7 +79,7 @@ protected: - #ifndef NDEBUG - ~RefCountedBase() { - assert(RefCount == 0 && -- "Destruction occured when there are still references to this."); -+ "Destruction occurred when there are still references to this."); - } - #else - // Default the destructor in release builds, A trivial destructor may enable -@@ -110,7 +110,7 @@ protected: - #ifndef NDEBUG - ~ThreadSafeRefCountedBase() { - assert(RefCount == 0 && -- "Destruction occured when there are still references to this."); -+ "Destruction occurred when there are still references to this."); - } - #else - // Default the destructor in release builds, A trivial destructor may enable diff -Nru llvm-toolchain-13-13.0.1/debian/patches/risc/riscv-insn-support.patch llvm-toolchain-13-13.0.1/debian/patches/risc/riscv-insn-support.patch --- llvm-toolchain-13-13.0.1/debian/patches/risc/riscv-insn-support.patch 2022-06-04 13:29:01.000000000 +0000 +++ llvm-toolchain-13-13.0.1/debian/patches/risc/riscv-insn-support.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,566 +0,0 @@ -From d5ea5842d627e63f780b524dddf67dac7222779c Mon Sep 17 00:00:00 2001 -From: Craig Topper -Date: Sun, 12 Sep 2021 13:45:52 -0700 -Origin: upstream + rustc: https://github.com/rust-lang/llvm-project/pull/121 -Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/llvm-toolchain-13/+bug/1973041 -Applied-Upstream: from version 14.0.0-rc1 -Subject: [PATCH] [RISCV] Initial support .insn directive for the assembler. - -This allows for a custom encoding to be emitted. It can also be -used with inline assembly to allow the custom instruction to be -register allocated like other instructions. - -I initially started from SystemZ's implementation, but some of -the formats allow operands to be specified in multiple ways so I -had to add support for matching different operand class lists for -the same format. That implementation is a simplified version of -what is emitted by tablegen for regular instructions. - -I've left out the compressed formats. And I haven't supported the -named opcodes like LUI or OP_IMM_32. Those can be added in future -patches. - -Documentation can be found here https://sourceware.org/binutils/docs-2.37/as/RISC_002dV_002dFormats.html - -Reviewed By: jrtc27, MaskRay - -Differential Revision: https://reviews.llvm.org/D108602 ---- - .../Target/RISCV/AsmParser/RISCVAsmParser.cpp | 63 ++++++++- - .../Target/RISCV/MCTargetDesc/RISCVBaseInfo.h | 5 +- - .../RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp | 2 +- - llvm/lib/Target/RISCV/RISCVInstrFormats.td | 132 ++++++++++++++++++ - llvm/lib/Target/RISCV/RISCVInstrInfo.td | 102 ++++++++++++++ - llvm/lib/Target/RISCV/RISCVRegisterInfo.td | 12 ++ - llvm/test/MC/RISCV/insn-invalid.s | 17 +++ - llvm/test/MC/RISCV/insn.s | 77 ++++++++++ - 8 files changed, 407 insertions(+), 3 deletions(-) - create mode 100644 llvm/test/MC/RISCV/insn-invalid.s - create mode 100644 llvm/test/MC/RISCV/insn.s - -diff --git a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp -index 87496e0b9330f..ff2841a50d2d3 100644 ---- a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp -+++ b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp -@@ -169,6 +169,7 @@ class RISCVAsmParser : public MCTargetAsmParser { - - bool parseDirectiveOption(); - bool parseDirectiveAttribute(); -+ bool parseDirectiveInsn(SMLoc L); - - void setFeatureBits(uint64_t Feature, StringRef FeatureString) { - if (!(getSTI().getFeatureBits()[Feature])) { -@@ -504,6 +505,24 @@ struct RISCVOperand : public MCParsedAsmOperand { - return (isRV64() && isUInt<5>(Imm)) || isUInt<4>(Imm); - } - -+ bool isUImm2() const { -+ int64_t Imm; -+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None; -+ if (!isImm()) -+ return false; -+ bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK); -+ return IsConstantImm && isUInt<2>(Imm) && VK == RISCVMCExpr::VK_RISCV_None; -+ } -+ -+ bool isUImm3() const { -+ int64_t Imm; -+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None; -+ if (!isImm()) -+ return false; -+ bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK); -+ return IsConstantImm && isUInt<3>(Imm) && VK == RISCVMCExpr::VK_RISCV_None; -+ } -+ - bool isUImm5() const { - int64_t Imm; - RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None; -@@ -513,6 +532,15 @@ struct RISCVOperand : public MCParsedAsmOperand { - return IsConstantImm && isUInt<5>(Imm) && VK == RISCVMCExpr::VK_RISCV_None; - } - -+ bool isUImm7() const { -+ int64_t Imm; -+ RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None; -+ if (!isImm()) -+ return false; -+ bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK); -+ return IsConstantImm && isUInt<7>(Imm) && VK == RISCVMCExpr::VK_RISCV_None; -+ } -+ - bool isSImm5() const { - if (!isImm()) - return false; -@@ -1835,8 +1863,10 @@ bool RISCVAsmParser::ParseDirective(AsmToken DirectiveID) { - - if (IDVal == ".option") - return parseDirectiveOption(); -- else if (IDVal == ".attribute") -+ if (IDVal == ".attribute") - return parseDirectiveAttribute(); -+ if (IDVal == ".insn") -+ return parseDirectiveInsn(DirectiveID.getLoc()); - - return true; - } -@@ -2200,6 +2230,37 @@ bool RISCVAsmParser::parseDirectiveAttribute() { - return false; - } - -+/// parseDirectiveInsn -+/// ::= .insn [ format encoding, (operands (, operands)*) ] -+bool RISCVAsmParser::parseDirectiveInsn(SMLoc L) { -+ MCAsmParser &Parser = getParser(); -+ -+ // Expect instruction format as identifier. -+ StringRef Format; -+ SMLoc ErrorLoc = Parser.getTok().getLoc(); -+ if (Parser.parseIdentifier(Format)) -+ return Error(ErrorLoc, "expected instruction format"); -+ -+ if (Format != "r" && Format != "r4" && Format != "i" && Format != "b" && -+ Format != "sb" && Format != "u" && Format != "j" && Format != "uj" && -+ Format != "s") -+ return Error(ErrorLoc, "invalid instruction format"); -+ -+ std::string FormatName = (".insn_" + Format).str(); -+ -+ ParseInstructionInfo Info; -+ SmallVector, 8> Operands; -+ -+ if (ParseInstruction(Info, FormatName, L, Operands)) -+ return true; -+ -+ unsigned Opcode; -+ uint64_t ErrorInfo; -+ return MatchAndEmitInstruction(L, Opcode, Operands, Parser.getStreamer(), -+ ErrorInfo, -+ /*MatchingInlineAsm=*/false); -+} -+ - void RISCVAsmParser::emitToStreamer(MCStreamer &S, const MCInst &Inst) { - MCInst CInst; - bool Res = compressInst(CInst, Inst, getSTI(), S.getContext()); -diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h -index 9bdd2003cb15d..b837c4e25270b 100644 ---- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h -+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h -@@ -158,8 +158,11 @@ enum { - namespace RISCVOp { - enum OperandType : unsigned { - OPERAND_FIRST_RISCV_IMM = MCOI::OPERAND_FIRST_TARGET, -- OPERAND_UIMM4 = OPERAND_FIRST_RISCV_IMM, -+ OPERAND_UIMM2 = OPERAND_FIRST_RISCV_IMM, -+ OPERAND_UIMM3, -+ OPERAND_UIMM4, - OPERAND_UIMM5, -+ OPERAND_UIMM7, - OPERAND_UIMM12, - OPERAND_SIMM12, - OPERAND_UIMM20, -diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp -index 1ef276b101003..14d0191a505fc 100644 ---- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp -+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp -@@ -358,7 +358,7 @@ unsigned RISCVMCCodeEmitter::getImmOpValue(const MCInst &MI, unsigned OpNo, - } - } else if (Kind == MCExpr::SymbolRef && - cast(Expr)->getKind() == MCSymbolRefExpr::VK_None) { -- if (Desc.getOpcode() == RISCV::JAL) { -+ if (MIFrm == RISCVII::InstFormatJ) { - FixupKind = RISCV::fixup_riscv_jal; - } else if (MIFrm == RISCVII::InstFormatB) { - FixupKind = RISCV::fixup_riscv_branch; -diff --git a/llvm/lib/Target/RISCV/RISCVInstrFormats.td b/llvm/lib/Target/RISCV/RISCVInstrFormats.td -index 8e9d245f13eb0..944650c870b62 100644 ---- a/llvm/lib/Target/RISCV/RISCVInstrFormats.td -+++ b/llvm/lib/Target/RISCV/RISCVInstrFormats.td -@@ -406,3 +406,135 @@ class RVInstJ -+ : RVInst { -+ bits<7> opcode; -+ bits<7> funct7; -+ bits<3> funct3; -+ -+ bits<5> rs2; -+ bits<5> rs1; -+ bits<5> rd; -+ -+ let Inst{31-25} = funct7; -+ let Inst{24-20} = rs2; -+ let Inst{19-15} = rs1; -+ let Inst{14-12} = funct3; -+ let Inst{11-7} = rd; -+ let Opcode = opcode; -+ -+ let AsmString = ".insn r " # argstr; -+} -+ -+class DirectiveInsnR4 -+ : RVInst { -+ bits<7> opcode; -+ bits<2> funct2; -+ bits<3> funct3; -+ -+ bits<5> rs3; -+ bits<5> rs2; -+ bits<5> rs1; -+ bits<5> rd; -+ -+ let Inst{31-27} = rs3; -+ let Inst{26-25} = funct2; -+ let Inst{24-20} = rs2; -+ let Inst{19-15} = rs1; -+ let Inst{14-12} = funct3; -+ let Inst{11-7} = rd; -+ let Opcode = opcode; -+ -+ let AsmString = ".insn r4 " # argstr; -+} -+ -+class DirectiveInsnI -+ : RVInst { -+ bits<7> opcode; -+ bits<3> funct3; -+ -+ bits<12> imm12; -+ bits<5> rs1; -+ bits<5> rd; -+ -+ let Inst{31-20} = imm12; -+ let Inst{19-15} = rs1; -+ let Inst{14-12} = funct3; -+ let Inst{11-7} = rd; -+ let Opcode = opcode; -+ -+ let AsmString = ".insn i " # argstr; -+} -+ -+class DirectiveInsnS -+ : RVInst { -+ bits<7> opcode; -+ bits<3> funct3; -+ -+ bits<12> imm12; -+ bits<5> rs2; -+ bits<5> rs1; -+ -+ let Inst{31-25} = imm12{11-5}; -+ let Inst{24-20} = rs2; -+ let Inst{19-15} = rs1; -+ let Inst{14-12} = funct3; -+ let Inst{11-7} = imm12{4-0}; -+ let Opcode = opcode; -+ -+ let AsmString = ".insn s " # argstr; -+} -+ -+class DirectiveInsnB -+ : RVInst { -+ bits<7> opcode; -+ bits<3> funct3; -+ -+ bits<12> imm12; -+ bits<5> rs2; -+ bits<5> rs1; -+ -+ let Inst{31} = imm12{11}; -+ let Inst{30-25} = imm12{9-4}; -+ let Inst{24-20} = rs2; -+ let Inst{19-15} = rs1; -+ let Inst{14-12} = funct3; -+ let Inst{11-8} = imm12{3-0}; -+ let Inst{7} = imm12{10}; -+ let Opcode = opcode; -+ -+ let AsmString = ".insn b " # argstr; -+} -+ -+class DirectiveInsnU -+ : RVInst { -+ bits<7> opcode; -+ -+ bits<20> imm20; -+ bits<5> rd; -+ -+ let Inst{31-12} = imm20; -+ let Inst{11-7} = rd; -+ let Opcode = opcode; -+ -+ let AsmString = ".insn u " # argstr; -+} -+ -+class DirectiveInsnJ -+ : RVInst { -+ bits<7> opcode; -+ -+ bits<20> imm20; -+ bits<5> rd; -+ -+ let Inst{31-12} = imm20; -+ let Inst{11-7} = rd; -+ let Opcode = opcode; -+ -+ let AsmString = ".insn j " # argstr; -+} -diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.td b/llvm/lib/Target/RISCV/RISCVInstrInfo.td -index 949fff25e9e0a..1d6e4f04fce49 100644 ---- a/llvm/lib/Target/RISCV/RISCVInstrInfo.td -+++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.td -@@ -152,6 +152,20 @@ def uimmlog2xlen : Operand, ImmLeaf { -+ let ParserMatchClass = UImmAsmOperand<2>; -+ let DecoderMethod = "decodeUImmOperand<2>"; -+ let OperandType = "OPERAND_UIMM2"; -+ let OperandNamespace = "RISCVOp"; -+} -+ -+def uimm3 : Operand { -+ let ParserMatchClass = UImmAsmOperand<3>; -+ let DecoderMethod = "decodeUImmOperand<3>"; -+ let OperandType = "OPERAND_UIMM3"; -+ let OperandNamespace = "RISCVOp"; -+} -+ - def uimm5 : Operand, ImmLeaf(Imm);}]> { - let ParserMatchClass = UImmAsmOperand<5>; - let DecoderMethod = "decodeUImmOperand<5>"; -@@ -159,6 +173,13 @@ def uimm5 : Operand, ImmLeaf(Imm);}]> { - let OperandNamespace = "RISCVOp"; - } - -+def uimm7 : Operand { -+ let ParserMatchClass = UImmAsmOperand<7>; -+ let DecoderMethod = "decodeUImmOperand<7>"; -+ let OperandType = "OPERAND_UIMM7"; -+ let OperandNamespace = "RISCVOp"; -+} -+ - def simm12 : Operand, ImmLeaf(Imm);}]> { - let ParserMatchClass = SImmAsmOperand<12>; - let EncoderMethod = "getImmOpValue"; -@@ -848,6 +869,87 @@ def : MnemonicAlias<"sbreak", "ebreak">; - // that don't support this alias. - def : InstAlias<"zext.b $rd, $rs", (ANDI GPR:$rd, GPR:$rs, 0xFF), 0>; - -+//===----------------------------------------------------------------------===// -+// .insn directive instructions -+//===----------------------------------------------------------------------===// -+ -+// isCodeGenOnly = 1 to hide them from the tablegened assembly parser. -+let isCodeGenOnly = 1, hasSideEffects = 1, mayLoad = 1, mayStore = 1, -+ hasNoSchedulingInfo = 1 in { -+def InsnR : DirectiveInsnR<(outs AnyReg:$rd), (ins uimm7:$opcode, uimm3:$funct3, -+ uimm7:$funct7, AnyReg:$rs1, -+ AnyReg:$rs2), -+ "$opcode, $funct3, $funct7, $rd, $rs1, $rs2">; -+def InsnR4 : DirectiveInsnR4<(outs AnyReg:$rd), (ins uimm7:$opcode, -+ uimm3:$funct3, -+ uimm2:$funct2, -+ AnyReg:$rs1, AnyReg:$rs2, -+ AnyReg:$rs3), -+ "$opcode, $funct3, $funct2, $rd, $rs1, $rs2, $rs3">; -+def InsnI : DirectiveInsnI<(outs AnyReg:$rd), (ins uimm7:$opcode, uimm3:$funct3, -+ AnyReg:$rs1, simm12:$imm12), -+ "$opcode, $funct3, $rd, $rs1, $imm12">; -+def InsnI_Mem : DirectiveInsnI<(outs AnyReg:$rd), (ins uimm7:$opcode, -+ uimm3:$funct3, -+ AnyReg:$rs1, -+ simm12:$imm12), -+ "$opcode, $funct3, $rd, ${imm12}(${rs1})">; -+def InsnB : DirectiveInsnB<(outs), (ins uimm7:$opcode, uimm3:$funct3, -+ AnyReg:$rs1, AnyReg:$rs2, -+ simm13_lsb0:$imm12), -+ "$opcode, $funct3, $rs1, $rs2, $imm12">; -+def InsnU : DirectiveInsnU<(outs AnyReg:$rd), (ins uimm7:$opcode, -+ uimm20_lui:$imm20), -+ "$opcode, $rd, $imm20">; -+def InsnJ : DirectiveInsnJ<(outs AnyReg:$rd), (ins uimm7:$opcode, -+ simm21_lsb0_jal:$imm20), -+ "$opcode, $rd, $imm20">; -+def InsnS : DirectiveInsnS<(outs), (ins uimm7:$opcode, uimm3:$funct3, -+ AnyReg:$rs2, AnyReg:$rs1, -+ simm12:$imm12), -+ "$opcode, $funct3, $rs2, ${imm12}(${rs1})">; -+} -+ -+// Use InstAliases to match these so that we can combine the insn and format -+// into a mnemonic to use as the key for the tablegened asm matcher table. The -+// parser will take care of creating these fake mnemonics and will only do it -+// for known formats. -+let EmitPriority = 0 in { -+def : InstAlias<".insn_r $opcode, $funct3, $funct7, $rd, $rs1, $rs2", -+ (InsnR AnyReg:$rd, uimm7:$opcode, uimm3:$funct3, uimm7:$funct7, -+ AnyReg:$rs1, AnyReg:$rs2)>; -+// Accept 4 register form of ".insn r" as alias for ".insn r4". -+def : InstAlias<".insn_r $opcode, $funct3, $funct7, $rd, $rs1, $rs2, $rs3", -+ (InsnR4 AnyReg:$rd, uimm7:$opcode, uimm3:$funct3, uimm7:$funct7, -+ AnyReg:$rs1, AnyReg:$rs2, AnyReg:$rs3)>; -+def : InstAlias<".insn_r4 $opcode, $funct3, $funct7, $rd, $rs1, $rs2, $rs3", -+ (InsnR4 AnyReg:$rd, uimm7:$opcode, uimm3:$funct3, uimm7:$funct7, -+ AnyReg:$rs1, AnyReg:$rs2, AnyReg:$rs3)>; -+def : InstAlias<".insn_i $opcode, $funct3, $rd, $rs1, $imm12", -+ (InsnI AnyReg:$rd, uimm7:$opcode, uimm3:$funct3, AnyReg:$rs1, -+ simm12:$imm12)>; -+def : InstAlias<".insn_i $opcode, $funct3, $rd, ${imm12}(${rs1})", -+ (InsnI_Mem AnyReg:$rd, uimm7:$opcode, uimm3:$funct3, -+ AnyReg:$rs1, simm12:$imm12)>; -+def : InstAlias<".insn_b $opcode, $funct3, $rs1, $rs2, $imm12", -+ (InsnB uimm7:$opcode, uimm3:$funct3, AnyReg:$rs1, -+ AnyReg:$rs2, simm13_lsb0:$imm12)>; -+// Accept sb as an alias for b. -+def : InstAlias<".insn_sb $opcode, $funct3, $rs1, $rs2, $imm12", -+ (InsnB uimm7:$opcode, uimm3:$funct3, AnyReg:$rs1, -+ AnyReg:$rs2, simm13_lsb0:$imm12)>; -+def : InstAlias<".insn_u $opcode, $rd, $imm20", -+ (InsnU AnyReg:$rd, uimm7:$opcode, uimm20_lui:$imm20)>; -+def : InstAlias<".insn_j $opcode, $rd, $imm20", -+ (InsnJ AnyReg:$rd, uimm7:$opcode, simm21_lsb0_jal:$imm20)>; -+// Accept uj as an alias for j. -+def : InstAlias<".insn_uj $opcode, $rd, $imm20", -+ (InsnJ AnyReg:$rd, uimm7:$opcode, simm21_lsb0_jal:$imm20)>; -+def : InstAlias<".insn_s $opcode, $funct3, $rs2, ${imm12}(${rs1})", -+ (InsnS uimm7:$opcode, uimm3:$funct3, AnyReg:$rs2, -+ AnyReg:$rs1, simm12:$imm12)>; -+} -+ - //===----------------------------------------------------------------------===// - // Pseudo-instructions and codegen patterns - // -diff --git a/llvm/lib/Target/RISCV/RISCVRegisterInfo.td b/llvm/lib/Target/RISCV/RISCVRegisterInfo.td -index fde75206889c8..4dbeb61c48159 100644 ---- a/llvm/lib/Target/RISCV/RISCVRegisterInfo.td -+++ b/llvm/lib/Target/RISCV/RISCVRegisterInfo.td -@@ -557,3 +557,15 @@ foreach m = LMULList.m in { - def FFLAGS : RISCVReg<0, "fflags">; - def FRM : RISCVReg<0, "frm">; - def FCSR : RISCVReg<0, "fcsr">; -+ -+// Any type register. Used for .insn directives when we don't know what the -+// register types could be. -+// NOTE: The alignment and size are bogus values. The Size needs to be non-zero -+// or tablegen will use "untyped" to determine the size which will assert. -+let isAllocatable = 0 in -+def AnyReg : RegisterClass<"RISCV", [untyped], 32, -+ (add (sequence "X%u", 0, 31), -+ (sequence "F%u_D", 0, 31), -+ (sequence "V%u", 0, 31))> { -+ let Size = 32; -+} -diff --git a/llvm/test/MC/RISCV/insn-invalid.s b/llvm/test/MC/RISCV/insn-invalid.s -new file mode 100644 -index 0000000000000..5d7eaf69f01dc ---- /dev/null -+++ b/llvm/test/MC/RISCV/insn-invalid.s -@@ -0,0 +1,17 @@ -+# RUN: not llvm-mc -triple riscv32 < %s 2>&1 | FileCheck %s -+ -+# Too many operands -+.insn i 0x13, 0, a0, a1, 13, 14 # CHECK: :[[@LINE]]:33: error: invalid operand for instruction -+.insn r 0x43, 0, 0, fa0, fa1, fa2, fa3, fa4 # CHECK: :[[@LINE]]:44: error: invalid operand for instruction -+ -+# Too few operands -+.insn r 0x33, 0, 0, a0, a1 # CHECK: :[[@LINE]]:1: error: too few operands for instruction -+.insn i 0x13, 0, a0, a1 # CHECK: :[[@LINE]]:1: error: too few operands for instruction -+ -+.insn r 0x33, 0, 0, a0, 13 # CHECK: :[[@LINE]]:28: error: invalid operand for instruction -+.insn i 0x13, 0, a0, a1, a2 # CHECK: :[[@LINE]]:28: error: operand must be a symbol with %lo/%pcrel_lo/%tprel_lo modifier or an integer in the range [-2048, 2047] -+ -+.insn q 0x13, 0, a0, a1, 13, 14 # CHECK: :[[@LINE]]:7: error: invalid instruction format -+ -+# Make fake mnemonics we use to match these in the tablegened asm match table isn't exposed. -+.insn_i 0x13, 0, a0, a1, 13, 14 # CHECK: :[[@LINE]]:1: error: unknown directive -diff --git a/llvm/test/MC/RISCV/insn.s b/llvm/test/MC/RISCV/insn.s -new file mode 100644 -index 0000000000000..1e02e22f965ad ---- /dev/null -+++ b/llvm/test/MC/RISCV/insn.s -@@ -0,0 +1,77 @@ -+# RUN: llvm-mc %s -triple=riscv32 -mattr=+f -riscv-no-aliases -show-encoding \ -+# RUN: | FileCheck -check-prefixes=CHECK-ASM %s -+# RUN: llvm-mc %s -triple riscv64 -mattr=+f -riscv-no-aliases -show-encoding \ -+# RUN: | FileCheck -check-prefixes=CHECK-ASM %s -+# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+f < %s \ -+# RUN: | llvm-objdump --mattr=+f -M no-aliases -d -r - \ -+# RUN: | FileCheck -check-prefixes=CHECK-OBJ %s -+# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+f < %s \ -+# RUN: | llvm-objdump --mattr=+f -M no-aliases -d -r - \ -+# RUN: | FileCheck -check-prefixes=CHECK-OBJ %s -+ -+target: -+ -+# CHECK-ASM: .insn r 51, 0, 0, a0, a1, a2 -+# CHECK-ASM: encoding: [0x33,0x85,0xc5,0x00] -+# CHECK-OBJ: add a0, a1, a2 -+.insn r 0x33, 0, 0, a0, a1, a2 -+ -+# CHECK-ASM: .insn i 19, 0, a0, a1, 13 -+# CHECK-ASM: encoding: [0x13,0x85,0xd5,0x00] -+# CHECK-OBJ: addi a0, a1, 13 -+.insn i 0x13, 0, a0, a1, 13 -+ -+# CHECK-ASM: .insn i 103, 0, a0, 10(a1) -+# CHECK-ASM: encoding: [0x67,0x85,0xa5,0x00] -+# CHECK-OBJ: jalr a0, 10(a1) -+.insn i 0x67, 0, a0, 10(a1) -+ -+# CHECK-ASM: .insn i 3, 0, a0, 4(a1) -+# CHECK-ASM: encoding: [0x03,0x85,0x45,0x00] -+# CHECK-OBJ: lb a0, 4(a1) -+.insn i 0x3, 0, a0, 4(a1) -+ -+# CHECK-ASM: .insn b 99, 0, a0, a1, target -+# CHECK-ASM: [0x63'A',A,0xb5'A',A] -+# CHECK-OBJ: beq a0, a1, 0x0 -+.insn sb 0x63, 0, a0, a1, target -+ -+# CHECK-ASM: .insn b 99, 0, a0, a1, target -+# CHECK-ASM: [0x63'A',A,0xb5'A',A] -+# CHECK-OBJ: beq a0, a1, 0x0 -+.insn b 0x63, 0, a0, a1, target -+ -+# CHECK-ASM: .insn s 35, 0, a0, 4(a1) -+# CHECK-ASM: encoding: [0x23,0x82,0xa5,0x00] -+# CHECK-OBJ: sb a0, 4(a1) -+.insn s 0x23, 0, a0, 4(a1) -+ -+# CHECK-ASM: .insn u 55, a0, 4095 -+# CHECK-ASM: encoding: [0x37,0xf5,0xff,0x00] -+# CHECK-OBJ: lui a0, 4095 -+.insn u 0x37, a0, 0xfff -+ -+# CHECK-ASM: .insn j 111, a0, target -+# CHECK-ASM: encoding: [0x6f,0bAAAA0101,A,A] -+# CHECK-OBJ: jal a0, 0x0 -+.insn uj 0x6f, a0, target -+ -+# CHECK-ASM: .insn j 111, a0, target -+# CHECK-ASM: encoding: [0x6f,0bAAAA0101,A,A] -+# CHECK-OBJ: jal a0, 0x0 -+.insn j 0x6f, a0, target -+ -+# CHECK-ASM: .insn r4 67, 0, 0, fa0, fa1, fa2, fa3 -+# CHECK-ASM: encoding: [0x43,0x85,0xc5,0x68] -+# CHECK-OBJ: fmadd.s fa0, fa1, fa2, fa3, rne -+.insn r 0x43, 0, 0, fa0, fa1, fa2, fa3 -+ -+# CHECK-ASM: .insn r4 67, 0, 0, fa0, fa1, fa2, fa3 -+# CHECK-ASM: encoding: [0x43,0x85,0xc5,0x68] -+# CHECK-OBJ: fmadd.s fa0, fa1, fa2, fa3, rne -+.insn r4 0x43, 0, 0, fa0, fa1, fa2, fa3 -+ -+# CHECK-ASM: .insn i 3, 5, t1, -2048(t2) -+# CHECK-ASM: encoding: [0x03,0xd3,0x03,0x80] -+# CHECK-OBJ: lhu t1, -2048(t2) -+.insn i 0x3, 0x5, x6, %lo(2048)(x7) diff -Nru llvm-toolchain-13-13.0.1/debian/patches/series llvm-toolchain-13-13.0.1/debian/patches/series --- llvm-toolchain-13-13.0.1/debian/patches/series 2022-06-04 13:29:01.000000000 +0000 +++ llvm-toolchain-13-13.0.1/debian/patches/series 2022-03-15 13:56:15.000000000 +0000 @@ -119,7 +119,6 @@ # riscv64 risc/clang-riscv64-multiarch.diff -risc/riscv-insn-support.patch # sparc64 D98574.patch @@ -153,8 +152,6 @@ compilerrt-build-scudo-standalone-option.diff use-gold-for-compiler-rt-when-set.diff wasm-ld-path.diff -fix-typo.diff -fix-merge-MergeFunctions-scheduling.diff # Fix llvm-objcopy for arm64 llvm-objcopy-COFF-Consider-section-flags-when-adding.patch diff -Nru llvm-toolchain-13-13.0.1/debian/rules llvm-toolchain-13-13.0.1/debian/rules --- llvm-toolchain-13-13.0.1/debian/rules 2022-06-04 13:30:04.000000000 +0000 +++ llvm-toolchain-13-13.0.1/debian/rules 2022-02-07 21:54:00.000000000 +0000 @@ -126,6 +126,7 @@ # clangd remote index support requires GRPC & protobuf. # Enable if minimum tested versions are available. +ifneq ($(VENDOR)-$(DEB_HOST_ARCH),Ubuntu-i386) ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' libgrpc++-dev) gt 1.30.0; echo $$?),0) ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' protobuf-compiler-grpc) gt 1.30.0; echo $$?),0) ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' libprotobuf-dev) gt 3.12.0; echo $$?),0) @@ -135,6 +136,7 @@ endif endif endif +endif export CC=gcc-$(GCC_VERSION) export CXX=g++-$(GCC_VERSION) @@ -195,9 +197,6 @@ ifneq (,$(filter $(DEB_HOST_ARCH),x32)) STAGE_ALL_CMAKE_EXTRA += -DLLVM_HOST_TRIPLE=x86_64-linux-gnux32 STAGE_ALL_CMAKE_EXTRA += -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-linux-gnux32 - STAGE_ALL_CMAKE_EXTRA += -DCOMPILER_RT_BUILD_BUILTINS=OFF - COMPILER_RT_USE_BUILTINS_LIBRARY := OFF - LIBCXX_USE_COMPILER_RT := OFF endif ifneq (,$(filter $(DEB_HOST_ARCH),hurd-i386)) @@ -436,7 +435,6 @@ # Make install file executable for dh-exec chmod +x \ debian/clang-tools-$(LLVM_VERSION).install \ - debian/libclang-$(LLVM_VERSION)-dev.install \ debian/libclang-common-$(LLVM_VERSION)-dev.install \ debian/libomp-$(LLVM_VERSION)-dev.install \ debian/llvm-$(LLVM_VERSION)-dev.install \ @@ -458,6 +456,12 @@ sed -i -e "s|#spv\ ||g" debian/libclc-$(LLVM_VERSION).install; \ fi +ifeq ($(VENDOR)-$(DEB_HOST_ARCH),Ubuntu-i386) + # Ubuntu doesn't build GRPC on i386. + sed -i '/^usr\/lib.*libRemoteIndex.*\.a$$/d' debian/llvm-$(LLVM_VERSION)-dev.install + sed -i '/^usr\/lib.*libMonitoringServiceProto.a$$/d' debian/llvm-$(LLVM_VERSION)-dev.install +endif + # Override this two targets. They are trying to manage the .in conversion for me override_dh_ocamlinit: override_dh_ocamlclean: @@ -945,7 +949,7 @@ ARCH_LLVM_TEST_OK := i386 amd64 override_dh_auto_test: - echo "Running tests: $(RUN_TEST)" + echo "Running tests: $(RUN_TEST)" # LLVM tests ifneq (,$(findstring $(DEB_HOST_ARCH),$(ARCH_LLVM_TEST_OK))) # logs the output to check-llvm_build_log.txt for validation through autopkgtest