aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/X86/AsmPrinter
diff options
context:
space:
mode:
authorTorok Edwin <edwintorok@gmail.com>2009-07-11 20:10:48 +0000
committerTorok Edwin <edwintorok@gmail.com>2009-07-11 20:10:48 +0000
commitc25e7581b9b8088910da31702d4ca21c4734c6d7 (patch)
treee4bb95c96a33fda5d5204f2c9d1b906084760415 /lib/Target/X86/AsmPrinter
parentd51ffcf303070b0a5aea7f365b85f6f969c384cb (diff)
downloadexternal_llvm-c25e7581b9b8088910da31702d4ca21c4734c6d7.zip
external_llvm-c25e7581b9b8088910da31702d4ca21c4734c6d7.tar.gz
external_llvm-c25e7581b9b8088910da31702d4ca21c4734c6d7.tar.bz2
assert(0) -> LLVM_UNREACHABLE.
Make llvm_unreachable take an optional string, thus moving the cerr<< out of line. LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for NDEBUG builds. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75379 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/AsmPrinter')
-rw-r--r--lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp17
-rw-r--r--lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp6
-rw-r--r--lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp9
3 files changed, 17 insertions, 15 deletions
diff --git a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
index 4cd332b..b9f1dbd 100644
--- a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
+++ b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
@@ -33,6 +33,7 @@
#include "llvm/CodeGen/DwarfWriter.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Mangler.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetAsmInfo.h"
@@ -54,7 +55,7 @@ void X86ATTAsmPrinter::PrintPICBaseSymbol() const {
else if (Subtarget->isTargetELF())
O << ".Lllvm$" << getFunctionNumber() << ".$piclabel";
else
- assert(0 && "Don't know how to print PIC label!\n");
+ LLVM_UNREACHABLE( "Don't know how to print PIC label!\n");
}
/// PrintUnmangledNameSafely - Print out the printable characters in the name.
@@ -154,7 +155,7 @@ void X86ATTAsmPrinter::decorateName(std::string &Name,
}
break;
default:
- assert(0 && "Unsupported DecorationStyle");
+ LLVM_UNREACHABLE( "Unsupported DecorationStyle");
}
}
@@ -166,7 +167,7 @@ void X86ATTAsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
SwitchToSection(TAI->SectionForGlobal(F));
switch (F->getLinkage()) {
- default: assert(0 && "Unknown linkage type!");
+ default: LLVM_UNREACHABLE( "Unknown linkage type!");
case Function::InternalLinkage: // Symbols default to internal.
case Function::PrivateLinkage:
EmitAlignment(FnAlign, F);
@@ -292,7 +293,7 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
void X86ATTAsmPrinter::print_pcrel_imm(const MachineInstr *MI, unsigned OpNo) {
const MachineOperand &MO = MI->getOperand(OpNo);
switch (MO.getType()) {
- default: assert(0 && "Unknown pcrel immediate operand");
+ default: LLVM_UNREACHABLE( "Unknown pcrel immediate operand");
case MachineOperand::MO_Immediate:
O << MO.getImm();
return;
@@ -375,7 +376,7 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
const char *Modifier) {
const MachineOperand &MO = MI->getOperand(OpNo);
switch (MO.getType()) {
- default: assert(0 && "unknown operand type!");
+ default: LLVM_UNREACHABLE( "unknown operand type!");
case MachineOperand::MO_Register: {
assert(TargetRegisterInfo::isPhysicalRegister(MO.getReg()) &&
"Virtual registers should not make it this far!");
@@ -472,7 +473,7 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
switch (MO.getTargetFlags()) {
default:
- assert(0 && "Unknown target flag on GV operand");
+ LLVM_UNREACHABLE( "Unknown target flag on GV operand");
case X86II::MO_NO_FLAG: // No flag.
break;
case X86II::MO_DARWIN_NONLAZY:
@@ -775,7 +776,7 @@ void X86ATTAsmPrinter::printMachineInstruction(const MachineInstr *MI) {
} else if (MO.isMBB()) {
MCOp.MakeMBBLabel(getFunctionNumber(), MO.getMBB()->getNumber());
} else {
- assert(0 && "Unimp");
+ LLVM_UNREACHABLE( "Unimp");
}
TmpInst.addOperand(MCOp);
@@ -927,7 +928,7 @@ void X86ATTAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
case GlobalValue::InternalLinkage:
break;
default:
- assert(0 && "Unknown linkage type!");
+ LLVM_UNREACHABLE( "Unknown linkage type!");
}
EmitAlignment(Align, GVar);
diff --git a/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp
index 5b10c7b..6b9167f 100644
--- a/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp
+++ b/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp
@@ -28,7 +28,7 @@ using namespace llvm;
void X86ATTAsmPrinter::printSSECC(const MCInst *MI, unsigned Op) {
switch (MI->getOperand(Op).getImm()) {
- default: assert(0 && "Invalid ssecc argument!");
+ default: LLVM_UNREACHABLE( "Invalid ssecc argument!");
case 0: O << "eq"; break;
case 1: O << "lt"; break;
case 2: O << "le"; break;
@@ -42,7 +42,7 @@ void X86ATTAsmPrinter::printSSECC(const MCInst *MI, unsigned Op) {
void X86ATTAsmPrinter::printPICLabel(const MCInst *MI, unsigned Op) {
- assert(0 &&
+ LLVM_UNREACHABLE(
"This is only used for MOVPC32r, should lower before asm printing!");
}
@@ -61,7 +61,7 @@ void X86ATTAsmPrinter::print_pcrel_imm(const MCInst *MI, unsigned OpNo) {
O << TAI->getPrivateGlobalPrefix() << "BB" << Op.getMBBLabelFunction()
<< '_' << Op.getMBBLabelBlock();
else
- assert(0 && "Unknown pcrel immediate operand");
+ LLVM_UNREACHABLE( "Unknown pcrel immediate operand");
}
diff --git a/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
index ad8d6ad..31b2654 100644
--- a/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
+++ b/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
@@ -26,6 +26,7 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/CodeGen/DwarfWriter.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Mangler.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetOptions.h"
@@ -114,7 +115,7 @@ void X86IntelAsmPrinter::decorateName(std::string &Name,
break;
default:
- assert(0 && "Unsupported DecorationStyle");
+ LLVM_UNREACHABLE( "Unsupported DecorationStyle");
}
}
@@ -143,7 +144,7 @@ bool X86IntelAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
SwitchToTextSection("_text", F);
switch (F->getLinkage()) {
- default: assert(0 && "Unsupported linkage type!");
+ default: LLVM_UNREACHABLE( "Unsupported linkage type!");
case Function::PrivateLinkage:
case Function::InternalLinkage:
EmitAlignment(FnAlign);
@@ -267,7 +268,7 @@ void X86IntelAsmPrinter::printOp(const MachineOperand &MO,
void X86IntelAsmPrinter::print_pcrel_imm(const MachineInstr *MI, unsigned OpNo){
const MachineOperand &MO = MI->getOperand(OpNo);
switch (MO.getType()) {
- default: assert(0 && "Unknown pcrel immediate operand");
+ default: LLVM_UNREACHABLE( "Unknown pcrel immediate operand");
case MachineOperand::MO_Immediate:
O << MO.getImm();
return;
@@ -519,7 +520,7 @@ bool X86IntelAsmPrinter::doFinalization(Module &M) {
SwitchToSection(TAI->getDataSection());
break;
default:
- assert(0 && "Unknown linkage type!");
+ LLVM_UNREACHABLE( "Unknown linkage type!");
}
if (!bCustomSegment)