[llvm] r197646 - Add stack alignment information for Sparc.

Rafael Espindola rafael.espindola at gmail.com
Wed Dec 18 18:21:16 PST 2013

Author: rafael
Date: Wed Dec 18 20:21:16 2013
New Revision: 197646

URL: http://llvm.org/viewvc/llvm-project?rev=197646&view=rev
Add stack alignment information for Sparc.

This matches the data in clang which was added by Jakob Stoklund Olesen in

Thanks for erikjv on irc for pointing me to the relevant documents:
page 25: Every stack frame must be 16-byte aligned.

page 3-10: Although the architecture requires only word alignment, software convention and the operating system require every stack frame to be doubleword aligned.

I tried to add a test, but it looks like sparc doesn't implement dynamic stack
realignment. This will be tested in clang shortly.


Modified: llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp?rev=197646&r1=197645&r2=197646&view=diff
--- llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp Wed Dec 18 20:21:16 2013
@@ -41,6 +41,11 @@ static std::string computeDataLayout(con
     Ret += "-f128:64-n32";
+  if (ST.is64Bit())
+    Ret += "-S128";
+  else
+    Ret += "-S64";
   return Ret;

More information about the llvm-commits mailing list