[PATCH] D56925: Do not use frame pointer by default for MSP430
Dmitry Mikushin via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 22 16:41:17 PST 2019
dmikushin updated this revision to Diff 182998.
dmikushin added a comment.
@grimar Please find the updated patch with a test case.
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56925/new/
https://reviews.llvm.org/D56925
Files:
lib/Driver/ToolChains/Clang.cpp
test/CodeGen/msp430-fp-elim.c
Index: test/CodeGen/msp430-fp-elim.c
===================================================================
--- /dev/null
+++ test/CodeGen/msp430-fp-elim.c
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -mdisable-fp-elim -triple msp430 -S %s -o - | FileCheck %s --check-prefix=FP_ENFORCED
+// RUN: %clang_cc1 -triple msp430 -S %s -o - | FileCheck %s --check-prefix=FP_DEFAULT
+
+// Check the frame pointer is not used on MSP430 by default, but can be forcibly turned on.
+
+// FP_ENFORCED: push r4
+// FP_ENFORCED: calla r4
+// FP_ENFORCED: pop r4
+// FP_DEFAULT: .globl fp_elim_check
+// FP_DEFAULT-NOT: push r4
+// FP_DEFAULT: calla r4
+// FP_DEFAULT-NOT: pop r4
+
+void fp_elim_check()
+{
+ asm volatile ("calla r4");
+}
+
Index: lib/Driver/ToolChains/Clang.cpp
===================================================================
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -519,10 +519,10 @@
case llvm::Triple::xcore:
case llvm::Triple::wasm32:
case llvm::Triple::wasm64:
+ case llvm::Triple::msp430:
// XCore never wants frame pointers, regardless of OS.
// WebAssembly never wants frame pointers.
return false;
- case llvm::Triple::msp430:
case llvm::Triple::riscv32:
case llvm::Triple::riscv64:
return !areOptimizationsEnabled(Args);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56925.182998.patch
Type: text/x-patch
Size: 1296 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190123/03fd6d7d/attachment.bin>
More information about the cfe-commits
mailing list