Skip to content

Commit ee9cd6e

Browse files
committed
merge main into amd-staging
2 parents 021b7c9 + e8a1162 commit ee9cd6e

File tree

72 files changed

+2886
-425
lines changed

Some content is hidden

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

72 files changed

+2886
-425
lines changed

clang/docs/ThreadSafetyAnalysis.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ require exclusive access, while read operations require only shared access.
118118
At any given moment during program execution, a thread holds a specific set of
119119
capabilities (e.g. the set of mutexes that it has locked.) These act like keys
120120
or tokens that allow the thread to access a given resource. Just like physical
121-
security keys, a thread cannot make copy of a capability, nor can it destroy
121+
security keys, a thread cannot make a copy of a capability, nor can it destroy
122122
one. A thread can only release a capability to another thread, or acquire one
123123
from another thread. The annotations are deliberately agnostic about the
124124
exact mechanism used to acquire and release capabilities; it assumes that the
@@ -131,7 +131,7 @@ by calculating an approximation of that set, called the *capability
131131
environment*. The capability environment is calculated for every program point,
132132
and describes the set of capabilities that are statically known to be held, or
133133
not held, at that particular point. This environment is a conservative
134-
approximation of the full set of capabilities that will actually held by a
134+
approximation of the full set of capabilities that will actually be held by a
135135
thread at run-time.
136136

137137

@@ -369,7 +369,7 @@ thread-safe, but too complicated for the analysis to understand. Reasons for
369369
void unsafeIncrement() NO_THREAD_SAFETY_ANALYSIS { a++; }
370370
};
371371

372-
Unlike the other attributes, NO_THREAD_SAFETY_ANALYSIS is not part of the
372+
Unlike the other attributes, ``NO_THREAD_SAFETY_ANALYSIS`` is not part of the
373373
interface of a function, and should thus be placed on the function definition
374374
(in the ``.cc`` or ``.cpp`` file) rather than on the function declaration
375375
(in the header).
@@ -509,7 +509,7 @@ ASSERT_CAPABILITY(...) and ASSERT_SHARED_CAPABILITY(...)
509509
*Previously:* ``ASSERT_EXCLUSIVE_LOCK``, ``ASSERT_SHARED_LOCK``
510510

511511
These are attributes on a function or method which asserts the calling thread
512-
already holds the given capability, for example by performing a run-time test
512+
already holds the given capability, for example, by performing a run-time test
513513
and terminating if the capability is not held. Presence of this annotation
514514
causes the analysis to assume the capability is held after calls to the
515515
annotated function. See :ref:`mutexheader`, below, for example uses.
@@ -554,19 +554,19 @@ Negative Capabilities
554554
=====================
555555

556556
Thread Safety Analysis is designed to prevent both race conditions and
557-
deadlock. The GUARDED_BY and REQUIRES attributes prevent race conditions, by
557+
deadlock. The ``GUARDED_BY`` and ``REQUIRES`` attributes prevent race conditions, by
558558
ensuring that a capability is held before reading or writing to guarded data,
559-
and the EXCLUDES attribute prevents deadlock, by making sure that a mutex is
559+
and the ``EXCLUDES`` attribute prevents deadlock, by making sure that a mutex is
560560
*not* held.
561561

562-
However, EXCLUDES is an optional attribute, and does not provide the same
563-
safety guarantee as REQUIRES. In particular:
562+
However, ``EXCLUDES`` is an optional attribute, and does not provide the same
563+
safety guarantee as ``REQUIRES``. In particular:
564564

565565
* A function which acquires a capability does not have to exclude it.
566566
* A function which calls a function that excludes a capability does not
567-
have transitively exclude that capability.
567+
have to transitively exclude that capability.
568568

569-
As a result, EXCLUDES can easily produce false negatives:
569+
As a result, ``EXCLUDES`` can easily produce false negatives:
570570

571571
.. code-block:: c++
572572

