Skip to content

Commit 9467645

Browse files
authored
[CodeGen] Rename MVT::iPTRAny to MVT::pAny
Whilst in upstream LLVM iPTRAny is only ever an integer, essentially an alias for iPTR, this is not true in CHERI LLVM, where it gets used to mean "iPTR or cPTR", i.e. either an integer address or a capability (with cPTR and cN being the capability equivalents of iPTR and iN). Moreover, iPTRAny is already not itself regarded as an integer (calling isInteger() will give false), so the "i" prefix is misleading, and it stands out as different from all the other xAny that have a single letter prefix denoting their type. Thus, rename it to pAny, reflecting that it is an overloaded pointer type, which could end up being specialised to an integer type, but does not have to be. This has been verified to have no effect on the generated files for LLVM itself or any in-tree target beyond the replacement of the identifier iPTRAny with pAny in GenVT.inc. Reviewers: arsenm Reviewed By: arsenm Pull Request: llvm#113733
1 parent e8b7f53 commit 9467645

File tree

8 files changed

+13
-12
lines changed

8 files changed

+13
-12
lines changed

llvm/include/llvm/CodeGen/ValueTypes.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ namespace llvm {
230230

231231
/// Return true if this is an overloaded type for TableGen.
232232
bool isOverloaded() const {
233-
return (V==MVT::iAny || V==MVT::fAny || V==MVT::vAny || V==MVT::iPTRAny);
233+
return (V == MVT::iAny || V == MVT::fAny || V == MVT::vAny ||
234+
V == MVT::pAny);
234235
}
235236

236237
/// Return true if the bit size is a multiple of 8.

llvm/include/llvm/CodeGen/ValueTypes.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,9 @@ def MetadataVT : ValueType<0, 505> { // Metadata
338338
let LLVMName = "Metadata";
339339
}
340340

341-
// Pseudo valuetype mapped to the current pointer size to any address space.
341+
// Pseudo valuetype to represent "pointer to any address space"
342342
// Should only be used in TableGen.
343-
def iPTRAny : VTAny<506>;
343+
def pAny : VTAny<506>;
344344

345345
// Pseudo valuetype to represent "vector of any size"
346346
// Should only be used in TableGen.

llvm/include/llvm/CodeGenTypes/MachineValueType.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ namespace llvm {
320320
llvm_unreachable("Value type is non-standard value, Other.");
321321
case iPTR:
322322
llvm_unreachable("Value type size is target-dependent. Ask TLI.");
323-
case iPTRAny:
323+
case pAny:
324324
case iAny:
325325
case fAny:
326326
case vAny:

llvm/include/llvm/IR/Intrinsics.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ namespace Intrinsic {
9292
/// return the existing declaration.
9393
///
9494
/// The \p Tys parameter is for intrinsics with overloaded types (e.g., those
95-
/// using iAny, fAny, vAny, or iPTRAny). For a declaration of an overloaded
95+
/// using iAny, fAny, vAny, or pAny). For a declaration of an overloaded
9696
/// intrinsic, Tys must provide exactly one type for each overloaded type in
9797
/// the intrinsic.
9898
Function *getOrInsertDeclaration(Module *M, ID id, ArrayRef<Type *> Tys = {});

llvm/include/llvm/IR/Intrinsics.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ class LLVMAnyType<ValueType vt> : LLVMType<vt> {
388388
!eq(vt, iAny) : ArgKind.AnyInteger,
389389
!eq(vt, fAny) : ArgKind.AnyFloat,
390390
!eq(vt, vAny) : ArgKind.AnyVector,
391-
!eq(vt, iPTRAny) : ArgKind.AnyPointer,
391+
!eq(vt, pAny) : ArgKind.AnyPointer,
392392
);
393393
let Sig = [
394394
IIT_ARG.Number,
@@ -412,8 +412,8 @@ class LLVMQualPointerType<int addrspace>
412412
]);
413413
}
414414

415-
class LLVMAnyPointerType : LLVMAnyType<iPTRAny> {
416-
assert isAny, "iPTRAny should have isOverloaded";
415+
class LLVMAnyPointerType : LLVMAnyType<pAny> {
416+
assert isAny, "pAny should have isOverloaded";
417417
}
418418

419419
// Match the type of another intrinsic parameter. Number is an index into the

llvm/lib/Target/NVPTX/NVPTXInstrInfo.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1922,7 +1922,7 @@ def imem : Operand<iPTR> {
19221922
let PrintMethod = "printOperand";
19231923
}
19241924

1925-
def imemAny : Operand<iPTRAny> {
1925+
def imemAny : Operand<pAny> {
19261926
let PrintMethod = "printOperand";
19271927
}
19281928

llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -813,8 +813,8 @@ void TypeInfer::expandOverloads(TypeSetByHwMode &VTS) const {
813813

814814
void TypeInfer::expandOverloads(TypeSetByHwMode::SetType &Out,
815815
const TypeSetByHwMode::SetType &Legal) const {
816-
if (Out.count(MVT::iPTRAny)) {
817-
Out.erase(MVT::iPTRAny);
816+
if (Out.count(MVT::pAny)) {
817+
Out.erase(MVT::pAny);
818818
Out.insert(MVT::iPTR);
819819
} else if (Out.count(MVT::iAny)) {
820820
Out.erase(MVT::iAny);

mlir/tools/mlir-tblgen/LLVMIRIntrinsicGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static IndicesTy getOverloadableTypeIdxs(const Record &record,
7676
case llvm::MVT::iAny:
7777
case llvm::MVT::fAny:
7878
case llvm::MVT::Any:
79-
case llvm::MVT::iPTRAny:
79+
case llvm::MVT::pAny:
8080
case llvm::MVT::vAny:
8181
overloadedOps.set(r.index());
8282
break;

0 commit comments

Comments
 (0)