#include "llvm/Support/Debug.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Target/TargetAsmInfo.h"
-#include "llvm/Target/MRegisterInfo.h"
+#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/ADT/Statistic.h"
///
void printRegister(const MachineOperand &MO, bool R0AsZero) {
unsigned RegNo = MO.getReg();
- assert(MRegisterInfo::isPhysicalRegister(RegNo) && "Not physreg??");
+ assert(TargetRegisterInfo::isPhysicalRegister(RegNo) && "Not physreg??");
// If we should use 0 for R0.
if (R0AsZero && RegNo == PPC::R0) {
return Result;
}
+/// PrintUnmangledNameSafely - Print out the printable characters in the name.
+/// Don't print things like \n or \0.
+static void PrintUnmangledNameSafely(const Value *V, std::ostream &OS) {
+ for (const char *Name = V->getNameStart(), *E = Name+V->getNameLen();
+ Name != E; ++Name)
+ if (isprint(*Name))
+ OS << *Name;
+}
+
bool LinuxAsmPrinter::doFinalization(Module &M) {
const TargetData *TD = TM.getTargetData();
SwitchToDataSection("\t.data", I);
O << ".comm " << name << "," << Size;
}
- O << "\t\t" << TAI->getCommentString() << " '" << I->getName() << "'\n";
+ O << "\t\t" << TAI->getCommentString() << " '";
+ PrintUnmangledNameSafely(I, O);
+ O << "'\n";
} else {
switch (I->getLinkage()) {
case GlobalValue::LinkOnceLinkage:
}
EmitAlignment(Align, I);
- O << name << ":\t\t\t\t" << TAI->getCommentString() << " '"
- << I->getName() << "'\n";
+ O << name << ":\t\t\t\t" << TAI->getCommentString() << " '";
+ PrintUnmangledNameSafely(I, O);
+ O << "'\n";
// If the initializer is a extern weak symbol, remember to emit the weak
// reference!
bool DarwinAsmPrinter::doInitialization(Module &M) {
static const char *CPUDirectives[] = {
+ "",
"ppc",
"ppc601",
"ppc602",
if (Subtarget.isDarwin9())
O << "," << Align;
}
- O << "\t\t" << TAI->getCommentString() << " '" << I->getName() << "'\n";
+ O << "\t\t" << TAI->getCommentString() << " '";
+ PrintUnmangledNameSafely(I, O);
+ O << "'\n";
} else {
switch (I->getLinkage()) {
case GlobalValue::LinkOnceLinkage:
}
EmitAlignment(Align, I);
- O << name << ":\t\t\t\t" << TAI->getCommentString() << " '"
- << I->getName() << "'\n";
+ O << name << ":\t\t\t\t" << TAI->getCommentString() << " '";
+ PrintUnmangledNameSafely(I, O);
+ O << "'\n";
// If the initializer is a extern weak symbol, remember to emit the weak
// reference!