diff options
author | Bradley Smith <bradley.smith@arm.com> | 2021-03-03 13:53:30 +0000 |
---|---|---|
committer | Bradley Smith <bradley.smith@arm.com> | 2021-03-22 12:05:06 +0000 |
commit | 48f5a392cb73d99a58f01448926f6964ab5b0d0a (patch) | |
tree | 50bae4942a4fa20a48bfb446dd2b2e065f550a83 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | 2bbc9bccf095b92b3ed1ab9669fab8a7dc96ee6d (diff) | |
download | llvm-48f5a392cb73d99a58f01448926f6964ab5b0d0a.zip llvm-48f5a392cb73d99a58f01448926f6964ab5b0d0a.tar.gz llvm-48f5a392cb73d99a58f01448926f6964ab5b0d0a.tar.bz2 |
[IR] Add vscale_range IR function attribute
This attribute represents the minimum and maximum values vscale can
take. For now this attribute is not hooked up to anything during
codegen, this will be added in the future when such codegen is
considered stable.
Additionally hook up the -msve-vector-bits=<x> clang option to emit this
attribute.
Differential Revision: https://reviews.llvm.org/D98030
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index fd70884..e3fdf54 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -496,6 +496,13 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) { if (LargestVectorWidth) CurFn->addFnAttr("min-legal-vector-width", llvm::utostr(LargestVectorWidth)); + // Add vscale attribute if appropriate. + if (getLangOpts().ArmSveVectorBits) { + unsigned VScale = getLangOpts().ArmSveVectorBits / 128; + CurFn->addFnAttr(llvm::Attribute::getWithVScaleRangeArgs(getLLVMContext(), + VScale, VScale)); + } + // If we generated an unreachable return block, delete it now. if (ReturnBlock.isValid() && ReturnBlock.getBlock()->use_empty()) { Builder.ClearInsertionPoint(); |