This implements the clang side of D116531. The elementtype attribute is added for all indirect constraints (*) and tests are updated accordingly.
Details
Details
- Reviewers
lebedev.ri aeubanks - Group Reviewers
Restricted Project - Commits
- rGe8b98a5216db: [CodeGen] Emit elementtype attributes for indirect inline asm constraints
Diff Detail
Diff Detail
Unit Tests
Unit Tests
Time | Test | |
---|---|---|
70 ms | x64 debian > LLVM.Bindings/Go::go.test |
Event Timeline
Comment Actions
thanks, check-clang passes with
diff --git a/llvm/include/llvm/IR/InstrTypes.h b/llvm/include/llvm/IR/InstrTypes.h index 03839e00c7aa..94a3586199d1 100644 --- a/llvm/include/llvm/IR/InstrTypes.h +++ b/llvm/include/llvm/IR/InstrTypes.h @@ -1734,6 +1734,15 @@ public: return Attrs.getParamStackAlignment(ArgNo); } + /// Extract the elementtype type for a call or parameter. + Type *getParamElementType(unsigned ArgNo) const { + if (auto *Ty = Attrs.getParamElementType(ArgNo)) + return Ty; + if (const Function *F = getCalledFunction()) + return F->getAttributes().getParamElementType(ArgNo); + return nullptr; + } + /// Extract the byval type for a call or parameter. Type *getParamByValType(unsigned ArgNo) const { if (auto *Ty = Attrs.getParamByValType(ArgNo)) diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index 254d7b2fdff4..0c515900dbb0 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -2161,6 +2161,10 @@ void Verifier::verifyInlineAsmCall(const CallBase &Call) { Assert(Arg->getType()->isPointerTy(), "Operand for indirect constraint must have pointer type", &Call); + Assert( + cast<PointerType>(Arg->getType()) + ->isOpaqueOrPointeeTypeMatches(Call.getParamElementType(ArgNo)), + "HI"); // TODO: Require elementtype attribute here. } else {
clang-format: please reformat the code