[PATCH] D32811: [IR] Abstract away ArgNo+1 attribute indexing as much as possible

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 3 09:26:55 PDT 2017


rnk created this revision.
Herald added a subscriber: david2050.
Herald added a reviewer: javed.absar.

Do three things to help with that:

- Add AttributeList::FirstArgIndex, which is an enumerator currently set to 1. It allows us to change the indexing scheme with fewer changes.
- Add addParamAttr/removeParamAttr. This just shortens addAttribute call sites that would otherwise need to spell out FirstArgIndex.
- Remove some attribute-specific getters and setters from Function that take attribute list indices.  Most of these were only used from BuildLibCalls, and doesNotAlias was only used to test or set if the return value is malloc-like.

I'm happy to split the patch, but I think they are probably easier to
review when taken together.

This patch should be NFC, but it sets the stage to change the indexing
scheme to this, which is more convenient when indexing into an array:

  0: func attrs
  1: retattrs
  2...: arg attrs


https://reviews.llvm.org/D32811

Files:
  clang/lib/CodeGen/CGObjCGNU.cpp
  llvm/include/llvm/IR/Attributes.h
  llvm/include/llvm/IR/CallSite.h
  llvm/include/llvm/IR/Function.h
  llvm/include/llvm/IR/Instructions.h
  llvm/lib/Analysis/CFLGraph.h
  llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
  llvm/lib/IR/Attributes.cpp
  llvm/lib/IR/Function.cpp
  llvm/lib/IR/Instructions.cpp
  llvm/lib/Target/AArch64/AArch64CallLowering.cpp
  llvm/lib/Target/ARM/ARMCallLowering.cpp
  llvm/lib/Target/X86/X86WinEHState.cpp
  llvm/lib/Transforms/Coroutines/CoroSplit.cpp
  llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
  llvm/lib/Transforms/IPO/FunctionAttrs.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
  llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
  llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
  llvm/lib/Transforms/ObjCARC/ARCRuntimeEntryPoints.h
  llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
  llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
  llvm/lib/Transforms/Utils/BuildLibCalls.cpp
  llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
  llvm/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp
  llvm/utils/TableGen/IntrinsicEmitter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32811.97668.patch
Type: text/x-patch
Size: 56340 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170503/c7c5e34c/attachment-0001.bin>


More information about the llvm-commits mailing list