[PATCH] D57774: [GlobalISel][NFC] Gardening: Factor out code for simple unary intrinsics

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 5 11:32:54 PST 2019


paquette created this revision.
paquette added reviewers: aemerson, dsanders, arsenm, aditya_nandakumar.
Herald added subscribers: Petar.Avramovic, volkan, kristof.beyls, rovka, wdng.

I noticed that there was a lot of duplicated code for unary intrinsics in translateKnownIntrinsic, and thought it would be nice to factor it out into its own function.

This adds a function and a lookup table which contains the currently supported simple unary intrinsics. I figured the lookup table would be nice, because if we add one of these, then all we have to do is add the intrinsic and its generic opcode to the mapping.

Also, it would get us out of writing code like this, which seems a little redundant IMO:

  case intrinsicA:
      translateFooIntrinsic(OpcodeForA...);
  case intrinsicB:
      translateFooIntrinsic(OpcodeForB...);
  case intrinsicC:
      translateFooIntrinsic(OpcodeForC...);


https://reviews.llvm.org/D57774

Files:
  include/llvm/CodeGen/GlobalISel/IRTranslator.h
  lib/CodeGen/GlobalISel/IRTranslator.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57774.185356.patch
Type: text/x-patch
Size: 6366 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190205/5e30f48c/attachment.bin>


More information about the llvm-commits mailing list