Kevin Neal via llvm-dev
2018-Apr-03 16:25 UTC
[llvm-dev] [llvm] Query the target from an opt pass?
I'm working on the #pragma STDC FENV_ACCESS ON support, specifically the support for a strict version of the FP to unsigned int conversion. I've got a pass that runs and converts a new intrinsic into code that uses the FP to signed int conversion code similar to how SelectionDAG handles this now. Except that SelectionDAG will let the target handle it if the target says it will. How do I, from an "optimization" pass, query the target to see if it already has a better way of handling exactly this case? I grepped around and I didn't see anything in a pass that looked like what I need. Oh, and the reason I did this as a pass is because I need to add branches, which means splitting basic blocks. I don't think I can do this in SelectionDAG. -- Kevin P. Neal SAS/C and SAS/C++ Compiler Host Research and Development SAS Institute, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180403/d572f208/attachment.html>
Friedman, Eli via llvm-dev
2018-Apr-03 17:55 UTC
[llvm-dev] [llvm] Query the target from an opt pass?
On 4/3/2018 9:25 AM, Kevin Neal via llvm-dev wrote:> I'm working on the #pragma STDC FENV_ACCESS ON support, specifically > the support for a strict version of the FP to unsigned int conversion. > I've got a pass that runs and converts a new intrinsic into code that > uses the FP to signed int conversion code similar to how SelectionDAG > handles this now. Except that SelectionDAG will let the target handle > it if the target says it will. > How do I, from an "optimization" pass, query the target to see if it > already has a better way of handling exactly this case? I grepped around > and I didn't see anything in a pass that looked like what I need.TargetTransformInfo is probably what you're looking for. -Eli -- Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180403/ca14c770/attachment.html>
Kevin Neal via llvm-dev
2018-Apr-03 18:15 UTC
[llvm-dev] [llvm] Query the target from an opt pass?
Hmmm, a quick look at the documentation for TargetTransformInfo doesn't look like it. In LegalizeDAG.cpp it uses TLI.getOperationAction() to find out if an SDNode should be expanded by the legalizer or passed down to the target. That's what I need to know, but I need it in a pass pre-legalization. This seems like weird layering, though. Having an "optimization" pass be looking into specific types of SDNode doesn't seem ideal. But I need to introduce branches, and I don't think I can do that in the SelectionDAG. Branches in the middle of a basic block seems ... incorrect. Is there a good way to get ahold of the correct TargetLoweringBase from a pass? But there's still the layering issue, no? Oh, and sorry for the top posting. This is the email client I'm stuck with. From: Friedman, Eli [mailto:efriedma at codeaurora.org] Sent: Tuesday, April 03, 2018 1:56 PM To: Kevin Neal <Kevin.Neal at sas.com>; llvm-dev at lists.llvm.org Subject: Re: [llvm-dev] [llvm] Query the target from an opt pass? EXTERNAL On 4/3/2018 9:25 AM, Kevin Neal via llvm-dev wrote: I'm working on the #pragma STDC FENV_ACCESS ON support, specifically the support for a strict version of the FP to unsigned int conversion. I've got a pass that runs and converts a new intrinsic into code that uses the FP to signed int conversion code similar to how SelectionDAG handles this now. Except that SelectionDAG will let the target handle it if the target says it will. How do I, from an "optimization" pass, query the target to see if it already has a better way of handling exactly this case? I grepped around and I didn't see anything in a pass that looked like what I need. TargetTransformInfo is probably what you're looking for. -Eli -- Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180403/ee24a2d5/attachment-0001.html>
Kaylor, Andrew via llvm-dev
2018-Apr-03 18:33 UTC
[llvm-dev] [llvm] Query the target from an opt pass?
I think you want to start from TargetMachine and then find an appropriate place to add a new interface function from there. You'll want to pass a pointer to the target machine to your pass' constructor via the create function. You probably want to create your pass from TargetPassConfig::addISelPrepare(). If you look at that function you'll find some other passes that use a TargetMachine argument. -Andy From: Kevin Neal [mailto:Kevin.Neal at sas.com] Sent: Tuesday, April 03, 2018 9:25 AM To: llvm-dev at lists.llvm.org Cc: Kaylor, Andrew <andrew.kaylor at intel.com> Subject: [llvm] Query the target from an opt pass? I'm working on the #pragma STDC FENV_ACCESS ON support, specifically the support for a strict version of the FP to unsigned int conversion. I've got a pass that runs and converts a new intrinsic into code that uses the FP to signed int conversion code similar to how SelectionDAG handles this now. Except that SelectionDAG will let the target handle it if the target says it will. How do I, from an "optimization" pass, query the target to see if it already has a better way of handling exactly this case? I grepped around and I didn't see anything in a pass that looked like what I need. Oh, and the reason I did this as a pass is because I need to add branches, which means splitting basic blocks. I don't think I can do this in SelectionDAG. -- Kevin P. Neal SAS/C and SAS/C++ Compiler Host Research and Development SAS Institute, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180403/feafe5ce/attachment.html>
Maybe Matching Threads
- [llvm] Query the target from an opt pass?
- [llvm] Query the target from an opt pass?
- [LLVMdev] [PATCH] fix a "jump to case label crosses initialization of llvm::MVT::ValueType VT" error
- [LLVMdev] [PATCH] Add new phase to legalization to handle vector operations
- [LLVMdev] Lying about being expanded?