@@ -594,8 +594,8 @@ As a result, EXCLUDES can easily produce false negatives:
594594
};
595595

596596

597-
Negative requirements are an alternative EXCLUDES that provide
598-
a stronger safety guarantee. A negative requirement uses the REQUIRES
597+
Negative requirements are an alternative to ``EXCLUDES`` that provide
598+
a stronger safety guarantee. A negative requirement uses the ``REQUIRES``
599599
attribute, in conjunction with the ``!`` operator, to indicate that a capability
600600
should *not* be held.
601601

@@ -642,7 +642,7 @@ Frequently Asked Questions
642642

643643
(A) Attributes are part of the formal interface of a function, and should
644644
always go in the header, where they are visible to anything that includes
645-
the header. Attributes in the .cpp file are not visible outside of the
645+
the header. Attributes in the ``.cpp`` file are not visible outside of the
646646
immediate translation unit, which leads to false negatives and false positives.
647647

648648

@@ -684,7 +684,7 @@ Private Mutexes
684684
---------------
685685

686686
Good software engineering practice dictates that mutexes should be private
687-
members, because the locking mechanism used by a thread-safe class is part of
687+
members because the locking mechanism used by a thread-safe class is part of
688688
its internal implementation. However, private mutexes can sometimes leak into
689689
the public interface of a class.
690690
Thread safety attributes follow normal C++ access restrictions, so if ``mu``

clang/include/clang/Parse/Parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7677,7 +7677,7 @@ class Parser : public CodeCompletionHandler {
76777677
/// [GNU] asm-clobbers:
76787678
/// asm-string-literal
76797679
/// asm-clobbers ',' asm-string-literal
7680-
/// \endverbatim
7680+
/// \endverbatim
76817681
///
76827682
StmtResult ParseAsmStatement(bool &msAsm);
76837683

clang/lib/Basic/Targets/BPF.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ void BPFTargetInfo::getTargetDefines(const LangOptions &Opts,
7575
Builder.defineMacro("__BPF_FEATURE_GOTOL");
7676
Builder.defineMacro("__BPF_FEATURE_ST");
7777
Builder.defineMacro("__BPF_FEATURE_LOAD_ACQ_STORE_REL");
78+
Builder.defineMacro("__BPF_FEATURE_GOTOX");
7879
}
7980
}
8081

clang/lib/CIR/CodeGen/CIRGenBuilder.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
108108

109109
cir::LongDoubleType getLongDoubleTy(const llvm::fltSemantics &format) const {
110110
if (&format == &llvm::APFloat::IEEEdouble())
111-
return cir::LongDoubleType::get(getContext(), typeCache.DoubleTy);
111+
return cir::LongDoubleType::get(getContext(), typeCache.doubleTy);
112112
if (&format == &llvm::APFloat::x87DoubleExtended())
113-
return cir::LongDoubleType::get(getContext(), typeCache.FP80Ty);
113+
return cir::LongDoubleType::get(getContext(), typeCache.fP80Ty);
114114
if (&format == &llvm::APFloat::IEEEquad())
115-
return cir::LongDoubleType::get(getContext(), typeCache.FP128Ty);
115+
return cir::LongDoubleType::get(getContext(), typeCache.fP128Ty);
116116
if (&format == &llvm::APFloat::PPCDoubleDouble())
117117
llvm_unreachable("NYI: PPC double-double format for long double");
118118
llvm_unreachable("Unsupported format for long double");
@@ -258,17 +258,17 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
258258
}
259259
}
260260

261-
cir::VoidType getVoidTy() { return typeCache.VoidTy; }
261+
cir::VoidType getVoidTy() { return typeCache.voidTy; }
262262

