Matt Arsenault via llvm-dev
2019-Feb-06 00:17 UTC
[llvm-dev] [RFC] Enforcing immediate operands for intrinsics
> On Feb 5, 2019, at 6:55 PM, Krzysztof Parzyszek via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > There is something similar going on in clang in SemaChecking.cpp. The difference is that each target can write its own verification code, which may check things like value ranges, for example. > The scheme you're proposing would invent a new attribute (a widespread change) that only implements partial checks (i.e. "is argument immediate or not”).This is for the benefit of IR transform passes and codegen. I’m not attempting to diagnose frontend builtins or do anything for the end user. A backend can always truncate bits or whatever to fit the actual instruction constraints if necessary. It has to do something to not crash on the IR otherwise, which is part of the problem I’m trying to solve.> > Why not simply add a function to TTI that tells you whether a particular Value is a valid n-th argument to the given intrinsic? > Something like > if (TTI.isValidArgument(IntOpc, Val, OpIdx)) > Int->setOperand(Val, OpIdx); >This is required for correctness, so TTI is not appropriate. Reasonably implementing this would still require adding something in TableGen (which then just brings you back to adding an attribute). I would also like to be able to rely on this for emission of G_INTRINISIC_* instructions in GlobalISel, so that intermediate illegal G_CONSTANT instructions can be avoided -Matt
Krzysztof Parzyszek via llvm-dev
2019-Feb-06 01:36 UTC
[llvm-dev] [RFC] Enforcing immediate operands for intrinsics
On 2/5/2019 6:17 PM, Matt Arsenault wrote:> This is for the benefit of IR transform passes and codegen. I’m not attempting to diagnose frontend builtins or do anything for the end user.Ah, I thought you wanted to have the ability to verify an intrinsic in IR. Yeah, the attribute should be enough. -Krzysztof
Sanjay Patel via llvm-dev
2019-Feb-06 14:12 UTC
[llvm-dev] [RFC] Enforcing immediate operands for intrinsics
There's a stale proposal with similar motivation here: https://reviews.llvm.org/D23798 Setting the const-ness in the tablegen definition sounds better than that, but that patch may provide a starting point for intrinsics that have immarg potential. On Tue, Feb 5, 2019 at 6:37 PM Krzysztof Parzyszek via llvm-dev < llvm-dev at lists.llvm.org> wrote:> On 2/5/2019 6:17 PM, Matt Arsenault wrote: > > This is for the benefit of IR transform passes and codegen. I’m not > attempting to diagnose frontend builtins or do anything for the end user. > > Ah, I thought you wanted to have the ability to verify an intrinsic in > IR. Yeah, the attribute should be enough. > > -Krzysztof > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190206/bf49d1ad/attachment.html>