[llvm] Use Module level target-abi to assign target features for codegenerated functions. (PR #100833)
Paul Kirth via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 20 08:03:36 PST 2025
================
@@ -387,6 +388,26 @@ Function *Function::Create(FunctionType *Ty, LinkageTypes Linkage,
return Create(Ty, Linkage, M.getDataLayout().getProgramAddressSpace(), N, &M);
}
+StringRef Function::getDefaultTargetFeatures(const StringRef TargetABI) {
+ Triple T(getParent()->getTargetTriple());
+ StringRef Attr = "";
+ if (T.isRISCV64()) {
+ if (TargetABI.equals_insensitive("lp64d"))
+ Attr = "+d";
+ else if (TargetABI.equals_insensitive("lp64f"))
+ Attr = "+f";
+ } else if (T.isRISCV32()) {
+ if (TargetABI.equals_insensitive("ilp32d"))
+ Attr = "+d";
+ else if (TargetABI.equals_insensitive("ilp32f"))
+ Attr = "+f";
+ } else if (T.isARM() || T.isThumb()) {
----------------
ilovepi wrote:
Can we also get a test for the ARM cases?
https://github.com/llvm/llvm-project/pull/100833
More information about the llvm-commits
mailing list