263-
cir::IntType getSInt8Ty() { return typeCache.SInt8Ty; }
264-
cir::IntType getSInt16Ty() { return typeCache.SInt16Ty; }
265-
cir::IntType getSInt32Ty() { return typeCache.SInt32Ty; }
266-
cir::IntType getSInt64Ty() { return typeCache.SInt64Ty; }
263+
cir::IntType getSInt8Ty() { return typeCache.sInt8Ty; }
264+
cir::IntType getSInt16Ty() { return typeCache.sInt16Ty; }
265+
cir::IntType getSInt32Ty() { return typeCache.sInt32Ty; }
266+
cir::IntType getSInt64Ty() { return typeCache.sInt64Ty; }
267267

268-
cir::IntType getUInt8Ty() { return typeCache.UInt8Ty; }
269-
cir::IntType getUInt16Ty() { return typeCache.UInt16Ty; }
270-
cir::IntType getUInt32Ty() { return typeCache.UInt32Ty; }
271-
cir::IntType getUInt64Ty() { return typeCache.UInt64Ty; }
268+
cir::IntType getUInt8Ty() { return typeCache.uInt8Ty; }
269+
cir::IntType getUInt16Ty() { return typeCache.uInt16Ty; }
270+
cir::IntType getUInt32Ty() { return typeCache.uInt32Ty; }
271+
cir::IntType getUInt64Ty() { return typeCache.uInt64Ty; }
272272

273273
cir::ConstantOp getConstInt(mlir::Location loc, llvm::APSInt intVal);
274274

@@ -280,21 +280,21 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
280280
llvm::APFloat fpVal);
281281

282282
bool isInt8Ty(mlir::Type i) {
283-
return i == typeCache.UInt8Ty || i == typeCache.SInt8Ty;
283+
return i == typeCache.uInt8Ty || i == typeCache.sInt8Ty;
284284
}
285285
bool isInt16Ty(mlir::Type i) {
286-
return i == typeCache.UInt16Ty || i == typeCache.SInt16Ty;
286+
return i == typeCache.uInt16Ty || i == typeCache.sInt16Ty;
287287
}
288288
bool isInt32Ty(mlir::Type i) {
289-
return i == typeCache.UInt32Ty || i == typeCache.SInt32Ty;
289+
return i == typeCache.uInt32Ty || i == typeCache.sInt32Ty;
290290
}
291291
bool isInt64Ty(mlir::Type i) {
292-
return i == typeCache.UInt64Ty || i == typeCache.SInt64Ty;
292+
return i == typeCache.uInt64Ty || i == typeCache.sInt64Ty;
293293
}
294294
bool isInt(mlir::Type i) { return mlir::isa<cir::IntType>(i); }
295295

296296
// Fetch the type representing a pointer to unsigned int8 values.
297-
cir::PointerType getUInt8PtrTy() { return typeCache.UInt8PtrTy; }
297+
cir::PointerType getUInt8PtrTy() { return typeCache.uInt8PtrTy; }
298298

