[PATCH] D20841: TII: Add documentation about conditional exits. NFC

Kyle Butt via llvm-commits llvm-commits at lists.llvm.org
Tue May 31 16:07:31 PDT 2016


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 --------------
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-commits/attachments/20160531/306815a4/attachment.bin>


More information about the llvm-commits mailing list