Skip to content

Commit 02316d2

Browse files
authored
Merge branch 'main' into vplan-uniform-general
2 parents de47c85 + e8f590e commit 02316d2

File tree

252 files changed

+5654
-2461
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

252 files changed

+5654
-2461
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ New Compiler Flags
261261
The feature has `existed <https://clang.llvm.org/docs/SourceBasedCodeCoverage.html#running-the-instrumented-program>`_)
262262
for a while and this is just a user facing option.
263263

264+
- New option ``-ftime-report-json`` added which outputs the same timing data as `-ftime-report` but formatted as JSON.
265+
264266
Deprecated Compiler Flags
265267
-------------------------
266268

clang/include/clang/AST/Mangle.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ struct ThisAdjustment;
4040
struct ThunkInfo;
4141
class VarDecl;
4242

43+
/// Extract mangling function name from MangleContext such that swift can call
44+
/// it to prepare for ObjCDirect in swift.
45+
void mangleObjCMethodName(raw_ostream &OS, bool includePrefixByte,
46+
bool isInstanceMethod, StringRef ClassName,
47+
std::optional<StringRef> CategoryName,
48+
StringRef MethodName);
49+
4350
/// MangleContext - Context for tracking state which persists across multiple
4451
/// calls to the C++ name mangler.
4552
class MangleContext {

clang/include/clang/Basic/Attr.td

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3856,6 +3856,7 @@ def AssertCapability : InheritableAttr {
38563856
let ParseArgumentsAsUnevaluated = 1;
38573857
let InheritEvenIfAlreadyPresent = 1;
38583858
let Args = [VariadicExprArgument<"Args">];
3859+
let AcceptsExprPack = 1;
38593860
let Accessors = [Accessor<"isShared",
38603861
[Clang<"assert_shared_capability", 0>,
38613862
GNU<"assert_shared_lock">]>];
@@ -3873,6 +3874,7 @@ def AcquireCapability : InheritableAttr {
38733874
let ParseArgumentsAsUnevaluated = 1;
38743875
let InheritEvenIfAlreadyPresent = 1;
38753876
let Args = [VariadicExprArgument<"Args">];
3877+
let AcceptsExprPack = 1;
38763878
let Accessors = [Accessor<"isShared",
38773879
[Clang<"acquire_shared_capability", 0>,
38783880
GNU<"shared_lock_function">]>];
@@ -3890,6 +3892,7 @@ def TryAcquireCapability : InheritableAttr {
38903892
let ParseArgumentsAsUnevaluated = 1;
38913893
let InheritEvenIfAlreadyPresent = 1;
38923894
let Args = [ExprArgument<"SuccessValue">, VariadicExprArgument<"Args">];
3895+
let AcceptsExprPack = 1;
38933896
let Accessors = [Accessor<"isShared",
38943897
[Clang<"try_acquire_shared_capability", 0>,
38953898
GNU<"shared_trylock_function">]>];
@@ -3907,6 +3910,7 @@ def ReleaseCapability : InheritableAttr {
39073910
let ParseArgumentsAsUnevaluated = 1;
39083911
let InheritEvenIfAlreadyPresent = 1;
39093912
let Args = [VariadicExprArgument<"Args">];
3913+
let AcceptsExprPack = 1;
39103914
let Accessors = [Accessor<"isShared",
39113915
[Clang<"release_shared_capability", 0>]>,
39123916
Accessor<"isGeneric",
@@ -3921,6 +3925,7 @@ def RequiresCapability : InheritableAttr {
39213925
Clang<"requires_shared_capability", 0>,
39223926
Clang<"shared_locks_required", 0>];
39233927
let Args = [VariadicExprArgument<"Args">];
3928+
let AcceptsExprPack = 1;
39243929
let LateParsed = LateAttrParseStandard;
39253930
let TemplateDependent = 1;
39263931
let ParseArgumentsAsUnevaluated = 1;
@@ -3963,6 +3968,7 @@ def PtGuardedBy : InheritableAttr {
39633968
def AcquiredAfter : InheritableAttr {
39643969
let Spellings = [GNU<"acquired_after">];
39653970
let Args = [VariadicExprArgument<"Args">];
3971+
let AcceptsExprPack = 1;
39663972
let LateParsed = LateAttrParseExperimentalExt;
39673973
let TemplateDependent = 1;
39683974
let ParseArgumentsAsUnevaluated = 1;
@@ -3974,6 +3980,7 @@ def AcquiredAfter : InheritableAttr {
39743980
def AcquiredBefore : InheritableAttr {
39753981
let Spellings = [GNU<"acquired_before">];
39763982
let Args = [VariadicExprArgument<"Args">];
3983+
let AcceptsExprPack = 1;
39773984
let LateParsed = LateAttrParseExperimentalExt;
39783985
let TemplateDependent = 1;
39793986
let ParseArgumentsAsUnevaluated = 1;
@@ -3995,6 +4002,7 @@ def LockReturned : InheritableAttr {
39954002
def LocksExcluded : InheritableAttr {
39964003
let Spellings = [GNU<"locks_excluded">];
39974004
let Args = [VariadicExprArgument<"Args">];
4005+
let AcceptsExprPack = 1;
39984006
let LateParsed = LateAttrParseStandard;
39994007
let TemplateDependent = 1;
40004008
let ParseArgumentsAsUnevaluated = 1;
@@ -4752,20 +4760,25 @@ def HLSLResourceBinding: InheritableAttr {
47524760

47534761
private:
47544762
RegisterType RegType;
4755-
unsigned SlotNumber;
4763+
std::optional<unsigned> SlotNumber;
47564764
unsigned SpaceNumber;
47574765

47584766
public:
4759-
void setBinding(RegisterType RT, unsigned SlotNum, unsigned SpaceNum) {
4767+
void setBinding(RegisterType RT, std::optional<unsigned> SlotNum, unsigned SpaceNum) {
47604768
RegType = RT;
47614769
SlotNumber = SlotNum;
47624770
SpaceNumber = SpaceNum;
47634771
}
4772+
bool isImplicit() const {
4773+
return !SlotNumber.has_value();
4774+
}
47644775
RegisterType getRegisterType() const {
4776+
assert(!isImplicit() && "binding does not have register slot");
47654777
return RegType;
47664778
}
47674779
unsigned getSlotNumber() const {
4768-
return SlotNumber;
4780+
assert(!isImplicit() && "binding does not have register slot");
4781+
return SlotNumber.value();
47694782
}
47704783
unsigned getSpaceNumber() const {
47714784
return SpaceNumber;

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,9 @@ CODEGENOPT(SpeculativeLoadHardening, 1, 0) ///< Enable speculative load hardenin
318318
CODEGENOPT(FineGrainedBitfieldAccesses, 1, 0) ///< Enable fine-grained bitfield accesses.
319319
CODEGENOPT(StrictEnums , 1, 0) ///< Optimize based on strict enum definition.
320320
CODEGENOPT(StrictVTablePointers, 1, 0) ///< Optimize based on the strict vtable pointers
321-
CODEGENOPT(TimePasses , 1, 0) ///< Set when -ftime-report or -ftime-report= is enabled.
321+
CODEGENOPT(TimePasses , 1, 0) ///< Set when -ftime-report or -ftime-report= or -ftime-report-json is enabled.
322322
CODEGENOPT(TimePassesPerRun , 1, 0) ///< Set when -ftime-report=per-pass-run is enabled.
323+
CODEGENOPT(TimePassesJson , 1, 0) ///< Set when -ftime-report-json is enabled.
323324
CODEGENOPT(TimeTrace , 1, 0) ///< Set when -ftime-trace is enabled.
324325
VALUE_CODEGENOPT(TimeTraceGranularity, 32, 500) ///< Minimum time granularity (in microseconds),
325326
///< traced by time profiler

clang/include/clang/Basic/TargetOSMacros.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,7 @@ TARGET_OS(TARGET_OS_NANO, Triple.isWatchOS())
5353
TARGET_OS(TARGET_IPHONE_SIMULATOR, Triple.isSimulatorEnvironment())
5454
TARGET_OS(TARGET_OS_UIKITFORMAC, Triple.isMacCatalystEnvironment())
5555

56+
// UEFI target.
57+
TARGET_OS(TARGET_OS_UEFI, Triple.isUEFI())
58+
5659
#undef TARGET_OS

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -610,9 +610,9 @@ def ConditionOp : CIR_Op<"condition", [
610610
//===----------------------------------------------------------------------===//
611611

612612
def YieldOp : CIR_Op<"yield", [ReturnLike, Terminator,
613-
ParentOneOf<["IfOp", "ScopeOp", "SwitchOp",
614-
"WhileOp", "ForOp", "CaseOp",
615-
"DoWhileOp"]>]> {
613+
ParentOneOf<["CaseOp", "DoWhileOp", "ForOp",
614+
"IfOp", "ScopeOp", "SwitchOp",
615+
"TernaryOp", "WhileOp"]>]> {
616616
let summary = "Represents the default branching behaviour of a region";
617617
let description = [{
618618
The `cir.yield` operation terminates regions on different CIR operations,
@@ -1462,6 +1462,63 @@ def SelectOp : CIR_Op<"select", [Pure,
14621462
}];
14631463
}
14641464

1465+
//===----------------------------------------------------------------------===//
1466+
// TernaryOp
1467+
//===----------------------------------------------------------------------===//
1468+
1469+
def TernaryOp : CIR_Op<"ternary",
1470+
[DeclareOpInterfaceMethods<RegionBranchOpInterface>,
1471+
RecursivelySpeculatable, AutomaticAllocationScope, NoRegionArguments]> {
1472+
let summary = "The `cond ? a : b` C/C++ ternary operation";
1473+
let description = [{
1474+
The `cir.ternary` operation represents C/C++ ternary, much like a `select`
1475+
operation. The first argument is a `cir.bool` condition to evaluate, followed
1476+
by two regions to execute (true or false). This is different from `cir.if`
1477+
since each region is one block sized and the `cir.yield` closing the block
1478+
scope should have one argument.
1479+
1480+
`cir.ternary` also represents the GNU binary conditional operator ?: which
1481+
reuses the parent operation for both the condition and the true branch to
1482+
evaluate it only once.
1483+
1484+
Example:
1485+
1486+
```mlir
1487+
// cond = a && b;
1488+
1489+
%x = cir.ternary (%cond, true_region {
1490+
...
1491+
cir.yield %a : i32
1492+
}, false_region {
1493+
...
1494+
cir.yield %b : i32
1495+
}) -> i32
1496+
```
1497+
}];
1498+
let arguments = (ins CIR_BoolType:$cond);
1499+
let regions = (region AnyRegion:$trueRegion,
1500+
AnyRegion:$falseRegion);
1501+
let results = (outs Optional<CIR_AnyType>:$result);
1502+
1503+
let skipDefaultBuilders = 1;
1504+
let builders = [
1505+
OpBuilder<(ins "mlir::Value":$cond,
1506+
"llvm::function_ref<void(mlir::OpBuilder &, mlir::Location)>":$trueBuilder,
1507+
"llvm::function_ref<void(mlir::OpBuilder &, mlir::Location)>":$falseBuilder)
1508+
>
1509+
];
1510+
1511+
// All constraints already verified elsewhere.
1512+
let hasVerifier = 0;
1513+
1514+
let assemblyFormat = [{
1515+
`(` $cond `,`
1516+
`true` $trueRegion `,`
1517+
`false` $falseRegion
1518+
`)` `:` functional-type(operands, results) attr-dict
1519+
}];
1520+
}
1521+
14651522
//===----------------------------------------------------------------------===//
14661523
// GlobalOp
14671524
//===----------------------------------------------------------------------===//

clang/include/clang/Driver/Options.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4083,6 +4083,11 @@ defm ms_tls_guards : BoolFOption<"ms-tls-guards",
40834083
def ftime_report : Flag<["-"], "ftime-report">, Group<f_Group>,
40844084
Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
40854085
MarshallingInfoFlag<CodeGenOpts<"TimePasses">>;
4086+
def ftime_report_json
4087+
: Flag<["-"], "ftime-report-json">,
4088+
Group<f_Group>,
4089+
Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
4090+
MarshallingInfoFlag<CodeGenOpts<"TimePassesJson">>;
40864091
def ftime_report_EQ: Joined<["-"], "ftime-report=">, Group<f_Group>,
40874092
Visibility<[ClangOption, CC1Option]>, Values<"per-pass,per-pass-run">,
40884093
MarshallingInfoFlag<CodeGenOpts<"TimePassesPerRun">>,

clang/include/clang/Lex/HLSLRootSignatureTokenKinds.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
TOK(invalid, "invalid identifier")
5656
TOK(end_of_stream, "end of stream")
5757
TOK(int_literal, "integer literal")
58+
TOK(float_literal, "float literal")
5859

5960
// Register Tokens:
6061
TOK(bReg, "b register")

clang/lib/AST/Mangle.cpp

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,23 @@
2929

3030
using namespace clang;
3131

32+
void clang::mangleObjCMethodName(raw_ostream &OS, bool includePrefixByte,
33+
bool isInstanceMethod, StringRef ClassName,
34+
std::optional<StringRef> CategoryName,
35+
StringRef MethodName) {
36+
// \01+[ContainerName(CategoryName) SelectorName]
37+
if (includePrefixByte)
38+
OS << "\01";
39+
OS << (isInstanceMethod ? '-' : '+');
40+
OS << '[';
41+
OS << ClassName;
42+
if (CategoryName)
43+
OS << "(" << *CategoryName << ")";
44+
OS << " ";
45+
OS << MethodName;
46+
OS << ']';
47+
}
48+
3249
// FIXME: For blocks we currently mimic GCC's mangling scheme, which leaves
3350
// much to be desired. Come up with a better mangling scheme.
3451

@@ -362,26 +379,26 @@ void MangleContext::mangleObjCMethodName(const ObjCMethodDecl *MD,
362379
}
363380

364381
// \01+[ContainerName(CategoryName) SelectorName]
365-
if (includePrefixByte) {
366-
OS << '\01';
367-
}
368-
OS << (MD->isInstanceMethod() ? '-' : '+') << '[';
382+
auto CategoryName = std::optional<StringRef>();
383+
StringRef ClassName = "";
369384
if (const auto *CID = MD->getCategory()) {
370385
if (const auto *CI = CID->getClassInterface()) {
371-
OS << CI->getName();
386+
ClassName = CI->getName();
372387
if (includeCategoryNamespace) {
373-
OS << '(' << *CID << ')';
388+
CategoryName = CID->getName();
374389
}
375390
}
376391
} else if (const auto *CD =
377392
dyn_cast<ObjCContainerDecl>(MD->getDeclContext())) {
378-
OS << CD->getName();
393+
ClassName = CD->getName();
379394
} else {
380395
llvm_unreachable("Unexpected ObjC method decl context");
381396
}
382-
OS << ' ';
383-
MD->getSelector().print(OS);
384-
OS << ']';
397+
std::string MethodName;
398+
llvm::raw_string_ostream MethodNameOS(MethodName);
399+
MD->getSelector().print(MethodNameOS);
400+
clang::mangleObjCMethodName(OS, includePrefixByte, MD->isInstanceMethod(),
401+
ClassName, CategoryName, MethodName);
385402
}
386403

387404
void MangleContext::mangleObjCMethodNameAsSourceName(const ObjCMethodDecl *MD,

clang/lib/Basic/Targets/X86.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,8 +837,23 @@ class LLVM_LIBRARY_VISIBILITY UEFIX86_64TargetInfo
837837
public:
838838
UEFIX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
839839
: UEFITargetInfo<X86_64TargetInfo>(Triple, Opts) {
840+
// The UEFI spec does not mandate specific C++ ABI, integer widths, or
841+
// alignment. We are setting these defaults to match the Windows target as
842+
// it is the only way to build EFI applications with Clang/LLVM today. We
843+
// intend to offer flexibility by supporting choices that are not default in
844+
// Windows target in the future.
840845
this->TheCXXABI.set(TargetCXXABI::Microsoft);
841-
this->MaxTLSAlign = 8192u * this->getCharWidth();
846+
LongWidth = LongAlign = 32;
847+
DoubleAlign = LongLongAlign = 64;
848+
LongDoubleWidth = LongDoubleAlign = 64;
849+
LongDoubleFormat = &llvm::APFloat::IEEEdouble();
850+
IntMaxType = SignedLongLong;
851+
Int64Type = SignedLongLong;
852+
SizeType = UnsignedLongLong;
853+
PtrDiffType = SignedLongLong;
854+
IntPtrType = SignedLongLong;
855+
WCharType = UnsignedShort;
856+
WIntType = UnsignedShort;
842857
this->resetDataLayout("e-m:w-p270:32:32-p271:32:32-p272:64:64-"
843858
"i64:64-i128:128-f80:128-n8:16:32:64-S128");
844859
}

0 commit comments

Comments
 (0)