aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/llvm/CodeGen/AsmPrinter.h4
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp6
-rw-r--r--lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp9
-rw-r--r--lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp8
-rw-r--r--lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp6
-rw-r--r--lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp9
6 files changed, 17 insertions, 25 deletions
diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h
index 84d0a43..918b5a6 100644
--- a/include/llvm/CodeGen/AsmPrinter.h
+++ b/include/llvm/CodeGen/AsmPrinter.h
@@ -169,6 +169,10 @@ namespace llvm {
/// call this implementation.
bool doInitialization(Module &M);
+ /// EmitStartOfAsmFile - This virtual method can be overridden by targets
+ /// that want to emit something at the start of their file.
+ virtual void EmitStartOfAsmFile(Module &M) {}
+
/// EmitEndOfAsmFile - This virtual method can be overridden by targets that
/// want to emit something at the end of their file.
virtual void EmitEndOfAsmFile(Module &M) {}
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 9c6c5b5..14dc898 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -110,8 +110,8 @@ bool AsmPrinter::doInitialization(Module &M) {
if (MAI->doesAllowNameToStartWithDigit())
Mang->setSymbolsCanStartWithDigit(true);
- GCModuleInfo *MI = getAnalysisIfAvailable<GCModuleInfo>();
- assert(MI && "AsmPrinter didn't require GCModuleInfo?");
+ // Allow the target to emit any magic that it wants at the start of the file.
+ EmitStartOfAsmFile(M);
if (MAI->hasSingleParameterDotFile()) {
/* Very minimal debug info. It is ignored if we emit actual
@@ -120,6 +120,8 @@ bool AsmPrinter::doInitialization(Module &M) {
O << "\t.file\t\"" << M.getModuleIdentifier() << "\"\n";
}
+ GCModuleInfo *MI = getAnalysisIfAvailable<GCModuleInfo>();
+ assert(MI && "AsmPrinter didn't require GCModuleInfo?");
for (GCModuleInfo::iterator I = MI->begin(), E = MI->end(); I != E; ++I)
if (GCMetadataPrinter *MP = GetOrCreateGCPrinter(*I))
MP->beginAssembly(O, *this, *MAI);
diff --git a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
index 71497b4..b496a81 100644
--- a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
+++ b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
@@ -149,8 +149,8 @@ namespace {
void printMachineInstruction(const MachineInstr *MI);
bool runOnMachineFunction(MachineFunction &F);
- bool doInitialization(Module &M);
bool doFinalization(Module &M);
+ void EmitStartOfAsmFile(Module &M);
/// EmitMachineConstantPoolValue - Print a machine constantpool value to
/// the .s file.
@@ -1043,8 +1043,7 @@ void ARMAsmPrinter::printMachineInstruction(const MachineInstr *MI) {
O << '\n';
}
-bool ARMAsmPrinter::doInitialization(Module &M) {
-
+void ARMAsmPrinter::EmitStartOfAsmFile(Module &M) {
if (Subtarget->isTargetDarwin()) {
Reloc::Model RelocM = TM.getRelocationModel();
if (RelocM == Reloc::PIC_ || RelocM == Reloc::DynamicNoPIC) {
@@ -1064,8 +1063,6 @@ bool ARMAsmPrinter::doInitialization(Module &M) {
}
}
- bool Result = AsmPrinter::doInitialization(M);
-
// Use unified assembler syntax mode for Thumb.
if (Subtarget->isThumb())
O << "\t.syntax unified\n";
@@ -1102,8 +1099,6 @@ bool ARMAsmPrinter::doInitialization(Module &M) {
// FIXME: Should we signal R9 usage?
}
-
- return Result;
}
void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
diff --git a/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp b/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
index 4754773..0e36df3 100644
--- a/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
+++ b/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
@@ -56,7 +56,7 @@ namespace {
void printBaseOffsetPair(const MachineInstr *MI, int i, bool brackets=true);
void PrintGlobalVariable(const GlobalVariable *GVar);
bool runOnMachineFunction(MachineFunction &F);
- bool doInitialization(Module &M);
+ void EmitStartOfAsmFile(Module &M);
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
unsigned AsmVariant, const char *ExtraCode);
@@ -193,14 +193,12 @@ bool AlphaAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
return false;
}
-bool AlphaAsmPrinter::doInitialization(Module &M)
-{
- if(TM.getSubtarget<AlphaSubtarget>().hasCT())
+void AlphaAsmPrinter::EmitStartOfAsmFile(Module &M) {
+ if (TM.getSubtarget<AlphaSubtarget>().hasCT())
O << "\t.arch ev6\n"; //This might need to be ev67, so leave this test here
else
O << "\t.arch ev6\n";
O << "\t.set noat\n";
- return AsmPrinter::doInitialization(M);
}
void AlphaAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
diff --git a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
index 4962603..fb5e5fc 100644
--- a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
+++ b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
@@ -85,7 +85,7 @@ namespace {
static const char *getRegisterName(unsigned RegNo);
bool runOnMachineFunction(MachineFunction &F);
- bool doInitialization(Module &M);
+ void EmitStartOfAsmFile(Module &M);
};
} // end of anonymous namespace
@@ -408,7 +408,7 @@ printFCCOperand(const MachineInstr *MI, int opNum, const char *Modifier) {
O << Mips::MipsFCCToString((Mips::CondCode)MO.getImm());
}
-bool MipsAsmPrinter::doInitialization(Module &M) {
+void MipsAsmPrinter::EmitStartOfAsmFile(Module &M) {
// FIXME: Use SwitchSection.
// Tell the assembler which ABI we are using
@@ -421,8 +421,6 @@ bool MipsAsmPrinter::doInitialization(Module &M) {
// return to previous section
O << "\t.previous" << '\n';
-
- return AsmPrinter::doInitialization(M);
}
void MipsAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
diff --git a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
index 09f4af3..f55e6a1 100644
--- a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
+++ b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
@@ -381,8 +381,8 @@ namespace {
}
bool runOnMachineFunction(MachineFunction &F);
- bool doInitialization(Module &M);
bool doFinalization(Module &M);
+ void EmitStartOfAsmFile(Module &M);
void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
@@ -862,7 +862,7 @@ bool PPCDarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
}
-bool PPCDarwinAsmPrinter::doInitialization(Module &M) {
+void PPCDarwinAsmPrinter::EmitStartOfAsmFile(Module &M) {
static const char *const CPUDirectives[] = {
"",
"ppc",
@@ -885,9 +885,6 @@ bool PPCDarwinAsmPrinter::doInitialization(Module &M) {
assert(Directive <= PPC::DIR_64 && "Directive out of range.");
O << "\t.machine " << CPUDirectives[Directive] << '\n';
- bool Result = AsmPrinter::doInitialization(M);
- assert(MMI);
-
// Prime text sections so they are adjacent. This reduces the likelihood a
// large data or debug section causes a branch to exceed 16M limit.
TargetLoweringObjectFileMachO &TLOFMacho =
@@ -907,8 +904,6 @@ bool PPCDarwinAsmPrinter::doInitialization(Module &M) {
16, SectionKind::getText()));
}
OutStreamer.SwitchSection(getObjFileLowering().getTextSection());
-
- return Result;
}
void PPCDarwinAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {