diff options
Diffstat (limited to 'clang/include')
-rw-r--r-- | clang/include/clang/AST/HLSLResource.h | 78 | ||||
-rw-r--r-- | clang/include/clang/Basic/Attr.td | 33 | ||||
-rw-r--r-- | clang/include/clang/Basic/AttrDocs.td | 11 | ||||
-rw-r--r-- | clang/include/clang/Basic/BuiltinsPPC.def | 7 | ||||
-rw-r--r-- | clang/include/clang/Basic/BuiltinsX86.td | 36 | ||||
-rw-r--r-- | clang/include/clang/Basic/Diagnostic.h | 17 | ||||
-rw-r--r-- | clang/include/clang/Basic/PPCTypes.def | 1 | ||||
-rw-r--r-- | clang/include/clang/Basic/TokenKinds.def | 8 | ||||
-rw-r--r-- | clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h | 7 | ||||
-rw-r--r-- | clang/include/clang/CIR/Dialect/IR/CIROps.td | 28 | ||||
-rw-r--r-- | clang/include/clang/CIR/MissingFeatures.h | 3 | ||||
-rw-r--r-- | clang/include/clang/CodeGen/ModuleBuilder.h | 6 | ||||
-rw-r--r-- | clang/include/clang/Driver/CommonArgs.h | 5 | ||||
-rw-r--r-- | clang/include/clang/Serialization/ASTBitCodes.h | 2 | ||||
-rw-r--r-- | clang/include/clang/Serialization/ModuleCache.h | 9 |
15 files changed, 198 insertions, 53 deletions
diff --git a/clang/include/clang/AST/HLSLResource.h b/clang/include/clang/AST/HLSLResource.h new file mode 100644 index 0000000..9cdd81b --- /dev/null +++ b/clang/include/clang/AST/HLSLResource.h @@ -0,0 +1,78 @@ +//===- HLSLResource.h - Routines for HLSL resources and bindings ----------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file provides shared routines to help analyze HLSL resources and +// theirs bindings during Sema and CodeGen. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_AST_HLSLRESOURCE_H +#define LLVM_CLANG_AST_HLSLRESOURCE_H + +#include "clang/AST/ASTContext.h" +#include "clang/AST/Attr.h" +#include "clang/AST/Attrs.inc" +#include "clang/AST/DeclBase.h" +#include "clang/Basic/TargetInfo.h" +#include "clang/Support/Compiler.h" +#include "llvm/Support/raw_ostream.h" + +namespace clang { + +class HLSLResourceBindingAttr; +class HLSLRVkBindingAttr; + +namespace hlsl { + +struct ResourceBindingAttrs { + HLSLResourceBindingAttr *RegBinding; + HLSLVkBindingAttr *VkBinding; + + ResourceBindingAttrs(const Decl *D) { + RegBinding = D->getAttr<HLSLResourceBindingAttr>(); + bool IsSpirv = D->getASTContext().getTargetInfo().getTriple().isSPIRV(); + VkBinding = IsSpirv ? D->getAttr<HLSLVkBindingAttr>() : nullptr; + } + + bool hasBinding() const { return RegBinding || VkBinding; } + bool isExplicit() const { + return (RegBinding && RegBinding->hasRegisterSlot()) || VkBinding; + } + + unsigned getSlot() const { + assert(isExplicit() && "no explicit binding"); + if (VkBinding) + return VkBinding->getBinding(); + if (RegBinding && RegBinding->hasRegisterSlot()) + return RegBinding->getSlotNumber(); + llvm_unreachable("no explicit binding"); + } + + unsigned getSpace() const { + if (VkBinding) + return VkBinding->getSet(); + if (RegBinding) + return RegBinding->getSpaceNumber(); + return 0; + } + + bool hasImplicitOrderID() const { + return RegBinding && RegBinding->hasImplicitBindingOrderID(); + } + + unsigned getImplicitOrderID() const { + assert(hasImplicitOrderID()); + return RegBinding->getImplicitBindingOrderID(); + } +}; + +} // namespace hlsl + +} // namespace clang + +#endif // LLVM_CLANG_AST_HLSLRESOURCE_H diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index 2623f9f..fe3ca70 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -1470,7 +1470,7 @@ def Constructor : InheritableAttr { let TemplateDependent = 1; let Documentation = [CtorDtorDocs]; let AdditionalMembers = [{ - static constexpr unsigned DefaultPriority = 65535; + static constexpr unsigned DefaultPriority = 65535; }]; } @@ -1815,7 +1815,7 @@ def Destructor : InheritableAttr { let TemplateDependent = 1; let Documentation = [CtorDtorDocs]; let AdditionalMembers = [{ - static constexpr unsigned int DefaultPriority = 65535; + static constexpr unsigned int DefaultPriority = 65535; }]; } @@ -3921,16 +3921,31 @@ def NoSanitize : InheritableAttr { }]; } -// Attributes to disable a specific sanitizer. No new sanitizers should be added +// Attribute to disable AddressSanitizer. No new spellings should be added // to this list; the no_sanitize attribute should be extended instead. -def NoSanitizeSpecific : InheritableAttr { +def NoSanitizeAddress : InheritableAttr { let Spellings = [GCC<"no_address_safety_analysis">, - GCC<"no_sanitize_address">, - GCC<"no_sanitize_thread">, - Clang<"no_sanitize_memory">]; + GCC<"no_sanitize_address">]; let Subjects = SubjectList<[Function, GlobalVar], ErrorDiag>; - let Documentation = [NoSanitizeAddressDocs, NoSanitizeThreadDocs, - NoSanitizeMemoryDocs]; + let Documentation = [NoSanitizeAddressDocs]; + let ASTNode = 0; +} + +// Attribute to disable ThreadSanitizer. No new spellings should be added +// to this list; the no_sanitize attribute should be extended instead. +def NoSanitizeThread : InheritableAttr { + let Spellings = [GCC<"no_sanitize_thread">]; + let Subjects = SubjectList<[Function], ErrorDiag>; + let Documentation = [NoSanitizeThreadDocs]; + let ASTNode = 0; +} + +// Attribute to disable MemorySanitizer. No new spellings should be added +// to this list; the no_sanitize attribute should be extended instead. +def NoSanitizeMemory : InheritableAttr { + let Spellings = [Clang<"no_sanitize_memory">]; + let Subjects = SubjectList<[Function], ErrorDiag>; + let Documentation = [NoSanitizeMemoryDocs]; let ASTNode = 0; } diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td index ee212a9..20a52b4 100644 --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -13,16 +13,16 @@ // version control. // // To run clang-tblgen to generate the .rst file: -// clang-tblgen -gen-attr-docs -I <root>/llvm/tools/clang/include -// <root>/llvm/tools/clang/include/clang/Basic/Attr.td -o -// <root>/llvm/tools/clang/docs/AttributeReference.rst +// clang-tblgen -gen-attr-docs -I <root>/clang/include +// <root>/clang/include/clang/Basic/Attr.td -o +// <root>/clang/docs/AttributeReference.rst // // To run sphinx to generate the .html files (note that sphinx-build must be // available on the PATH): // Windows (from within the clang\docs directory): // make.bat html -// Non-Windows (from within the clang\docs directory): -// sphinx-build -b html _build/html +// Non-Windows (from within the clang/docs directory): +// sphinx-build -b html . _build/html def GlobalDocumentation { code Intro =[{.. @@ -3629,6 +3629,7 @@ instrumentations should not be applied. The attribute takes a list of string literals with the following accepted values: + * all values accepted by ``-fno-sanitize=``; * ``coverage``, to disable SanitizerCoverage instrumentation. diff --git a/clang/include/clang/Basic/BuiltinsPPC.def b/clang/include/clang/Basic/BuiltinsPPC.def index db71efc..cf8bdd2 100644 --- a/clang/include/clang/Basic/BuiltinsPPC.def +++ b/clang/include/clang/Basic/BuiltinsPPC.def @@ -1105,6 +1105,13 @@ UNALIASED_CUSTOM_BUILTIN(mma_disassemble_dmr, "vv*W1024*", false, UNALIASED_CUSTOM_BUILTIN(mma_build_dmr, "vW1024*VVVVVVVV", false, "mma,isa-future-instructions") +UNALIASED_CUSTOM_BUILTIN(mma_dmsha2hash, "vW1024*W1024*Ii", true, + "mma,isa-future-instructions") +UNALIASED_CUSTOM_BUILTIN(mma_dmsha3hash, "vW2048*Ii", true, + "mma,isa-future-instructions") +UNALIASED_CUSTOM_BUILTIN(mma_dmxxshapad, "vW1024*VIiIiIi", true, + "mma,isa-future-instructions") + // MMA builtins with positive/negative multiply/accumulate. UNALIASED_CUSTOM_MMA_BUILTIN(mma_xvf16ger2, "vW512*VV", "mma,paired-vector-memops") diff --git a/clang/include/clang/Basic/BuiltinsX86.td b/clang/include/clang/Basic/BuiltinsX86.td index 77e5995..e98bee2 100644 --- a/clang/include/clang/Basic/BuiltinsX86.td +++ b/clang/include/clang/Basic/BuiltinsX86.td @@ -1109,51 +1109,51 @@ let Features = "avx512vnni", Attributes = [NoThrow, Const, RequiredVectorWidth<5 } let Features = "avxvnniint8|avx10.2", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] in { - def vpdpbssd128 : X86Builtin<"_Vector<4, int>(_Vector<4, int>, _Vector<4, int>, _Vector<4, int>)">; + def vpdpbssd128 : X86Builtin<"_Vector<4, int>(_Vector<4, int>, _Vector<16, char>, _Vector<16, char>)">; } let Features = "avxvnniint8|avx10.2", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in { - def vpdpbssd256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<8, int>, _Vector<8, int>)">; + def vpdpbssd256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<32, char>, _Vector<32, char>)">; } let Features = "avxvnniint8|avx10.2", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] in { - def vpdpbssds128 : X86Builtin<"_Vector<4, int>(_Vector<4, int>, _Vector<4, int>, _Vector<4, int>)">; + def vpdpbssds128 : X86Builtin<"_Vector<4, int>(_Vector<4, int>, _Vector<16, char>, _Vector<16, char>)">; } let Features = "avxvnniint8|avx10.2", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in { - def vpdpbssds256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<8, int>, _Vector<8, int>)">; + def vpdpbssds256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<32, char>, _Vector<32, char>)">; } let Features = "avxvnniint8|avx10.2", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] in { - def vpdpbsud128 : X86Builtin<"_Vector<4, int>(_Vector<4, int>, _Vector<4, int>, _Vector<4, int>)">; + def vpdpbsud128 : X86Builtin<"_Vector<4, int>(_Vector<4, int>, _Vector<16, char>, _Vector<16, unsigned char>)">; } let Features = "avxvnniint8|avx10.2", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in { - def vpdpbsud256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<8, int>, _Vector<8, int>)">; + def vpdpbsud256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<32, char>, _Vector<32, unsigned char>)">; } let Features = "avxvnniint8|avx10.2", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] in { - def vpdpbsuds128 : X86Builtin<"_Vector<4, int>(_Vector<4, int>, _Vector<4, int>, _Vector<4, int>)">; + def vpdpbsuds128 : X86Builtin<"_Vector<4, int>(_Vector<4, int>, _Vector<16, char>, _Vector<16, unsigned char>)">; } let Features = "avxvnniint8|avx10.2", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in { - def vpdpbsuds256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<8, int>, _Vector<8, int>)">; + def vpdpbsuds256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<32, char>, _Vector<32, unsigned char>)">; } let Features = "avxvnniint8|avx10.2", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] in { - def vpdpbuud128 : X86Builtin<"_Vector<4, int>(_Vector<4, int>, _Vector<4, int>, _Vector<4, int>)">; + def vpdpbuud128 : X86Builtin<"_Vector<4, int>(_Vector<4, int>, _Vector<16, unsigned char>, _Vector<16, unsigned char>)">; } let Features = "avxvnniint8|avx10.2", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in { - def vpdpbuud256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<8, int>, _Vector<8, int>)">; + def vpdpbuud256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<32, unsigned char>, _Vector<32, unsigned char>)">; } let Features = "avxvnniint8|avx10.2", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] in { - def vpdpbuuds128 : X86Builtin<"_Vector<4, int>(_Vector<4, int>, _Vector<4, int>, _Vector<4, int>)">; + def vpdpbuuds128 : X86Builtin<"_Vector<4, int>(_Vector<4, int>, _Vector<16, unsigned char>, _Vector<16, unsigned char>)">; } let Features = "avxvnniint8|avx10.2", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in { - def vpdpbuuds256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<8, int>, _Vector<8, int>)">; + def vpdpbuuds256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<32, unsigned char>, _Vector<32, unsigned char>)">; } let Features = "movrs", Attributes = [NoThrow, Const] in { @@ -4282,12 +4282,12 @@ let Features = "avx10.2", Attributes = [NoThrow, Const, RequiredVectorWidth<256> let Features = "avx10.2", Attributes = [NoThrow, Const, RequiredVectorWidth<512>] in { def vdpphps512 : X86Builtin<"_Vector<16, float>(_Vector<16, float>, _Vector<32, _Float16>, _Vector<32, _Float16>)">; - def vpdpbssd512 : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<16, int>, _Vector<16, int>)">; - def vpdpbssds512 : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<16, int>, _Vector<16, int>)">; - def vpdpbsud512 : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<16, int>, _Vector<16, int>)">; - def vpdpbsuds512 : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<16, int>, _Vector<16, int>)">; - def vpdpbuud512 : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<16, int>, _Vector<16, int>)">; - def vpdpbuuds512 : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<16, int>, _Vector<16, int>)">; + def vpdpbssd512 : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<64, char>, _Vector<64, char>)">; + def vpdpbssds512 : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<64, char>, _Vector<64, char>)">; + def vpdpbsud512 : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<64, char>, _Vector<64, unsigned char>)">; + def vpdpbsuds512 : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<64, char>, _Vector<64, unsigned char>)">; + def vpdpbuud512 : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<64, unsigned char>, _Vector<64, unsigned char>)">; + def vpdpbuuds512 : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<64, unsigned char>, _Vector<64, unsigned char>)">; } let Features = "avx10.2", Attributes = [NoThrow, RequiredVectorWidth<512>] in { diff --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h index af26a04..e540040 100644 --- a/clang/include/clang/Basic/Diagnostic.h +++ b/clang/include/clang/Basic/Diagnostic.h @@ -25,6 +25,7 @@ #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringExtras.h" #include "llvm/ADT/iterator_range.h" #include "llvm/Support/Compiler.h" #include <cassert> @@ -1367,6 +1368,22 @@ inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, } inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, + const llvm::APSInt &Int) { + DB.AddString(toString(Int, /*Radix=*/10, Int.isSigned(), + /*formatAsCLiteral=*/false, + /*UpperCase=*/true, /*InsertSeparators=*/true)); + return DB; +} + +inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, + const llvm::APInt &Int) { + DB.AddString(toString(Int, /*Radix=*/10, /*Signed=*/false, + /*formatAsCLiteral=*/false, + /*UpperCase=*/true, /*InsertSeparators=*/true)); + return DB; +} + +inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, int I) { DB.AddTaggedVal(I, DiagnosticsEngine::ak_sint); return DB; diff --git a/clang/include/clang/Basic/PPCTypes.def b/clang/include/clang/Basic/PPCTypes.def index fc4155c..9c0fa91 100644 --- a/clang/include/clang/Basic/PPCTypes.def +++ b/clang/include/clang/Basic/PPCTypes.def @@ -30,6 +30,7 @@ #endif +PPC_VECTOR_MMA_TYPE(__dmr2048, DMR2048, 2048) PPC_VECTOR_MMA_TYPE(__dmr1024, DMR1024, 1024) PPC_VECTOR_MMA_TYPE(__vector_quad, VectorQuad, 512) PPC_VECTOR_VSX_TYPE(__vector_pair, VectorPair, 256) diff --git a/clang/include/clang/Basic/TokenKinds.def b/clang/include/clang/Basic/TokenKinds.def index 9d1a23d..564d601 100644 --- a/clang/include/clang/Basic/TokenKinds.def +++ b/clang/include/clang/Basic/TokenKinds.def @@ -552,10 +552,10 @@ TYPE_TRAIT_1(__can_pass_in_regs, CanPassInRegs, KEYCXX) TYPE_TRAIT_2(__reference_binds_to_temporary, ReferenceBindsToTemporary, KEYCXX) TYPE_TRAIT_2(__reference_constructs_from_temporary, ReferenceConstructsFromTemporary, KEYCXX) TYPE_TRAIT_2(__reference_converts_from_temporary, ReferenceConvertsFromTemporary, KEYCXX) -TYPE_TRAIT_2(__builtin_lt_synthesises_from_spaceship, LtSynthesisesFromSpaceship, KEYCXX) -TYPE_TRAIT_2(__builtin_le_synthesises_from_spaceship, LeSynthesisesFromSpaceship, KEYCXX) -TYPE_TRAIT_2(__builtin_gt_synthesises_from_spaceship, GtSynthesisesFromSpaceship, KEYCXX) -TYPE_TRAIT_2(__builtin_ge_synthesises_from_spaceship, GeSynthesisesFromSpaceship, KEYCXX) +TYPE_TRAIT_2(__builtin_lt_synthesizes_from_spaceship, LtSynthesizesFromSpaceship, KEYCXX) +TYPE_TRAIT_2(__builtin_le_synthesizes_from_spaceship, LeSynthesizesFromSpaceship, KEYCXX) +TYPE_TRAIT_2(__builtin_gt_synthesizes_from_spaceship, GtSynthesizesFromSpaceship, KEYCXX) +TYPE_TRAIT_2(__builtin_ge_synthesizes_from_spaceship, GeSynthesizesFromSpaceship, KEYCXX) // IsDeducible is only used internally by clang for CTAD implementation and // is not exposed to users. TYPE_TRAIT_2(/*EmptySpellingName*/, IsDeducible, KEYCXX) diff --git a/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h b/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h index a3f167e..3f83c30 100644 --- a/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h +++ b/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h @@ -243,6 +243,13 @@ public: return cir::AllocaOp::create(*this, loc, addrType, type, name, alignment); } + mlir::Value createAlloca(mlir::Location loc, cir::PointerType addrType, + mlir::Type type, llvm::StringRef name, + clang::CharUnits alignment) { + mlir::IntegerAttr alignmentAttr = getAlignmentAttr(alignment); + return createAlloca(loc, addrType, type, name, alignmentAttr); + } + /// Get constant address of a global variable as an MLIR attribute. /// This wrapper infers the attribute type through the global op. cir::GlobalViewAttr getGlobalViewAttr(cir::GlobalOp globalOp, diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td index e1be08c..f857cf8 100644 --- a/clang/include/clang/CIR/Dialect/IR/CIROps.td +++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td @@ -209,9 +209,10 @@ def CIR_CastOp : CIR_Op<"cast", [ Example: ```mlir - %4 = cir.cast(int_to_bool, %3 : i32), !cir.bool + %4 = cir.cast int_to_bool %3 : i32 -> !cir.bool ... - %x = cir.cast(array_to_ptrdecay, %0 : !cir.ptr<!cir.array<i32 x 10>>), !cir.ptr<i32> + %x = cir.cast array_to_ptrdecay %0 + : !cir.ptr<!cir.array<i32 x 10>> -> !cir.ptr<i32> ``` }]; @@ -219,8 +220,7 @@ def CIR_CastOp : CIR_Op<"cast", [ let results = (outs CIR_AnyType:$result); let assemblyFormat = [{ - `(` $kind `,` $src `:` type($src) `)` - `,` type($result) attr-dict + $kind $src `:` type($src) `->` type($result) attr-dict }]; // The input and output types should match the cast kind. @@ -1176,7 +1176,7 @@ def CIR_GotoOp : CIR_Op<"goto", [Terminator]> { ```mlir cir.scope { // REGION #1 %2 = cir.load %0 : !cir.ptr<!s32i>, !s32i - %3 = cir.cast(int_to_bool, %2 : !s32i), !cir.bool + %3 = cir.cast int_to_bool %2 : !s32i -> !cir.bool cir.if %3 { cir.goto "label" } @@ -3994,9 +3994,9 @@ def CIR_VAStartOp : CIR_Op<"va_start"> { ```mlir // %args : !cir.ptr<!cir.array<!rec___va_list_tag x 1>> - %p = cir.cast(array_to_ptrdecay, %args - : !cir.ptr<!cir.array<!rec___va_list_tag x 1>>), - !cir.ptr<!rec___va_list_tag> + %p = cir.cast array_to_ptrdecay %args + : !cir.ptr<!cir.array<!rec___va_list_tag x 1>>) + -> !cir.ptr<!rec___va_list_tag> %count = cir.load %0 : !cir.ptr<!s32i>, !s32i cir.va_start %p %count : !cir.ptr<!rec___va_list_tag>, !s32i ``` @@ -4033,9 +4033,9 @@ def CIR_VAEndOp : CIR_Op<"va_end"> { Example: ```mlir // %args : !cir.ptr<!cir.array<!rec___va_list_tag x 1>> - %p = cir.cast(array_to_ptrdecay, %args - : !cir.ptr<!cir.array<!rec___va_list_tag x 1>>), - !cir.ptr<!rec___va_list_tag> + %p = cir.cast array_to_ptrdecay %args + : !cir.ptr<!cir.array<!rec___va_list_tag x 1>> + -> !cir.ptr<!rec___va_list_tag> cir.va_end %p : !cir.ptr<!rec___va_list_tag> ``` }]; @@ -4068,9 +4068,9 @@ def CIR_VAArgOp : CIR_Op<"va_arg"> { Example: ```mlir // %args : !cir.ptr<!cir.array<!rec___va_list_tag x 1>> - %p = cir.cast(array_to_ptrdecay, %args - : !cir.ptr<!cir.array<!rec___va_list_tag x 1>>), - !cir.ptr<!rec___va_list_tag> + %p = cir.cast array_to_ptrdecay %args + : !cir.ptr<!cir.array<!rec___va_list_tag x 1>> + -> !cir.ptr<!rec___va_list_tag> cir.va.start %p : !cir.ptr<!rec___va_list_tag> // Fetch an `int` from the vararg list. diff --git a/clang/include/clang/CIR/MissingFeatures.h b/clang/include/clang/CIR/MissingFeatures.h index 7e59989..7a6c084 100644 --- a/clang/include/clang/CIR/MissingFeatures.h +++ b/clang/include/clang/CIR/MissingFeatures.h @@ -37,6 +37,8 @@ struct MissingFeatures { static bool opGlobalDLLImportExport() { return false; } static bool opGlobalPartition() { return false; } static bool opGlobalUsedOrCompilerUsed() { return false; } + static bool setDSOLocal() { return false; } + static bool setComdat() { return false; } static bool supportIFuncAttr() { return false; } static bool supportVisibility() { return false; } @@ -246,7 +248,6 @@ struct MissingFeatures { static bool metaDataNode() { return false; } static bool moduleNameHash() { return false; } static bool msabi() { return false; } - static bool needsGlobalCtorDtor() { return false; } static bool nrvo() { return false; } static bool objCBlocks() { return false; } static bool objCGC() { return false; } diff --git a/clang/include/clang/CodeGen/ModuleBuilder.h b/clang/include/clang/CodeGen/ModuleBuilder.h index 59b9840..f1b8229 100644 --- a/clang/include/clang/CodeGen/ModuleBuilder.h +++ b/clang/include/clang/CodeGen/ModuleBuilder.h @@ -52,6 +52,12 @@ namespace CodeGen { class CodeGenerator : public ASTConsumer { virtual void anchor(); +protected: + /// True if we've finished generating IR. This prevents us from generating + /// additional LLVM IR after emitting output in HandleTranslationUnit. This + /// can happen when Clang plugins trigger additional AST deserialization. + bool IRGenFinished = false; + public: /// Return an opaque reference to the CodeGenModule object, which can /// be used in various secondary APIs. It is valid as long as the diff --git a/clang/include/clang/Driver/CommonArgs.h b/clang/include/clang/Driver/CommonArgs.h index 40ae406..23426c0 100644 --- a/clang/include/clang/Driver/CommonArgs.h +++ b/clang/include/clang/Driver/CommonArgs.h @@ -304,6 +304,11 @@ std::string complexRangeKindToStr(LangOptions::ComplexRangeKind Range); // Render a frontend option corresponding to ComplexRangeKind. std::string renderComplexRangeOption(LangOptions::ComplexRangeKind Range); +// Set the complex range and output a warning as needed. +void setComplexRange(const Driver &D, StringRef NewOpt, + LangOptions::ComplexRangeKind NewRange, StringRef &LastOpt, + LangOptions::ComplexRangeKind &Range); + } // end namespace tools } // end namespace driver } // end namespace clang diff --git a/clang/include/clang/Serialization/ASTBitCodes.h b/clang/include/clang/Serialization/ASTBitCodes.h index 99864c7..5d09d55 100644 --- a/clang/include/clang/Serialization/ASTBitCodes.h +++ b/clang/include/clang/Serialization/ASTBitCodes.h @@ -1160,7 +1160,7 @@ enum PredefinedTypeIDs { /// /// Type IDs for non-predefined types will start at /// NUM_PREDEF_TYPE_IDs. -const unsigned NUM_PREDEF_TYPE_IDS = 513; +const unsigned NUM_PREDEF_TYPE_IDS = 514; // Ensure we do not overrun the predefined types we reserved // in the enum PredefinedTypeIDs above. diff --git a/clang/include/clang/Serialization/ModuleCache.h b/clang/include/clang/Serialization/ModuleCache.h index 3117d95..ec052c5 100644 --- a/clang/include/clang/Serialization/ModuleCache.h +++ b/clang/include/clang/Serialization/ModuleCache.h @@ -45,11 +45,15 @@ public: /// were validated. virtual void updateModuleTimestamp(StringRef ModuleFilename) = 0; + /// Prune module files that haven't been accessed in a long time. + virtual void maybePrune(StringRef Path, time_t PruneInterval, + time_t PruneAfter) = 0; + /// Returns this process's view of the module cache. virtual InMemoryModuleCache &getInMemoryModuleCache() = 0; virtual const InMemoryModuleCache &getInMemoryModuleCache() const = 0; - // TODO: Virtualize writing/reading PCM files, pruning, etc. + // TODO: Virtualize writing/reading PCM files, etc. virtual ~ModuleCache() = default; }; @@ -59,6 +63,9 @@ public: /// \c CompilerInstance instances participating in building modules for single /// translation unit in order to share the same \c InMemoryModuleCache. IntrusiveRefCntPtr<ModuleCache> createCrossProcessModuleCache(); + +/// Shared implementation of `ModuleCache::maybePrune()`. +void maybePruneImpl(StringRef Path, time_t PruneInterval, time_t PruneAfter); } // namespace clang #endif |