[llvm-dev] Fwd: [PATCH] D20841: TII: Add documentation about conditional exits. NFC
Kyle Butt via llvm-dev
llvm-dev at lists.llvm.org
Tue May 31 16:19:15 PDT 2016
I was hoping to get feedback on this proposal formatted as a patch. I'd
like to teach AnalyzeBranch to handle conditional returns on PPC, but the
currently documented API for AnalyzeBranch doesn't support it.
I propose the following enhancement to the API so that I can teach
AnalyzeBranch about conditional return instructions.
---------- Forwarded message ----------
From: Kyle Butt <kyle+llvm at iteratee.net>
Date: Tue, May 31, 2016 at 4:07 PM
Subject: [PATCH] D20841: TII: Add documentation about conditional exits. NFC
To: kyle+llvm at iteratee.net
Cc: llvm-commits at lists.llvm.org
iteratee created this revision.
iteratee added a subscriber: llvm-commits.
iteratee set the repository for this revision to rL LLVM.
Currently the documented API for AnalyzeBranch leaves no place for
conditional returns. This leaves a blindspot after shrinkwrapping on
platforms with conditional return instructions.
The existing API can be used to handle conditional returns by using a null
TBB
and a non-empty condition list. A null TBB should never mean fallthrough
with a
non-empty condition list, as that wouldn't make any sense. This leaves a
natural way to represent conditional return branches.
Next up is to add support to PPC for AnalyzeBranch and conditional
return.
Repository:
rL LLVM
http://reviews.llvm.org/D20841
Files:
include/llvm/Target/TargetInstrInfo.h
Index: include/llvm/Target/TargetInstrInfo.h
===================================================================
--- include/llvm/Target/TargetInstrInfo.h
+++ include/llvm/Target/TargetInstrInfo.h
@@ -458,6 +458,13 @@
/// 'false' destination in FBB, and a list of operands that evaluate
the
/// condition. These operands can be passed to other TargetInstrInfo
/// methods to create new branches.
+ /// 5. If this block ends with a conditional ret with fallthrough, it
returns
+ /// null for TBB and FBB and returns a non-empty list of operands that
+ /// evaluate the condition. These operands can be used to create new
+ /// branches.
+ /// 6. If the block ends with a conditional return followed by an
+ /// unconditional branch, the 'false' destination is FBB, while TBB is
+ /// null. Cond is non-empty as above.
///
/// Note that RemoveBranch and InsertBranch must be implemented to
support
/// cases where this method returns success.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160531/b7086d8b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20841.59146.patch
Type: text/x-patch
Size: 991 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160531/b7086d8b/attachment.bin>
More information about the llvm-dev
mailing list