llvm.org GIT mirror llvm / b0934ab
Remove dead code. Improve llvm_unreachable text. Simplify some control flow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150918 91177308-0d34-0410-b5e6-96231b3b80d8 Ahmed Charles 8 years ago
21 changed file(s) with 27 addition(s) and 141 deletion(s). Raw diff Collapse all Expand all
490490
491491 RetVal visitCouldNotCompute(const SCEVCouldNotCompute *S) {
492492 llvm_unreachable("Invalid use of SCEVCouldNotCompute!");
493 return RetVal();
494493 }
495494 };
496495 }
111111
112112 bool GCStrategy::performCustomLowering(Function &F) {
113113 dbgs() << "gc " << getName() << " must override performCustomLowering.\n";
114 llvm_unreachable(0);
114 llvm_unreachable("must override performCustomLowering");
115115 }
116116
117117
227227 return &MO;
228228 }
229229 }
230 return NULL;
231230 }
232231
233232 bool StrongPHIElimination::runOnMachineFunction(MachineFunction &MF) {
12341234 break;
12351235 default:
12361236 dbgs() << "Unhandled ConstantExpr: " << *CE << "\n";
1237 llvm_unreachable(0);
1237 llvm_unreachable("Unhandled ConstantExpr");
12381238 }
12391239 return Dest;
12401240 }
3333 return resolveARMRelocation((uintptr_t)Address, (uintptr_t)Value,
3434 isPCRel, Type, Size, Addend);
3535 }
36 llvm_unreachable("");
3736 }
3837
3938 bool RuntimeDyldMachO::
103103 CPUKey key;
104104 key.Triple = str.str();
105105 key.Syntax = syntax;
106
106
107107 EDDisassembler::DisassemblerMap_t::iterator i = sDisassemblers.find(key);
108
108
109109 if (i != sDisassemblers.end()) {
110110 return i->second;
111111 }
112 else {
113 EDDisassembler *sdd = new EDDisassembler(key);
114 if (!sdd->valid()) {
115 delete sdd;
116 return NULL;
117 }
118
119 sDisassemblers[key] = sdd;
120
121 return sdd;
122 }
123
124 return NULL;
125
126 return getDisassembler(Triple(str).getArch(), syntax);
112
113 EDDisassembler *sdd = new EDDisassembler(key);
114 if (!sdd->valid()) {
115 delete sdd;
116 return NULL;
117 }
118
119 sDisassemblers[key] = sdd;
120
121 return sdd;
127122 }
128123
129124 EDDisassembler::EDDisassembler(CPUKey &key) :
164164 // Note that we don't actually get here because HandleCrash calls
165165 // longjmp, which means the HandleCrash function never returns.
166166 llvm_unreachable("Handled the crash, should have longjmp'ed out of here");
167 return EXCEPTION_CONTINUE_SEARCH;
168167 }
169168
170169 // Because the Enable and Disable calls are static, it means that
672672 case 8: O << "nzcvq"; return;
673673 case 12: O << "nzcvqg"; return;
674674 }
675 llvm_unreachable("Unexpected mask value!");
676675 }
677676
678677 if (SpecRegRBit)
154154
155155 if (TheTriple.isOSWindows()) {
156156 llvm_unreachable("ARM does not support Windows COFF format");
157 return NULL;
158157 }
159158
160159 return createELFStreamer(Ctx, MAB, OS, Emitter, RelaxAll, NoExecStack);
8282
8383 if (TheTriple.isOSDarwin()) {
8484 llvm_unreachable("MBlaze does not support Darwin MACH-O format");
85 return NULL;
8685 }
8786
8887 if (TheTriple.isOSWindows()) {
8988 llvm_unreachable("MBlaze does not support Windows COFF format");
90 return NULL;
9189 }
9290
9391 return createELFStreamer(Ctx, MAB, _OS, _Emitter, RelaxAll, NoExecStack);
245245 case MipsSubtarget::N32: return "abiN32";
246246 case MipsSubtarget::N64: return "abi64";
247247 case MipsSubtarget::EABI: return "eabi32"; // TODO: handle eabi64
248 default: break;
249 }
250
251 llvm_unreachable("Unknown Mips ABI");
252 return NULL;
248 default: llvm_unreachable("Unknown Mips ABI");;
249 }
253250 }
254251
255252 void MipsAsmPrinter::EmitFunctionEntryLabel() {
7878 case PTXStateSpace::Parameter: return "param";
7979 case PTXStateSpace::Shared: return "shared";
8080 }
81 return NULL;
8281 }
8382
8483 static const char *getTypeName(Type* type) {
3030 : PTXGenRegisterInfo(0), TII(tii) {
3131 }
3232
33 void PTXRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
34 int SPAdj,
35 RegScavenger *RS) const {
36 unsigned Index;
37 MachineInstr &MI = *II;
38 //MachineBasicBlock &MBB = *MI.getParent();
39 //DebugLoc dl = MI.getDebugLoc();
40 //MachineRegisterInfo &MRI = MI.getParent()->getParent()->getRegInfo();
41
42 //unsigned Reg = MRI.createVirtualRegister(PTX::RegF32RegisterClass);
43
33 void PTXRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator /*II*/,
34 int /*SPAdj*/,
35 RegScavenger * /*RS*/) const {
4436 llvm_unreachable("FrameIndex should have been previously eliminated!");
45
46 Index = 0;
47 while (!MI.getOperand(Index).isFI()) {
48 ++Index;
49 assert(Index < MI.getNumOperands() &&
50 "Instr does not have a FrameIndex operand!");
51 }
52
53 int FrameIndex = MI.getOperand(Index).getIndex();
54
55 DEBUG(dbgs() << "eliminateFrameIndex: " << MI);
56 DEBUG(dbgs() << "- SPAdj: " << SPAdj << "\n");
57 DEBUG(dbgs() << "- FrameIndex: " << FrameIndex << "\n");
58
59 //MachineInstr* MI2 = BuildMI(MBB, II, dl, TII.get(PTX::LOAD_LOCAL_F32))
60 //.addReg(Reg, RegState::Define).addImm(FrameIndex);
61 //if (MI2->findFirstPredOperandIdx() == -1) {
62 // MI2->addOperand(MachineOperand::CreateReg(PTX::NoRegister, /*IsDef=*/false));
63 // MI2->addOperand(MachineOperand::CreateImm(PTX::PRED_NORMAL));
64 //}
65 //MI2->dump();
66
67 //MachineOperand ESOp = MachineOperand::CreateES("__local__");
68
69 // This frame index is post stack slot re-use assignments
70 //MI.getOperand(Index).ChangeToRegister(Reg, false);
71 MI.getOperand(Index).ChangeToImmediate(FrameIndex);
72 //MI.getOperand(Index) = ESOp;
7337 }
175175 MulLHS, MulRHS);
176176 // The high part is in the Y register.
177177 return CurDAG->SelectNodeTo(N, SP::RDY, MVT::i32, SDValue(Mul, 1));
178 return NULL;
179178 }
180179 }
181180
8181 decision = &THREEBYTEA7_SYM;
8282 break;
8383 }
84
84
8585 return decision->opcodeDecisions[insnContext].modRMDecisions[opcode].
8686 modrm_type != MODRM_ONEENTRY;
87
88 return 0;
8987 }
9088
9189 /*
919919 }
920920 return WideBO;
921921 }
922 llvm_unreachable(0);
923922 }
924923
925924 /// No-wrap operations can transfer sign extension of their result to their
25582558 assert(DestBits == SrcBits &&
25592559 "Casting vector to floating point of different width");
25602560 return BitCast; // same size, no-op cast
2561 } else {
2562 llvm_unreachable("Casting pointer or non-first class to float");
25632561 }
2562 llvm_unreachable("Casting pointer or non-first class to float");
25642563 } else if (DestTy->isVectorTy()) {
25652564 assert(DestBits == SrcBits &&
25662565 "Illegal cast to vector (wrong type or size)");
25702569 return BitCast; // ptr -> ptr
25712570 } else if (SrcTy->isIntegerTy()) {
25722571 return IntToPtr; // int -> ptr
2573 } else {
2574 llvm_unreachable("Casting pointer to other than pointer or int");
25752572 }
2573 llvm_unreachable("Casting pointer to other than pointer or int");
25762574 } else if (DestTy->isX86_MMXTy()) {
25772575 if (SrcTy->isVectorTy()) {
25782576 assert(DestBits == SrcBits && "Casting vector of wrong width to X86_MMX");
25792577 return BitCast; // 64-bit vector to MMX
2580 } else {
2581 llvm_unreachable("Illegal cast to X86_MMX");
25822578 }
2583 } else {
2584 llvm_unreachable("Casting to type that is not first-class");
2585 }
2586
2587 // If we fall through to here we probably hit an assertion cast above
2588 // and assertions are not turned on. Anything we return is an error, so
2589 // BitCast is as good a choice as any.
2590 return BitCast;
2579 llvm_unreachable("Illegal cast to X86_MMX");
2580 }
2581 llvm_unreachable("Casting to type that is not first-class");
25912582 }
25922583
25932584 //===----------------------------------------------------------------------===//
422422 PrintAndExit(ErrMsg, M);
423423
424424 return;
425 #endif
425 #else
426426
427427 // Output the script to start the program...
428428 std::string ErrorInfo;
468468 }
469469 Out2.os() << " " << BitcodeOutputFilename << " ${1+\"$@\"}\n";
470470 Out2.keep();
471 #endif
471472 }
472473
473474 // BuildLinkItems -- This function generates a LinkItemList for the LinkItems
210210 }
211211 }
212212
213 static std::string QuoteProgramPathIfNeeded(StringRef Command) {
214 if (Command.find_first_of(' ') == StringRef::npos)
215 return Command;
216 else {
217 std::string ret;
218 ret.reserve(Command.size() + 3);
219 ret.push_back('"');
220 ret.append(Command.begin(), Command.end());
221 ret.push_back('"');
222 return ret;
223 }
224 }
225
226213 /// @brief Find program using shell lookup rules.
227214 /// @param Program This is either an absolute path, relative path, or simple a
228215 /// program name. Look in PATH for any programs that match. If no
266253 // Make sure PathName is valid.
267254 PathName[MAX_PATH] = 0;
268255 return PathName;
269 }
270
271 static error_code EnableDebugPrivileges() {
272 HANDLE TokenHandle;
273 BOOL success = ::OpenProcessToken(::GetCurrentProcess(),
274 TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
275 &TokenHandle);
276 if (!success)
277 return windows_error(::GetLastError());
278
279 TokenScopedHandle Token(TokenHandle);
280 TOKEN_PRIVILEGES TokenPrivileges;
281 LUID LocallyUniqueID;
282
283 success = ::LookupPrivilegeValueA(NULL,
284 SE_DEBUG_NAME,
285 &LocallyUniqueID);
286 if (!success)
287 return windows_error(::GetLastError());
288
289 TokenPrivileges.PrivilegeCount = 1;
290 TokenPrivileges.Privileges[0].Luid = LocallyUniqueID;
291 TokenPrivileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
292
293 success = ::AdjustTokenPrivileges(Token,
294 FALSE,
295 &TokenPrivileges,
296 sizeof(TOKEN_PRIVILEGES),
297 NULL,
298 NULL);
299 // The value of success is basically useless. Either way we are just returning
300 // the value of ::GetLastError().
301 return windows_error(::GetLastError());
302256 }
303257
304258 static StringRef ExceptionCodeToString(DWORD ExceptionCode) {
139139 INSTRUCTION_CONTEXTS
140140 #undef ENUM_ENTRY
141141 }
142
143 return 0;
144142 }
145143
146144 /// stringForOperandType - Like stringForContext, but for OperandTypes.