[llvm] Use Module level target-abi to assign target features for codegenerated functions. (PR #100833)
Alexander Richardson via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 30 09:55:02 PST 2025
================
@@ -387,6 +388,25 @@ 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 (TargetABI.equals_insensitive("lp64q"))
+ attr = "+q";
+ } else if (T.isRISCV32() && TargetABI.contains("ilp32f")) {
+ attr = "+f";
+ } else if (T.isARM() || T.isThumb()) {
+ attr = "+thumb-mode";
----------------
arichardson wrote:
Why is thumb on by default for Arm? What happens when I build with -mno-thumb? Could you add test for Arm as well?
https://github.com/llvm/llvm-project/pull/100833
More information about the llvm-commits
mailing list