[llvm-commits] [llvm] r74686 - in /llvm/trunk: include/llvm/Target/TargetELFWriterInfo.h lib/CodeGen/ELFCodeEmitter.cpp lib/Target/TargetELFWriterInfo.cpp lib/Target/X86/X86ELFWriterInfo.cpp lib/Target/X86/X86ELFWriterInfo.h
Bruno Cardoso Lopes
bruno.cardoso at gmail.com
Wed Jul 1 19:13:14 PDT 2009
Author: bruno
Date: Wed Jul 1 21:13:13 2009
New Revision: 74686
URL: http://llvm.org/viewvc/llvm-project?rev=74686&view=rev
Log:
Remove getFunctionAlignment from TargetELFInfo and use new MachineFunction alignment method
Modified:
llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h
llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp
llvm/trunk/lib/Target/TargetELFWriterInfo.cpp
llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp
llvm/trunk/lib/Target/X86/X86ELFWriterInfo.h
Modified: llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h?rev=74686&r1=74685&r2=74686&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h Wed Jul 1 21:13:13 2009
@@ -89,10 +89,6 @@
: (hasRelocationAddend() ? 12 : 8);
}
- /// getFunctionAlignment - Returns the alignment for function 'F', targets
- /// with different alignment constraints should overload this method
- virtual unsigned getFunctionAlignment(const Function *F) const;
-
/// getRelocationType - Returns the target specific ELF Relocation type.
/// 'MachineRelTy' contains the object code independent relocation type
virtual unsigned getRelocationType(unsigned MachineRelTy) const = 0;
Modified: llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp?rev=74686&r1=74685&r2=74686&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp (original)
+++ llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp Wed Jul 1 21:13:13 2009
@@ -40,10 +40,11 @@
BufferBegin = &BD[0];
BufferEnd = BufferBegin + BD.capacity();
- // Align the output buffer with function alignment, and
- // upgrade the section alignment if required
- unsigned Align =
- TM.getELFWriterInfo()->getFunctionAlignment(MF.getFunction());
+ // Get the function alignment in bytes
+ unsigned Align = (1 << MF.getAlignment());
+
+ // Align the section size with the function alignment, so the function can
+ // start in a aligned offset, also update the section alignment if needed.
if (ES->Align < Align) ES->Align = Align;
ES->Size = (ES->Size + (Align-1)) & (-Align);
Modified: llvm/trunk/lib/Target/TargetELFWriterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetELFWriterInfo.cpp?rev=74686&r1=74685&r2=74686&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetELFWriterInfo.cpp (original)
+++ llvm/trunk/lib/Target/TargetELFWriterInfo.cpp Wed Jul 1 21:13:13 2009
@@ -24,13 +24,3 @@
TargetELFWriterInfo::~TargetELFWriterInfo() {}
-/// getFunctionAlignment - Returns the alignment for function 'F', targets
-/// with different alignment constraints should overload this method
-unsigned TargetELFWriterInfo::getFunctionAlignment(const Function *F) const {
- const TargetData *TD = TM.getTargetData();
- unsigned FnAlign = F->getAlignment();
- unsigned TDAlign = TD->getPointerABIAlignment();
- unsigned Align = std::max(FnAlign, TDAlign);
- assert(!(Align & (Align-1)) && "Alignment is not a power of two!");
- return Align;
-}
Modified: llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp?rev=74686&r1=74685&r2=74686&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp Wed Jul 1 21:13:13 2009
@@ -59,18 +59,6 @@
return 0;
}
-unsigned X86ELFWriterInfo::getFunctionAlignment(const Function *F) const {
- unsigned FnAlign = 4;
-
- if (F->hasFnAttr(Attribute::OptimizeForSize))
- FnAlign = 1;
-
- if (F->getAlignment())
- FnAlign = Log2_32(F->getAlignment());
-
- return (1 << FnAlign);
-}
-
long int X86ELFWriterInfo::getAddendForRelTy(unsigned RelTy) const {
if (is64Bit) {
switch(RelTy) {
Modified: llvm/trunk/lib/Target/X86/X86ELFWriterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ELFWriterInfo.h?rev=74686&r1=74685&r2=74686&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ELFWriterInfo.h (original)
+++ llvm/trunk/lib/Target/X86/X86ELFWriterInfo.h Wed Jul 1 21:13:13 2009
@@ -41,10 +41,6 @@
X86ELFWriterInfo(TargetMachine &TM);
virtual ~X86ELFWriterInfo();
- /// getFunctionAlignment - Returns the alignment for function 'F', targets
- /// with different alignment constraints should overload this method
- virtual unsigned getFunctionAlignment(const Function *F) const;
-
/// getRelocationType - Returns the target specific ELF Relocation type.
/// 'MachineRelTy' contains the object code independent relocation type
virtual unsigned getRelocationType(unsigned MachineRelTy) const;
More information about the llvm-commits
mailing list