299299
/// Get a CIR anonymous record type.
300300
cir::RecordType getAnonRecordTy(llvm::ArrayRef<mlir::Type> members,

clang/lib/CIR/CodeGen/CIRGenClass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ static Address applyNonVirtualAndVirtualOffset(
362362
// not bytes. So the pointer must be cast to a byte pointer and back.
363363

364364
mlir::Value ptr = addr.getPointer();
365-
mlir::Type charPtrType = cgf.cgm.UInt8PtrTy;
365+
mlir::Type charPtrType = cgf.cgm.uInt8PtrTy;
366366
mlir::Value charPtr = cgf.getBuilder().createBitcast(ptr, charPtrType);
367367
mlir::Value adjusted = cir::PtrStrideOp::create(
368368
cgf.getBuilder(), loc, charPtrType, charPtr, baseOffset);
@@ -1105,7 +1105,7 @@ mlir::Value CIRGenFunction::getVTTParameter(GlobalDecl gd, bool forVirtualBase,
11051105
// We're the complete constructor, so get the VTT by name.
11061106
cir::GlobalOp vtt = cgm.getVTables().getAddrOfVTT(rd);
11071107
return builder.createVTTAddrPoint(
1108-
loc, builder.getPointerTo(cgm.VoidPtrTy),
1108+
loc, builder.getPointerTo(cgm.voidPtrTy),
11091109
mlir::FlatSymbolRefAttr::get(vtt.getSymNameAttr()), subVTTIndex);
11101110
}
11111111
}

clang/lib/CIR/CodeGen/CIRGenCoroutine.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ cir::CallOp CIRGenFunction::emitCoroIDBuiltinCall(mlir::Location loc,
5555
if (!builtin) {
5656
fnOp = cgm.createCIRBuiltinFunction(
5757
loc, cgm.builtinCoroId,
58-
cir::FuncType::get({int32Ty, VoidPtrTy, VoidPtrTy, VoidPtrTy}, int32Ty),
58+
cir::FuncType::get({int32Ty, voidPtrTy, voidPtrTy, voidPtrTy}, int32Ty),
5959
/*FD=*/nullptr);
6060
assert(fnOp && "should always succeed");
6161
} else {
@@ -75,7 +75,7 @@ cir::CallOp CIRGenFunction::emitCoroAllocBuiltinCall(mlir::Location loc) {
7575
cir::FuncOp fnOp;
7676
if (!builtin) {
7777
fnOp = cgm.createCIRBuiltinFunction(loc, cgm.builtinCoroAlloc,
78-
cir::FuncType::get({UInt32Ty}, boolTy),
78+
cir::FuncType::get({uInt32Ty}, boolTy),
7979
/*fd=*/nullptr);
8080
assert(fnOp && "should always succeed");
8181
} else {
@@ -95,7 +95,7 @@ CIRGenFunction::emitCoroBeginBuiltinCall(mlir::Location loc,
9595
if (!builtin) {
9696
fnOp = cgm.createCIRBuiltinFunction(
9797
loc, cgm.builtinCoroBegin,
98-
cir::FuncType::get({UInt32Ty, VoidPtrTy}, VoidPtrTy),
98+
cir::FuncType::get({uInt32Ty, voidPtrTy}, voidPtrTy),
9999
/*fd=*/nullptr);
100100
assert(fnOp && "should always succeed");
101101
} else {
@@ -110,7 +110,7 @@ CIRGenFunction::emitCoroBeginBuiltinCall(mlir::Location loc,
110110
mlir::LogicalResult
111111
CIRGenFunction::emitCoroutineBody(const CoroutineBodyStmt &s) {
112112
mlir::Location openCurlyLoc = getLoc(s.getBeginLoc());
113-
cir::ConstantOp nullPtrCst = builder.getNullPtr(VoidPtrTy, openCurlyLoc);
113+
cir::ConstantOp nullPtrCst = builder.getNullPtr(voidPtrTy, openCurlyLoc);
114114

115115
auto fn = mlir::cast<cir::FuncOp>(curFn);
116116
fn.setCoroutine(true);

clang/lib/CIR/CodeGen/CIRGenDecl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ CIRGenFunction::emitAutoVarAlloca(const VarDecl &d,
8080
assert(!cir::MissingFeatures::openMP());
8181
if (!didCallStackSave) {
8282
// Save the stack.
83-
cir::PointerType defaultTy = AllocaInt8PtrTy;
83+
cir::PointerType defaultTy = allocaInt8PtrTy;
8484
CharUnits align = CharUnits::fromQuantity(
8585
cgm.getDataLayout().getAlignment(defaultTy, false));
8686
Address stack = createTempAlloca(defaultTy, align, loc, "saved_stack");
8787

8888
mlir::Value v = builder.createStackSave(loc, defaultTy);
89-
assert(v.getType() == AllocaInt8PtrTy);
89+
assert(v.getType() == allocaInt8PtrTy);
9090
builder.createStore(loc, v, stack);
9191

9292
didCallStackSave = true;

clang/lib/CIR/CodeGen/CIRGenExpr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2529,7 +2529,7 @@ CIRGenFunction::emitConditionalBlocks(const AbstractConditionalOperator *e,
25292529

25302530
// If both arms are void, so be it.
25312531
if (!yieldTy)
2532-
yieldTy = VoidTy;
2532+
yieldTy = voidTy;
25332533

25342534
// Insert required yields.
25352535
for (mlir::OpBuilder::InsertPoint &toInsert : insertPoints) {

clang/lib/CIR/CodeGen/CIRGenExprAggregate.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ void AggExprEmitter::emitArrayInit(Address destPtr, cir::ArrayType arrayTy,
490490
for (uint64_t i = 0; i != numInitElements; ++i) {
491491
// Advance to the next element.
492492
if (i > 0) {
493-
one = builder.getConstantInt(loc, cgf.PtrDiffTy, i);
493+
one = builder.getConstantInt(loc, cgf.ptrDiffTy, i);
494494
element = builder.createPtrStride(loc, begin, one);
495495
}
496496

@@ -512,7 +512,7 @@ void AggExprEmitter::emitArrayInit(Address destPtr, cir::ArrayType arrayTy,
512512
cgf.getTypes().isZeroInitializable(elementType))) {
513513
// Advance to the start of the rest of the array.
514514
if (numInitElements) {
515-
one = builder.getConstantInt(loc, cgf.PtrDiffTy, 1);
515+
one = builder.getConstantInt(loc, cgf.ptrDiffTy, 1);
516516
element = cir::PtrStrideOp::create(builder, loc, cirElementPtrType,
517517
element, one);
518518
}
@@ -526,7 +526,7 @@ void AggExprEmitter::emitArrayInit(Address destPtr, cir::ArrayType arrayTy,
526526

527527
// Compute the end of array
528528
cir::ConstantOp numArrayElementsConst = builder.getConstInt(
529-
loc, mlir::cast<cir::IntType>(cgf.PtrDiffTy), numArrayElements);
529+
loc, mlir::cast<cir::IntType>(cgf.ptrDiffTy), numArrayElements);
530530
mlir::Value end = cir::PtrStrideOp::create(builder, loc, cirElementPtrType,
531531
begin, numArrayElementsConst);
532532

@@ -563,7 +563,7 @@ void AggExprEmitter::emitArrayInit(Address destPtr, cir::ArrayType arrayTy,
563563

564564
// Advance pointer and store them to temporary variable
565565
cir::ConstantOp one = builder.getConstInt(
566-
loc, mlir::cast<cir::IntType>(cgf.PtrDiffTy), 1);
566+
loc, mlir::cast<cir::IntType>(cgf.ptrDiffTy), 1);
567567
auto nextElement = cir::PtrStrideOp::create(
568568
builder, loc, cirElementPtrType, currentElement, one);
569569
cgf.emitStoreThroughLValue(RValue::get(nextElement), tmpLV);

clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,12 @@ static mlir::Value emitCXXNewAllocSize(CIRGenFunction &cgf, const CXXNewExpr *e,
257257
if (!e->isArray()) {
258258
CharUnits typeSize = cgf.getContext().getTypeSizeInChars(type);
259259
sizeWithoutCookie = cgf.getBuilder().getConstant(
260-
loc, cir::IntAttr::get(cgf.SizeTy, typeSize.getQuantity()));
260+
loc, cir::IntAttr::get(cgf.sizeTy, typeSize.getQuantity()));
261261
return sizeWithoutCookie;
262262
}
263263

264264
// The width of size_t.
265-
unsigned sizeWidth = cgf.cgm.getDataLayout().getTypeSizeInBits(cgf.SizeTy);
265+
unsigned sizeWidth = cgf.cgm.getDataLayout().getTypeSizeInBits(cgf.sizeTy);
266266

267267
// The number of elements can be have an arbitrary integer type;
268268
// essentially, we need to multiply it by a constant factor, add a

0 commit comments

Comments
 (0)