[PATCH] D122046: [clang] Remove Address::deprecated from MveEmitter
Arthur Eubanks via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 21 09:28:15 PDT 2022
aeubanks updated this revision to Diff 416989.
aeubanks added a comment.
fix dyn_cast
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122046/new/
https://reviews.llvm.org/D122046
Files:
clang/utils/TableGen/MveEmitter.cpp
Index: clang/utils/TableGen/MveEmitter.cpp
===================================================================
--- clang/utils/TableGen/MveEmitter.cpp
+++ clang/utils/TableGen/MveEmitter.cpp
@@ -212,6 +212,7 @@
std::string llvmName() const override {
return "llvm::PointerType::getUnqual(" + Pointee->llvmName() + ")";
}
+ const Type *getPointeeType() const { return Pointee; }
static bool classof(const Type *T) {
return T->typeKind() == TypeKind::Pointer;
@@ -702,11 +703,13 @@
class AddressResult : public Result {
public:
Ptr Arg;
+ const Type *Ty;
unsigned Align;
- AddressResult(Ptr Arg, unsigned Align) : Arg(Arg), Align(Align) {}
+ AddressResult(Ptr Arg, const Type *Ty, unsigned Align)
+ : Arg(Arg), Ty(Ty), Align(Align) {}
void genCode(raw_ostream &OS,
CodeGenParamAllocator &ParamAlloc) const override {
- OS << "Address::deprecated(" << Arg->varname()
+ OS << "Address(" << Arg->varname() << ", " << Ty->llvmName()
<< ", CharUnits::fromQuantity(" << Align << "))";
}
std::string typeName() const override {
@@ -1189,13 +1192,21 @@
if (D->getNumArgs() != 2)
PrintFatalError("'address' should have two arguments");
Result::Ptr Arg = getCodeForDagArg(D, 0, Scope, Param);
+
+ const Type *Ty = nullptr;
+ if (auto *DI = dyn_cast<DagInit>(D->getArg(0)))
+ if (auto *PTy = dyn_cast<PointerType>(getType(DI->getOperator(), Param)))
+ Ty = PTy->getPointeeType();
+ if (!Ty)
+ PrintFatalError("'address' pointer argument should be a pointer");
+
unsigned Alignment;
if (auto *II = dyn_cast<IntInit>(D->getArg(1))) {
Alignment = II->getValue();
} else {
PrintFatalError("'address' alignment argument should be an integer");
}
- return std::make_shared<AddressResult>(Arg, Alignment);
+ return std::make_shared<AddressResult>(Arg, Ty, Alignment);
} else if (Op->getName() == "unsignedflag") {
if (D->getNumArgs() != 1)
PrintFatalError("unsignedflag should have exactly one argument");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122046.416989.patch
Type: text/x-patch
Size: 2061 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220321/4181a4bd/attachment-0001.bin>
More information about the cfe-commits
mailing list