diff options
author | Chris Lattner <sabre@nondot.org> | 2004-08-16 23:38:36 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-08-16 23:38:36 +0000 |
commit | 416ca3384afcd4277b41c230736eb0a4552165f7 (patch) | |
tree | bb2e45c9ed37cc497a1513bf1dda3cc19472b3c4 /lib | |
parent | 36aacdb974a65e1f5c76c38a008a01c3f44202d9 (diff) | |
download | external_llvm-416ca3384afcd4277b41c230736eb0a4552165f7.zip external_llvm-416ca3384afcd4277b41c230736eb0a4552165f7.tar.gz external_llvm-416ca3384afcd4277b41c230736eb0a4552165f7.tar.bz2 |
More changes to make PPC32 and X86 more similar
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15842 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/PowerPC/PPC32AsmPrinter.cpp | 20 | ||||
-rw-r--r-- | lib/Target/PowerPC/PPCAsmPrinter.cpp | 20 |
2 files changed, 18 insertions, 22 deletions
diff --git a/lib/Target/PowerPC/PPC32AsmPrinter.cpp b/lib/Target/PowerPC/PPC32AsmPrinter.cpp index df7b1be..151580c 100644 --- a/lib/Target/PowerPC/PPC32AsmPrinter.cpp +++ b/lib/Target/PowerPC/PPC32AsmPrinter.cpp @@ -152,13 +152,16 @@ static void printAsCString(std::ostream &O, const ConstantArray *CVA) { void PowerPCAsmPrinter::emitGlobalConstant(const Constant *CV) { const TargetData &TD = TM.getTargetData(); - if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV)) { - if (isStringCompatible(CVA)) { - O << "\t.ascii "; + if (CV->isNullValue()) { + O << "\t.space\t" << TD.getTypeSize(CV->getType()) << "\n"; + return; + } else if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV)) { + if (CVA->isString()) { + O << "\t.ascii\t"; printAsCString(O, CVA); O << "\n"; } else { // Not a string. Print the values in successive locations - for (unsigned i=0, e = CVA->getNumOperands(); i != e; i++) + for (unsigned i = 0, e = CVA->getNumOperands(); i != e; ++i) emitGlobalConstant(CVA->getOperand(i)); } return; @@ -166,7 +169,7 @@ void PowerPCAsmPrinter::emitGlobalConstant(const Constant *CV) { // Print the fields in successive locations. Pad to align if needed! const StructLayout *cvsLayout = TD.getStructLayout(CVS->getType()); unsigned sizeSoFar = 0; - for (unsigned i = 0, e = CVS->getNumOperands(); i != e; i++) { + for (unsigned i = 0, e = CVS->getNumOperands(); i != e; ++i) { const Constant* field = CVS->getOperand(i); // Check if padding is needed and insert one or more 0s. @@ -243,12 +246,7 @@ void PowerPCAsmPrinter::emitGlobalConstant(const Constant *CV) { case Type::FloatTyID: case Type::DoubleTyID: assert (0 && "Should have already output floating point constant."); default: - if (CV == Constant::getNullValue(type)) { // Zero initializer? - O << ".space\t" << TD.getTypeSize(type) << "\n"; - return; - } - std::cerr << "Can't handle printing: " << *CV; - abort(); + assert (0 && "Can't handle printing this type of thing"); break; } O << "\t"; diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp index df7b1be..151580c 100644 --- a/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -152,13 +152,16 @@ static void printAsCString(std::ostream &O, const ConstantArray *CVA) { void PowerPCAsmPrinter::emitGlobalConstant(const Constant *CV) { const TargetData &TD = TM.getTargetData(); - if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV)) { - if (isStringCompatible(CVA)) { - O << "\t.ascii "; + if (CV->isNullValue()) { + O << "\t.space\t" << TD.getTypeSize(CV->getType()) << "\n"; + return; + } else if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV)) { + if (CVA->isString()) { + O << "\t.ascii\t"; printAsCString(O, CVA); O << "\n"; } else { // Not a string. Print the values in successive locations - for (unsigned i=0, e = CVA->getNumOperands(); i != e; i++) + for (unsigned i = 0, e = CVA->getNumOperands(); i != e; ++i) emitGlobalConstant(CVA->getOperand(i)); } return; @@ -166,7 +169,7 @@ void PowerPCAsmPrinter::emitGlobalConstant(const Constant *CV) { // Print the fields in successive locations. Pad to align if needed! const StructLayout *cvsLayout = TD.getStructLayout(CVS->getType()); unsigned sizeSoFar = 0; - for (unsigned i = 0, e = CVS->getNumOperands(); i != e; i++) { + for (unsigned i = 0, e = CVS->getNumOperands(); i != e; ++i) { const Constant* field = CVS->getOperand(i); // Check if padding is needed and insert one or more 0s. @@ -243,12 +246,7 @@ void PowerPCAsmPrinter::emitGlobalConstant(const Constant *CV) { case Type::FloatTyID: case Type::DoubleTyID: assert (0 && "Should have already output floating point constant."); default: - if (CV == Constant::getNullValue(type)) { // Zero initializer? - O << ".space\t" << TD.getTypeSize(type) << "\n"; - return; - } - std::cerr << "Can't handle printing: " << *CV; - abort(); + assert (0 && "Can't handle printing this type of thing"); break; } O << "\t"; |