[llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp AlphaTargetMachine.cpp AlphaTargetMachine.h
Jim Laskey
jlaskey at apple.com
Thu Sep 7 15:07:09 PDT 2006
Changes in directory llvm/lib/Target/Alpha:
AlphaAsmPrinter.cpp updated: 1.47 -> 1.48
AlphaTargetMachine.cpp updated: 1.29 -> 1.30
AlphaTargetMachine.h updated: 1.15 -> 1.16
---
Log message:
Make target asm info a property of the target machine.
---
Diffs of the changes: (+13 -11)
AlphaAsmPrinter.cpp | 12 ++----------
AlphaTargetMachine.cpp | 3 ++-
AlphaTargetMachine.h | 9 +++++++++
3 files changed, 13 insertions(+), 11 deletions(-)
Index: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp
diff -u llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.47 llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.48
--- llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.47 Wed Sep 6 13:34:40 2006
+++ llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp Thu Sep 7 17:06:40 2006
@@ -29,20 +29,13 @@
namespace {
Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed");
- struct VISIBILITY_HIDDEN AlphaTargetAsmInfo : public TargetAsmInfo {
- AlphaTargetAsmInfo() {
- AlignmentIsInBytes = false;
- PrivateGlobalPrefix = "$";
- }
- };
-
struct VISIBILITY_HIDDEN AlphaAsmPrinter : public AsmPrinter {
/// Unique incrementer for label values for referencing Global values.
///
unsigned LabelNumber;
- AlphaAsmPrinter(std::ostream &o, TargetMachine &tm, TargetAsmInfo *T)
+ AlphaAsmPrinter(std::ostream &o, TargetMachine &tm, const TargetAsmInfo *T)
: AsmPrinter(o, tm, T), LabelNumber(0) {
}
@@ -82,8 +75,7 @@
///
FunctionPass *llvm::createAlphaCodePrinterPass (std::ostream &o,
TargetMachine &tm) {
- AlphaTargetAsmInfo *TAI = new AlphaTargetAsmInfo();
- return new AlphaAsmPrinter(o, tm, TAI);
+ return new AlphaAsmPrinter(o, tm, tm.getTargetAsmInfo());
}
#include "AlphaGenAsmWriter.inc"
Index: llvm/lib/Target/Alpha/AlphaTargetMachine.cpp
diff -u llvm/lib/Target/Alpha/AlphaTargetMachine.cpp:1.29 llvm/lib/Target/Alpha/AlphaTargetMachine.cpp:1.30
--- llvm/lib/Target/Alpha/AlphaTargetMachine.cpp:1.29 Sun Sep 3 23:14:57 2006
+++ llvm/lib/Target/Alpha/AlphaTargetMachine.cpp Thu Sep 7 17:06:40 2006
@@ -53,7 +53,8 @@
: DataLayout("e"),
FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0),
JITInfo(*this),
- Subtarget(M, FS) {
+ Subtarget(M, FS),
+ AsmInfo(NULL) {
}
Index: llvm/lib/Target/Alpha/AlphaTargetMachine.h
diff -u llvm/lib/Target/Alpha/AlphaTargetMachine.h:1.15 llvm/lib/Target/Alpha/AlphaTargetMachine.h:1.16
--- llvm/lib/Target/Alpha/AlphaTargetMachine.h:1.15 Sun Sep 3 23:14:57 2006
+++ llvm/lib/Target/Alpha/AlphaTargetMachine.h Thu Sep 7 17:06:40 2006
@@ -20,6 +20,7 @@
#include "AlphaInstrInfo.h"
#include "AlphaJITInfo.h"
#include "AlphaSubtarget.h"
+#include "AlphaTargetAsmInfo.h"
namespace llvm {
@@ -31,9 +32,13 @@
TargetFrameInfo FrameInfo;
AlphaJITInfo JITInfo;
AlphaSubtarget Subtarget;
+ AlphaTargetAsmInfo *AsmInfo;
public:
AlphaTargetMachine(const Module &M, const std::string &FS);
+ ~AlphaTargetMachine() {
+ if (AsmInfo) delete AsmInfo;
+ }
virtual const AlphaInstrInfo *getInstrInfo() const { return &InstrInfo; }
virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
@@ -46,6 +51,10 @@
return &JITInfo;
}
+ virtual const TargetAsmInfo *createTargetAsmInfo() const {
+ return static_cast<const TargetAsmInfo *>(new AlphaTargetAsmInfo(*this));
+ }
+
static unsigned getJITMatchQuality();
static unsigned getModuleMatchQuality(const Module &M);
More information about the llvm-commits
mailing list