[llvm-commits] CVS: llvm/lib/CodeGen/ELFWriter.cpp MachOWriter.cpp MachineFunction.cpp

Chris Lattner sabre at nondot.org
Sat Jan 20 14:36:24 PST 2007



Changes in directory llvm/lib/CodeGen:

ELFWriter.cpp updated: 1.34 -> 1.35
MachOWriter.cpp updated: 1.16 -> 1.17
MachineFunction.cpp updated: 1.107 -> 1.108
---
Log message:

Teach TargetData to handle 'preferred' alignment for each target, and use 
these alignment amounts to align scalars when we can.  Patch by Scott Michel!



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

 ELFWriter.cpp       |    2 +-
 MachOWriter.cpp     |    2 +-
 MachineFunction.cpp |    3 ++-
 3 files changed, 4 insertions(+), 3 deletions(-)


Index: llvm/lib/CodeGen/ELFWriter.cpp
diff -u llvm/lib/CodeGen/ELFWriter.cpp:1.34 llvm/lib/CodeGen/ELFWriter.cpp:1.35
--- llvm/lib/CodeGen/ELFWriter.cpp:1.34	Wed Jan 17 19:23:11 2007
+++ llvm/lib/CodeGen/ELFWriter.cpp	Sat Jan 20 16:35:55 2007
@@ -241,7 +241,7 @@
   }
 
   const Type *GVType = (const Type*)GV->getType();
-  unsigned Align = TM.getTargetData()->getTypeAlignment(GVType);
+  unsigned Align = TM.getTargetData()->getTypeAlignmentPref(GVType);
   unsigned Size  = TM.getTargetData()->getTypeSize(GVType);
 
   // If this global has a zero initializer, it is part of the .bss or common


Index: llvm/lib/CodeGen/MachOWriter.cpp
diff -u llvm/lib/CodeGen/MachOWriter.cpp:1.16 llvm/lib/CodeGen/MachOWriter.cpp:1.17
--- llvm/lib/CodeGen/MachOWriter.cpp:1.16	Wed Jan 17 19:23:11 2007
+++ llvm/lib/CodeGen/MachOWriter.cpp	Sat Jan 20 16:35:55 2007
@@ -309,7 +309,7 @@
   unsigned Size = TM.getTargetData()->getTypeSize(Ty);
   unsigned Align = GV->getAlignment();
   if (Align == 0)
-    Align = TM.getTargetData()->getTypeAlignment(Ty);
+    Align = TM.getTargetData()->getTypeAlignmentPref(Ty);
   
   MachOSym Sym(GV, Mang->getValueName(GV), Sec->Index, TM);
   


Index: llvm/lib/CodeGen/MachineFunction.cpp
diff -u llvm/lib/CodeGen/MachineFunction.cpp:1.107 llvm/lib/CodeGen/MachineFunction.cpp:1.108
--- llvm/lib/CodeGen/MachineFunction.cpp:1.107	Thu Dec 21 20:04:05 2006
+++ llvm/lib/CodeGen/MachineFunction.cpp	Sat Jan 20 16:35:55 2007
@@ -123,7 +123,8 @@
   const TargetData &TD = *TM.getTargetData();
   bool IsPic = TM.getRelocationModel() == Reloc::PIC_;
   unsigned EntrySize = IsPic ? 4 : TD.getPointerSize();
-  unsigned Alignment = IsPic ? TD.getIntAlignment() : TD.getPointerAlignment();
+  unsigned Alignment = IsPic ? TD.getIntABIAlignment()
+                             : TD.getPointerABIAlignment();
   JumpTableInfo = new MachineJumpTableInfo(EntrySize, Alignment);
   
   BasicBlocks.Parent = this;






More information about the llvm-commits mailing list