[llvm-commits] CVS: llvm/lib/Target/ARM/ARMMachineFunctionInfo.h ARMAsmPrinter.cpp

Dale Johannesen dalej at apple.com
Mon Apr 23 13:07:43 PDT 2007



Changes in directory llvm/lib/Target/ARM:

ARMMachineFunctionInfo.h updated: 1.8 -> 1.9
ARMAsmPrinter.cpp updated: 1.65 -> 1.66
---
Log message:

add Align field, and use when generating function alignment


---
Diffs of the changes:  (+13 -3)

 ARMAsmPrinter.cpp        |    2 +-
 ARMMachineFunctionInfo.h |   14 ++++++++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)


Index: llvm/lib/Target/ARM/ARMMachineFunctionInfo.h
diff -u llvm/lib/Target/ARM/ARMMachineFunctionInfo.h:1.8 llvm/lib/Target/ARM/ARMMachineFunctionInfo.h:1.9
--- llvm/lib/Target/ARM/ARMMachineFunctionInfo.h:1.8	Thu Mar  1 02:26:31 2007
+++ llvm/lib/Target/ARM/ARMMachineFunctionInfo.h	Mon Apr 23 15:07:25 2007
@@ -27,9 +27,14 @@
 class ARMFunctionInfo : public MachineFunctionInfo {
 
   /// isThumb - True if this function is compiled under Thumb mode.
-  ///
+  /// Used to initialized Align, so must precede it.
   bool isThumb;
 
+  /// Align - required alignment.  ARM functions and Thumb functions with
+  /// constant pools require 4-byte alignment; other Thumb functions
+  /// require only 2-byte alignment.
+  unsigned Align;
+
   /// VarArgsRegSaveSize - Size of the register save area for vararg functions.
   ///
   unsigned VarArgsRegSaveSize;
@@ -84,7 +89,8 @@
 
 public:
   ARMFunctionInfo() :
-    isThumb(false),
+    isThumb(false), 
+    Align(2U),
     VarArgsRegSaveSize(0), HasStackFrame(false),
     LRSpilledForFarJump(false), R3IsLiveIn(false),
     FramePtrSpillOffset(0), GPRCS1Offset(0), GPRCS2Offset(0), DPRCSOffset(0),
@@ -94,6 +100,7 @@
 
   ARMFunctionInfo(MachineFunction &MF) :
     isThumb(MF.getTarget().getSubtarget<ARMSubtarget>().isThumb()),
+    Align(isThumb ? 1U : 2U),
     VarArgsRegSaveSize(0), HasStackFrame(false),
     LRSpilledForFarJump(false), R3IsLiveIn(false),
     FramePtrSpillOffset(0), GPRCS1Offset(0), GPRCS2Offset(0), DPRCSOffset(0),
@@ -104,6 +111,9 @@
 
   bool isThumbFunction() const { return isThumb; }
 
+  unsigned getAlign() const { return Align; }
+  void setAlign(unsigned a) { Align = a; }
+
   unsigned getVarArgsRegSaveSize() const { return VarArgsRegSaveSize; }
   void setVarArgsRegSaveSize(unsigned s) { VarArgsRegSaveSize = s; }
 


Index: llvm/lib/Target/ARM/ARMAsmPrinter.cpp
diff -u llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.65 llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.66
--- llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.65	Sat Apr 21 19:04:12 2007
+++ llvm/lib/Target/ARM/ARMAsmPrinter.cpp	Mon Apr 23 15:07:25 2007
@@ -211,7 +211,7 @@
       O << Directive << CurrentFnName << "\n";
 
   if (AFI->isThumbFunction()) {
-    EmitAlignment(1, F);
+    EmitAlignment(AFI->getAlign(), F);
     O << "\t.code\t16\n";
     O << "\t.thumb_func";
     if (Subtarget->isTargetDarwin())






More information about the llvm-commits mailing list