aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGCall.cpp
diff options
context:
space:
mode:
authorMomchil Velikov <momchil.velikov@arm.com>2020-03-24 09:32:51 +0000
committerMomchil Velikov <momchil.velikov@arm.com>2020-03-24 10:21:26 +0000
commit080d046c91d26bd3b0afba817cf5c2f99d1288ff (patch)
treea8a32c7c76cd4e22f43131349d5321d99beef641 /clang/lib/CodeGen/CGCall.cpp
parent1232cfa385c15ef768381483d9cbd575380bc054 (diff)
downloadllvm-080d046c91d26bd3b0afba817cf5c2f99d1288ff.zip
llvm-080d046c91d26bd3b0afba817cf5c2f99d1288ff.tar.gz
llvm-080d046c91d26bd3b0afba817cf5c2f99d1288ff.tar.bz2
[ARM][CMSE] Implement CMSE attributes
This patch adds CMSE attributes `cmse_nonsecure_call` and `cmse_nonsecure_entry`. As usual, specification is available here: https://developer.arm.com/docs/ecm0359818/latest Patch by Javed Absar, Bradley Smith, David Green, Momchil Velikov, possibly others. Differential Revision: https://reviews.llvm.org/D71129
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index c582b9a..20da9f2 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -815,6 +815,7 @@ CGFunctionInfo *CGFunctionInfo::create(unsigned llvmCC,
FI->ASTCallingConvention = info.getCC();
FI->InstanceMethod = instanceMethod;
FI->ChainCall = chainCall;
+ FI->CmseNSCall = info.getCmseNSCall();
FI->NoReturn = info.getNoReturn();
FI->ReturnsRetained = info.getProducesResult();
FI->NoCallerSavedRegs = info.getNoCallerSavedRegs();
@@ -1877,6 +1878,9 @@ void CodeGenModule::ConstructAttributeList(
if (FI.isNoReturn())
FuncAttrs.addAttribute(llvm::Attribute::NoReturn);
+ if (FI.isCmseNSCall())
+ FuncAttrs.addAttribute("cmse_nonsecure_call");
+
// If we have information about the function prototype, we can learn
// attributes from there.
AddAttributesFromFunctionProtoType(getContext(), FuncAttrs,
@@ -2004,6 +2008,9 @@ void CodeGenModule::ConstructAttributeList(
}
if (!AttrOnCallSite) {
+ if (TargetDecl && TargetDecl->hasAttr<CmseNSEntryAttr>())
+ FuncAttrs.addAttribute("cmse_nonsecure_entry");
+
bool DisableTailCalls = false;
if (CodeGenOpts.DisableTailCalls)