[llvm-commits] [llvm] r75027 - in /llvm/trunk: include/llvm/CodeGen/ include/llvm/Support/ lib/Target/Alpha/ lib/Target/Alpha/AsmPrinter/ lib/Target/IA64/ lib/Target/IA64/AsmPrinter/ lib/Target/MSP430/ lib/Target/Mips/AsmPrinter/ lib/Target/PIC16/ lib/Target/Sparc/AsmPrinter/ lib/Target/X86/ lib/Target/XCore/ utils/TableGen/
Chris Lattner
clattner at apple.com
Wed Jul 8 13:00:51 PDT 2009
On Jul 8, 2009, at 12:04 PM, Torok Edwin wrote:
> Log:
> Convert more abort() calls to llvm_report_error().
> Also remove trailing semicolon.
Ok.
> +++ llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h Wed Jul 8
> 14:04:27 2009
> @@ -18,6 +18,8 @@
> #define LLVM_CODEGEN_MACHINECODEEMITTER_H
>
> #include "llvm/Support/DataTypes.h"
> +#include "llvm/Support/ErrorHandling.h"
> +#include "llvm/Support/raw_ostream.h"
Please don't include headers in other headers unless you cannot avoid
it.
> +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 8
> 14:04:27 2009
> @@ -19,6 +19,8 @@
> #include "llvm/Pass.h"
> #include "llvm/Constant.h"
> #include "llvm/CodeGen/SelectionDAG.h"
> +#include "llvm/Support/ErrorHandling.h"
> +#include "llvm/Support/raw_ostream.h"
Likewise.
> +++ llvm/trunk/lib/Target/Alpha/AlphaCodeEmitter.cpp Wed Jul 8
> 14:04:27 2009
> @@ -234,9 +234,11 @@
> } else if (MO.isMBB()) {
>
> MCE.addRelocation(MachineRelocation::getBB(MCE.getCurrentPCOffset(),
> Alpha::reloc_bsr,
> MO.getMBB()));
> - }else {
> - cerr << "ERROR: Unknown type of MachineOperand: " << MO << "\n";
> - abort();
> + } else {
> + std::string msg;
> + raw_string_ostream Msg(msg);
> + Msg << "ERROR: Unknown type of MachineOperand: " << MO;
> + llvm_report_error(Msg.str());
> }
Should be an assertion.
> +++ llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp Wed Jul 8
> 14:04:27 2009
> @@ -19,6 +19,7 @@
> #include "llvm/ADT/STLExtras.h"
> #include "llvm/ADT/SmallVector.h"
> #include "llvm/CodeGen/MachineInstrBuilder.h"
> +#include "llvm/Support/ErrorHandling.h"
> using namespace llvm;
>
> AlphaInstrInfo::AlphaInstrInfo()
> @@ -200,7 +201,7 @@
> .addReg(SrcReg, getKillRegState(isKill))
> .addFrameIndex(FrameIdx).addReg(Alpha::F31);
> else
> - abort();
> + llvm_report_error("Unhandled register class");
> }
>
> void AlphaInstrInfo::storeRegToAddr(MachineFunction &MF, unsigned
> SrcReg,
> @@ -216,7 +217,7 @@
> else if (RC == Alpha::GPRCRegisterClass)
> Opc = Alpha::STQ;
> else
> - abort();
> + llvm_report_error("Unhandled register class");
> DebugLoc DL = DebugLoc::getUnknownLoc();
> MachineInstrBuilder MIB =
> BuildMI(MF, DL, get(Opc)).addReg(SrcReg, getKillRegState(isKill));
> @@ -245,7 +246,7 @@
> BuildMI(MBB, MI, DL, get(Alpha::LDQ), DestReg)
> .addFrameIndex(FrameIdx).addReg(Alpha::F31);
> else
> - abort();
> + llvm_report_error("Unhandled register class");
> }
>
> void AlphaInstrInfo::loadRegFromAddr(MachineFunction &MF, unsigned
> DestReg,
> @@ -260,7 +261,7 @@
> else if (RC == Alpha::GPRCRegisterClass)
> Opc = Alpha::LDQ;
> else
> - abort();
> + llvm_report_error("Unhandled register class");
> DebugLoc DL = DebugLoc::getUnknownLoc();
> MachineInstrBuilder MIB =
> BuildMI(MF, DL, get(Opc), DestReg);
These should all be assertions.
>
> +++ llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp Wed
> Jul 8 14:04:27 2009
> @@ -100,8 +101,7 @@
> return;
>
> case MachineOperand::MO_Immediate:
> - cerr << "printOp() does not handle immediate values\n";
> - abort();
> + llvm_report_error("printOp() does not handle immediate values");
> return;
assertion.
>
> +++ llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp Wed
> Jul 8 14:04:27 2009
> @@ -26,6 +26,7 @@
> #include "llvm/CodeGen/DwarfWriter.h"
> #include "llvm/CodeGen/MachineFunctionPass.h"
> #include "llvm/Target/TargetAsmInfo.h"
> +#include "llvm/Support/ErrorHandling.h"
> #include "llvm/Support/Mangler.h"
> #include "llvm/Support/raw_ostream.h"
> #include "llvm/ADT/Statistic.h"
> @@ -317,16 +318,13 @@
> case GlobalValue::PrivateLinkage:
> break;
> case GlobalValue::GhostLinkage:
> - cerr << "GhostLinkage cannot appear in IA64AsmPrinter!\n";
> - abort();
> + llvm_report_error("GhostLinkage cannot appear in
> IA64AsmPrinter!");
> case GlobalValue::DLLImportLinkage:
> - cerr << "DLLImport linkage is not supported by this target!\n";
> - abort();
> + llvm_report_error("DLLImport linkage is not supported by this
> target!");
> case GlobalValue::DLLExportLinkage:
> - cerr << "DLLExport linkage is not supported by this target!\n";
> - abort();
> + llvm_report_error("DLLExport linkage is not supported by this
> target!");
assertions.
> +++ llvm/trunk/lib/Target/MSP430/MSP430ISelLowering.cpp Wed Jul 8
> 14:04:27 2009
> @@ -32,6 +32,7 @@
> #include "llvm/CodeGen/SelectionDAGISel.h"
> #include "llvm/CodeGen/ValueTypes.h"
> #include "llvm/Support/Debug.h"
> +#include "llvm/Support/ErrorHandling.h"
> #include "llvm/ADT/VectorExtras.h"
> using namespace llvm;
>
> @@ -190,11 +191,14 @@
> // Arguments passed in registers
> MVT RegVT = VA.getLocVT();
> switch (RegVT.getSimpleVT()) {
> - default:
> - cerr << "LowerFORMAL_ARGUMENTS Unhandled argument type: "
> - << RegVT.getSimpleVT()
> - << "\n";
> - abort();
> + default:
> + {
> + std::string msg;
> + raw_string_ostream Msg(msg);
> + Msg << "LowerFORMAL_ARGUMENTS Unhandled argument type: "
> + << RegVT.getSimpleVT();
> + llvm_report_error(Msg.str());
assertion.
> +++ llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp Wed
> Jul 8 14:04:27 2009
> @@ -405,7 +406,7 @@
> break;
>
> default:
> - O << "<unknown operand type>"; abort (); break;
> + llvm_report_error("<unknown operand type>"); break;
assertion.
> }
>
> if (closeP) O << ")";
> @@ -544,16 +545,13 @@
> printSizeAndType = false;
> break;
> case GlobalValue::GhostLinkage:
> - cerr << "Should not have any unmaterialized functions!\n";
> - abort();
> + llvm_report_error("Should not have any unmaterialized
> functions!");
> case GlobalValue::DLLImportLinkage:
> - cerr << "DLLImport linkage is not supported by this target!\n";
> - abort();
> + llvm_report_error("DLLImport linkage is not supported by this
> target!");
> case GlobalValue::DLLExportLinkage:
> - cerr << "DLLExport linkage is not supported by this target!\n";
> - abort();
> + llvm_report_error("DLLExport linkage is not supported by this
> target!");
assertions.
>
> +++ llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp Wed
> Jul 8 14:04:27 2009
> @@ -184,7 +185,7 @@
> << MO.getIndex();
> break;
> default:
> - O << "<unknown operand type>"; abort (); break;
> + llvm_report_error("<unknown operand type>"); break;
assertion.
> }
> if (CloseParen) O << ")";
> }
> @@ -298,16 +299,13 @@
> case GlobalValue::InternalLinkage:
> break;
> case GlobalValue::GhostLinkage:
> - cerr << "Should not have any unmaterialized functions!\n";
> - abort();
> + llvm_report_error("Should not have any unmaterialized
> functions!");
> case GlobalValue::DLLImportLinkage:
> - cerr << "DLLImport linkage is not supported by this target!\n";
> - abort();
> + llvm_report_error("DLLImport linkage is not supported by this
> target!");
> case GlobalValue::DLLExportLinkage:
> - cerr << "DLLExport linkage is not supported by this target!\n";
> - abort();
> + llvm_report_error("DLLExport linkage is not supported by this
> target!");
assertions.
>
> +++ llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp Wed Jul 8
> 14:04:27 2009
> @@ -204,14 +204,11 @@
> case GlobalValue::PrivateLinkage:
> break;
> case GlobalValue::GhostLinkage:
> - cerr << "Should not have any unmaterialized functions!\n";
> - abort();
> + llvm_report_error("Should not have any unmaterialized
> functions!");
> case GlobalValue::DLLImportLinkage:
> - cerr << "DLLImport linkage is not supported by this target!\n";
> - abort();
> + llvm_report_error("DLLImport linkage is not supported by this
> target!");
> case GlobalValue::DLLExportLinkage:
> - cerr << "DLLExport linkage is not supported by this target!\n";
> - abort();
> + llvm_report_error("DLLExport linkage is not supported by this
> target!");
assertions. :)
>
> +++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp Wed Jul 8
> 14:04:27 2009
> @@ -270,9 +270,8 @@
> }
> const Type *Ty = cast<PointerType>(GV->getType())->getElementType();
> if (!Ty->isSized() || isZeroLengthArray(Ty)) {
> - cerr << "Size of thread local object " << GVar->getName()
> - << " is unknown\n";
> - abort();
> + llvm_report_error("Size of thread local object " + GVar-
> >getName()
> + + " is unknown");
This should be an assertion, does the verifier catch this? If not, it
should.
> }
> SDValue base = getGlobalAddressWrapper(GA, GV, DAG);
> const TargetData *TD = TM.getTargetData();
> @@ -646,10 +645,13 @@
> MVT RegVT = VA.getLocVT();
> switch (RegVT.getSimpleVT()) {
> default:
> - cerr << "LowerFORMAL_ARGUMENTS Unhandled argument type: "
> - << RegVT.getSimpleVT()
> - << "\n";
> - abort();
> + {
> + std::string msg;
> + raw_string_ostream Msg(msg);
> + Msg << "LowerFORMAL_ARGUMENTS Unhandled argument type: "
> + << RegVT.getSimpleVT();
> + llvm_report_error(Msg.str());
> + }
assertion.
>
> +++ llvm/trunk/lib/Target/XCore/XCoreRegisterInfo.cpp Wed Jul 8
> 14:04:27 2009
> @@ -30,6 +30,8 @@
> #include "llvm/ADT/BitVector.h"
> #include "llvm/ADT/STLExtras.h"
> #include "llvm/Support/Debug.h"
> +#include "llvm/Support/ErrorHandling.h"
> +#include "llvm/Support/raw_ostream.h"
>
> using namespace llvm;
>
> @@ -142,9 +144,11 @@
>
> if (!isU6 && !isImmU16(Amount)) {
> // FIX could emit multiple instructions in this case.
> - cerr << "eliminateCallFramePseudoInstr size too big: "
> - << Amount << "\n";
> - abort();
> + std::string msg;
> + raw_string_ostream Msg(msg);
> + Msg << "eliminateCallFramePseudoInstr size too big: "
> + << Amount;
> + llvm_report_error(Msg.str());
assertion.
> +++ llvm/trunk/utils/TableGen/CodeEmitterGen.cpp Wed Jul 8 14:04:27
> 2009
> @@ -243,8 +243,10 @@
>
> // Default case: unhandled opcode
> o << " default:\n"
> - << " cerr << \"Not supported instr: \" << MI << \"\\n\";\n"
> - << " abort();\n"
> + << " std::string msg;\n"
> + << " raw_string_ostream Msg(msg);\n"
> + << " Msg << \"Not supported instr: \" << MI;\n"
> + << " llvm_report_error(Msg.str());\n"
Yay :)
-Chris
More information about the llvm-commits
mailing list