[llvm-commits] CVS: llvm/lib/Target/IA64/IA64AsmPrinter.cpp IA64TargetMachine.cpp IA64TargetMachine.h
Owen Anderson
resistor at mac.com
Tue May 2 18:30:22 PDT 2006
Changes in directory llvm/lib/Target/IA64:
IA64AsmPrinter.cpp updated: 1.27 -> 1.28
IA64TargetMachine.cpp updated: 1.14 -> 1.15
IA64TargetMachine.h updated: 1.7 -> 1.8
---
Log message:
Refactor TargetMachine, pushing handling of TargetData into the target-specific subclasses. This has one caller-visible change: getTargetData() now returns a pointer instead of a reference.
This fixes PR 759: http://llvm.cs.uiuc.edu/PR759 .
---
Diffs of the changes: (+8 -6)
IA64AsmPrinter.cpp | 10 +++++-----
IA64TargetMachine.cpp | 2 +-
IA64TargetMachine.h | 2 ++
3 files changed, 8 insertions(+), 6 deletions(-)
Index: llvm/lib/Target/IA64/IA64AsmPrinter.cpp
diff -u llvm/lib/Target/IA64/IA64AsmPrinter.cpp:1.27 llvm/lib/Target/IA64/IA64AsmPrinter.cpp:1.28
--- llvm/lib/Target/IA64/IA64AsmPrinter.cpp:1.27 Tue May 2 00:37:32 2006
+++ llvm/lib/Target/IA64/IA64AsmPrinter.cpp Tue May 2 20:29:57 2006
@@ -277,7 +277,7 @@
}
bool IA64AsmPrinter::doFinalization(Module &M) {
- const TargetData &TD = TM.getTargetData();
+ const TargetData *TD = TM.getTargetData();
// Print out module-level global variables here.
for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
@@ -290,19 +290,19 @@
O << "\n\n";
std::string name = Mang->getValueName(I);
Constant *C = I->getInitializer();
- unsigned Size = TD.getTypeSize(C->getType());
- unsigned Align = TD.getTypeAlignmentShift(C->getType());
+ unsigned Size = TD->getTypeSize(C->getType());
+ unsigned Align = TD->getTypeAlignmentShift(C->getType());
if (C->isNullValue() &&
(I->hasLinkOnceLinkage() || I->hasInternalLinkage() ||
I->hasWeakLinkage() /* FIXME: Verify correct */)) {
SwitchSection(".data", I);
if (I->hasInternalLinkage()) {
- O << "\t.lcomm " << name << "#," << TD.getTypeSize(C->getType())
+ O << "\t.lcomm " << name << "#," << TD->getTypeSize(C->getType())
<< "," << (1 << Align);
O << "\t\t// ";
} else {
- O << "\t.common " << name << "#," << TD.getTypeSize(C->getType())
+ O << "\t.common " << name << "#," << TD->getTypeSize(C->getType())
<< "," << (1 << Align);
O << "\t\t// ";
}
Index: llvm/lib/Target/IA64/IA64TargetMachine.cpp
diff -u llvm/lib/Target/IA64/IA64TargetMachine.cpp:1.14 llvm/lib/Target/IA64/IA64TargetMachine.cpp:1.15
--- llvm/lib/Target/IA64/IA64TargetMachine.cpp:1.14 Sat Apr 8 14:46:55 2006
+++ llvm/lib/Target/IA64/IA64TargetMachine.cpp Tue May 2 20:29:57 2006
@@ -76,7 +76,7 @@
/// IA64TargetMachine ctor - Create an LP64 architecture model
///
IA64TargetMachine::IA64TargetMachine(const Module &M, const std::string &FS)
- : TargetMachine("IA64", true),
+ : TargetMachine("IA64"), DataLayout("IA64", true),
FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0),
TLInfo(*this) { // FIXME? check this stuff
}
Index: llvm/lib/Target/IA64/IA64TargetMachine.h
diff -u llvm/lib/Target/IA64/IA64TargetMachine.h:1.7 llvm/lib/Target/IA64/IA64TargetMachine.h:1.8
--- llvm/lib/Target/IA64/IA64TargetMachine.h:1.7 Wed Mar 22 23:43:15 2006
+++ llvm/lib/Target/IA64/IA64TargetMachine.h Tue May 2 20:29:57 2006
@@ -23,6 +23,7 @@
namespace llvm {
class IA64TargetMachine : public TargetMachine {
+ const TargetData DataLayout; // Calculates type size & alignment
IA64InstrInfo InstrInfo;
TargetFrameInfo FrameInfo;
//IA64JITInfo JITInfo;
@@ -36,6 +37,7 @@
virtual const MRegisterInfo *getRegisterInfo() const {
return &InstrInfo.getRegisterInfo();
}
+ virtual const TargetData *getTargetData() const { return &DataLayout; }
virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out,
CodeGenFileType FileType, bool Fast);
More information about the llvm-commits
mailing list