[PATCH] D57335: [IR] Don't assume all functions are 4 byte aligned

Michael Platings via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 25 08:17:15 PST 2019


michaelplatings updated this revision to Diff 188184.
michaelplatings added a comment.
Herald added subscribers: cfe-commits, jdoerfert, mgorny, dschuff.
Herald added projects: clang, LLVM.

Hi @efriedma, sorry for the delayed response.
I've added the features you asked for to DataLayout.
It is intended that this patch preserves the existing behaviour if no function pointer alignment is specified.* Therefore I hope you'll agree that it isn't necessary for me to provide code to use the new feature on all platforms.
I did also look into using a target hook but doing so would require modifying a //lot// of functions to take a TargetTransformInfo argument. Given that we're in agreement that the DataLayout is an appropriate choice, it seemed like the best option.

- The exception to this is the case where the Function object doesn't have a parent - no alignment is assumed whereas previously 4-byte alignment was assumed. Hopefully this case is rare enough that code size won't be significantly impacted.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57335/new/

https://reviews.llvm.org/D57335

Files:
  clang/lib/Basic/Targets/ARM.cpp
  clang/test/CodeGen/armv7k-abi.c
  clang/test/CodeGen/target-data.c
  llvm/docs/LangRef.rst
  llvm/include/llvm/IR/ConstantFold.h
  llvm/include/llvm/IR/DataLayout.h
  llvm/lib/IR/ConstantFold.cpp
  llvm/lib/IR/ConstantFold.h
  llvm/lib/IR/Constants.cpp
  llvm/lib/IR/DataLayout.cpp
  llvm/lib/IR/Value.cpp
  llvm/lib/Target/ARM/ARMTargetMachine.cpp
  llvm/unittests/IR/CMakeLists.txt
  llvm/unittests/IR/ConstantFoldTest.cpp
  llvm/unittests/IR/DataLayoutTest.cpp
  llvm/unittests/IR/FunctionTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57335.188184.patch
Type: text/x-patch
Size: 28391 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190225/08251948/attachment-0001.bin>


More information about the llvm-commits mailing list