[llvm-commits] CVS: llvm/tools/lto/lto.cpp
Devang Patel
dpatel at apple.com
Wed Oct 25 11:10:22 PDT 2006
Changes in directory llvm/tools/lto:
lto.cpp updated: 1.23 -> 1.24
---
Log message:
Supply alignment info to linker through LLVMSymbol.
---
Diffs of the changes: (+12 -6)
lto.cpp | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
Index: llvm/tools/lto/lto.cpp
diff -u llvm/tools/lto/lto.cpp:1.23 llvm/tools/lto/lto.cpp:1.24
--- llvm/tools/lto/lto.cpp:1.23 Tue Oct 24 13:41:02 2006
+++ llvm/tools/lto/lto.cpp Wed Oct 25 13:10:07 2006
@@ -36,6 +36,7 @@
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Analysis/LoadValueNumbering.h"
+#include "llvm/Support/MathExtras.h"
#include "llvm/LinkTimeOptimizer.h"
#include <fstream>
#include <iostream>
@@ -149,8 +150,7 @@
return LTO_READ_FAILURE;
// Collect Target info
- if (!Target)
- getTarget(m);
+ getTarget(m);
if (!Target)
return LTO_READ_FAILURE;
@@ -166,8 +166,10 @@
if (!f->isExternal() && lt != LTOInternalLinkage
&& strncmp (f->getName().c_str(), "llvm.", 5)) {
+ int alignment = ( 16 > f->getAlignment() ? 16 : f->getAlignment());
LLVMSymbol *newSymbol = new LLVMSymbol(lt, f, f->getName(),
- mangler.getValueName(f));
+ mangler.getValueName(f),
+ Log2_32(alignment));
symbols[newSymbol->getMangledName()] = newSymbol;
allSymbols[newSymbol->getMangledName()] = newSymbol;
}
@@ -186,8 +188,10 @@
LTOLinkageTypes lt = getLTOLinkageType(v);
if (!v->isExternal() && lt != LTOInternalLinkage
&& strncmp (v->getName().c_str(), "llvm.", 5)) {
+ const TargetData *TD = Target->getTargetData();
LLVMSymbol *newSymbol = new LLVMSymbol(lt, v, v->getName(),
- mangler.getValueName(v));
+ mangler.getValueName(v),
+ TD->getPreferredAlignmentLog(v));
symbols[newSymbol->getMangledName()] = newSymbol;
allSymbols[newSymbol->getMangledName()] = newSymbol;
@@ -206,6 +210,9 @@
void
LTO::getTarget (Module *M) {
+ if (Target)
+ return;
+
std::string Err;
const TargetMachineRegistry::Entry* March =
TargetMachineRegistry::getClosestStaticTargetForModule(*M, Err);
@@ -230,8 +237,7 @@
PassManager Passes;
// Collect Target info
- if (!Target)
- getTarget(M);
+ getTarget(M);
if (!Target)
return LTO_NO_TARGET;
More information about the llvm-commits
mailing list