Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: src/IceTargetLoweringMIPS32.cpp

Issue 1176133004: implement the null function for the Mips32 subzero compiler (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fixing patch per review comments Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 //===- subzero/src/IceTargetLoweringMIPS32.cpp - MIPS32 lowering ----------===// 1 //===- subzero/src/IceTargetLoweringMIPS32.cpp - MIPS32 lowering ----------===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 13 matching lines...) Expand all
24 #include "IceInstMIPS32.h" 24 #include "IceInstMIPS32.h"
25 #include "IceLiveness.h" 25 #include "IceLiveness.h"
26 #include "IceOperand.h" 26 #include "IceOperand.h"
27 #include "IceRegistersMIPS32.h" 27 #include "IceRegistersMIPS32.h"
28 #include "IceTargetLoweringMIPS32.def" 28 #include "IceTargetLoweringMIPS32.def"
29 #include "IceUtils.h" 29 #include "IceUtils.h"
30 #include "llvm/Support/MathExtras.h" 30 #include "llvm/Support/MathExtras.h"
31 31
32 namespace Ice { 32 namespace Ice {
33 33
34 namespace {
35 void UnimplementedError(const ClFlags &Flags) {
36 if (!Flags.getSkipUnimplemented()) {
37 // Use llvm_unreachable instead of report_fatal_error, which gives better
38 // stack traces.
39 llvm_unreachable("Not yet implemented");
40 abort();
41 }
42 }
43 } // end of anonymous namespace
44
34 TargetMIPS32::TargetMIPS32(Cfg *Func) : TargetLowering(Func) { 45 TargetMIPS32::TargetMIPS32(Cfg *Func) : TargetLowering(Func) {
35 // TODO: Don't initialize IntegerRegisters and friends every time. 46 // TODO: Don't initialize IntegerRegisters and friends every time.
36 // Instead, initialize in some sort of static initializer for the 47 // Instead, initialize in some sort of static initializer for the
37 // class. 48 // class.
38 llvm::SmallBitVector IntegerRegisters(RegMIPS32::Reg_NUM); 49 llvm::SmallBitVector IntegerRegisters(RegMIPS32::Reg_NUM);
39 llvm::SmallBitVector FloatRegisters(RegMIPS32::Reg_NUM); 50 llvm::SmallBitVector FloatRegisters(RegMIPS32::Reg_NUM);
40 llvm::SmallBitVector VectorRegisters(RegMIPS32::Reg_NUM); 51 llvm::SmallBitVector VectorRegisters(RegMIPS32::Reg_NUM);
41 llvm::SmallBitVector InvalidRegisters(RegMIPS32::Reg_NUM); 52 llvm::SmallBitVector InvalidRegisters(RegMIPS32::Reg_NUM);
42 ScratchRegs.resize(RegMIPS32::Reg_NUM); 53 ScratchRegs.resize(RegMIPS32::Reg_NUM);
43 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \ 54 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 209
199 // Nop insertion 210 // Nop insertion
200 if (Ctx->getFlags().shouldDoNopInsertion()) { 211 if (Ctx->getFlags().shouldDoNopInsertion()) {
201 Func->doNopInsertion(); 212 Func->doNopInsertion();
202 } 213 }
203 } 214 }
204 215
205 bool TargetMIPS32::doBranchOpt(Inst *I, const CfgNode *NextNode) { 216 bool TargetMIPS32::doBranchOpt(Inst *I, const CfgNode *NextNode) {
206 (void)I; 217 (void)I;
207 (void)NextNode; 218 (void)NextNode;
208 llvm::report_fatal_error("Not yet implemented"); 219 UnimplementedError(Func->getContext()->getFlags());
220 return false;
209 } 221 }
210 222
211 IceString TargetMIPS32::RegNames[] = { 223 IceString TargetMIPS32::RegNames[] = {
212 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \ 224 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \
213 isFP) \ 225 isFP) \
214 name, 226 name,
215 REGMIPS32_TABLE 227 REGMIPS32_TABLE
216 #undef X 228 #undef X
217 }; 229 };
218 230
(...skipping 21 matching lines...) Expand all
240 Reg->setIgnoreLiveness(); 252 Reg->setIgnoreLiveness();
241 } 253 }
242 } 254 }
243 return Reg; 255 return Reg;
244 } 256 }
245 257
246 void TargetMIPS32::emitVariable(const Variable *Var) const { 258 void TargetMIPS32::emitVariable(const Variable *Var) const {
247 Ostream &Str = Ctx->getStrEmit(); 259 Ostream &Str = Ctx->getStrEmit();
248 (void)Var; 260 (void)Var;
249 (void)Str; 261 (void)Str;
250 llvm::report_fatal_error("emitVariable: Not yet implemented"); 262 UnimplementedError(Func->getContext()->getFlags());
251 } 263 }
252 264
253 void TargetMIPS32::lowerArguments() { 265 void TargetMIPS32::lowerArguments() {
254 llvm::report_fatal_error("lowerArguments: Not yet implemented"); 266 VarList &Args = Func->getArgs();
267 if (Args.size() > 0)
268 UnimplementedError(Func->getContext()->getFlags());
255 } 269 }
256 270
257 Type TargetMIPS32::stackSlotType() { return IceType_i32; } 271 Type TargetMIPS32::stackSlotType() { return IceType_i32; }
258 272
259 void TargetMIPS32::addProlog(CfgNode *Node) { 273 void TargetMIPS32::addProlog(CfgNode *Node) {
260 (void)Node; 274 (void)Node;
261 llvm::report_fatal_error("addProlog: Not yet implemented"); 275 UnimplementedError(Func->getContext()->getFlags());
262 } 276 }
263 277
264 void TargetMIPS32::addEpilog(CfgNode *Node) { 278 void TargetMIPS32::addEpilog(CfgNode *Node) {
265 (void)Node; 279 (void)Node;
266 llvm::report_fatal_error("addEpilog: Not yet implemented"); 280 UnimplementedError(Func->getContext()->getFlags());
267 } 281 }
268 282
269 llvm::SmallBitVector TargetMIPS32::getRegisterSet(RegSetMask Include, 283 llvm::SmallBitVector TargetMIPS32::getRegisterSet(RegSetMask Include,
270 RegSetMask Exclude) const { 284 RegSetMask Exclude) const {
271 llvm::SmallBitVector Registers(RegMIPS32::Reg_NUM); 285 llvm::SmallBitVector Registers(RegMIPS32::Reg_NUM);
272 286
273 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \ 287 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \
274 isFP) \ 288 isFP) \
275 if (scratch && (Include & RegSet_CallerSave)) \ 289 if (scratch && (Include & RegSet_CallerSave)) \
276 Registers[RegMIPS32::val] = true; \ 290 Registers[RegMIPS32::val] = true; \
(...skipping 21 matching lines...) Expand all
298 312
299 void TargetMIPS32::lowerAlloca(const InstAlloca *Inst) { 313 void TargetMIPS32::lowerAlloca(const InstAlloca *Inst) {
300 UsesFramePointer = true; 314 UsesFramePointer = true;
301 // Conservatively require the stack to be aligned. Some stack 315 // Conservatively require the stack to be aligned. Some stack
302 // adjustment operations implemented below assume that the stack is 316 // adjustment operations implemented below assume that the stack is
303 // aligned before the alloca. All the alloca code ensures that the 317 // aligned before the alloca. All the alloca code ensures that the
304 // stack alignment is preserved after the alloca. The stack alignment 318 // stack alignment is preserved after the alloca. The stack alignment
305 // restriction can be relaxed in some cases. 319 // restriction can be relaxed in some cases.
306 NeedsStackAlignment = true; 320 NeedsStackAlignment = true;
307 (void)Inst; 321 (void)Inst;
308 llvm::report_fatal_error("Not yet implemented"); 322 UnimplementedError(Func->getContext()->getFlags());
309 } 323 }
310 324
311 void TargetMIPS32::lowerArithmetic(const InstArithmetic *Inst) { 325 void TargetMIPS32::lowerArithmetic(const InstArithmetic *Inst) {
312 switch (Inst->getOp()) { 326 switch (Inst->getOp()) {
313 case InstArithmetic::_num: 327 case InstArithmetic::_num:
314 llvm_unreachable("Unknown arithmetic operator"); 328 UnimplementedError(Func->getContext()->getFlags());
315 break; 329 break;
316 case InstArithmetic::Add: 330 case InstArithmetic::Add:
317 llvm::report_fatal_error("Not yet implemented"); 331 UnimplementedError(Func->getContext()->getFlags());
318 break; 332 break;
319 case InstArithmetic::And: 333 case InstArithmetic::And:
320 llvm::report_fatal_error("Not yet implemented"); 334 UnimplementedError(Func->getContext()->getFlags());
321 break; 335 break;
322 case InstArithmetic::Or: 336 case InstArithmetic::Or:
323 llvm::report_fatal_error("Not yet implemented"); 337 UnimplementedError(Func->getContext()->getFlags());
324 break; 338 break;
325 case InstArithmetic::Xor: 339 case InstArithmetic::Xor:
326 llvm::report_fatal_error("Not yet implemented"); 340 UnimplementedError(Func->getContext()->getFlags());
327 break; 341 break;
328 case InstArithmetic::Sub: 342 case InstArithmetic::Sub:
329 llvm::report_fatal_error("Not yet implemented"); 343 UnimplementedError(Func->getContext()->getFlags());
330 break; 344 break;
331 case InstArithmetic::Mul: 345 case InstArithmetic::Mul:
332 llvm::report_fatal_error("Not yet implemented"); 346 UnimplementedError(Func->getContext()->getFlags());
333 break; 347 break;
334 case InstArithmetic::Shl: 348 case InstArithmetic::Shl:
335 llvm::report_fatal_error("Not yet implemented"); 349 UnimplementedError(Func->getContext()->getFlags());
336 break; 350 break;
337 case InstArithmetic::Lshr: 351 case InstArithmetic::Lshr:
338 llvm::report_fatal_error("Not yet implemented"); 352 UnimplementedError(Func->getContext()->getFlags());
339 break; 353 break;
340 case InstArithmetic::Ashr: 354 case InstArithmetic::Ashr:
341 llvm::report_fatal_error("Not yet implemented"); 355 UnimplementedError(Func->getContext()->getFlags());
342 break; 356 break;
343 case InstArithmetic::Udiv: 357 case InstArithmetic::Udiv:
344 llvm::report_fatal_error("Not yet implemented"); 358 UnimplementedError(Func->getContext()->getFlags());
345 break; 359 break;
346 case InstArithmetic::Sdiv: 360 case InstArithmetic::Sdiv:
347 llvm::report_fatal_error("Not yet implemented"); 361 UnimplementedError(Func->getContext()->getFlags());
348 break; 362 break;
349 case InstArithmetic::Urem: 363 case InstArithmetic::Urem:
350 llvm::report_fatal_error("Not yet implemented"); 364 UnimplementedError(Func->getContext()->getFlags());
351 break; 365 break;
352 case InstArithmetic::Srem: 366 case InstArithmetic::Srem:
353 llvm::report_fatal_error("Not yet implemented"); 367 UnimplementedError(Func->getContext()->getFlags());
354 break; 368 break;
355 case InstArithmetic::Fadd: 369 case InstArithmetic::Fadd:
356 llvm::report_fatal_error("Not yet implemented"); 370 UnimplementedError(Func->getContext()->getFlags());
357 break; 371 break;
358 case InstArithmetic::Fsub: 372 case InstArithmetic::Fsub:
359 llvm::report_fatal_error("Not yet implemented"); 373 UnimplementedError(Func->getContext()->getFlags());
360 break; 374 break;
361 case InstArithmetic::Fmul: 375 case InstArithmetic::Fmul:
362 llvm::report_fatal_error("Not yet implemented"); 376 UnimplementedError(Func->getContext()->getFlags());
363 break; 377 break;
364 case InstArithmetic::Fdiv: 378 case InstArithmetic::Fdiv:
365 llvm::report_fatal_error("Not yet implemented"); 379 UnimplementedError(Func->getContext()->getFlags());
366 break; 380 break;
367 case InstArithmetic::Frem: 381 case InstArithmetic::Frem:
368 llvm::report_fatal_error("Not yet implemented"); 382 UnimplementedError(Func->getContext()->getFlags());
369 break; 383 break;
370 } 384 }
371 } 385 }
372 386
373 void TargetMIPS32::lowerAssign(const InstAssign *Inst) { 387 void TargetMIPS32::lowerAssign(const InstAssign *Inst) {
374 (void)Inst; 388 (void)Inst;
375 llvm::report_fatal_error("Not yet implemented"); 389 UnimplementedError(Func->getContext()->getFlags());
376 } 390 }
377 391
378 void TargetMIPS32::lowerBr(const InstBr *Inst) { 392 void TargetMIPS32::lowerBr(const InstBr *Inst) {
379 (void)Inst; 393 (void)Inst;
380 llvm::report_fatal_error("Not yet implemented"); 394 UnimplementedError(Func->getContext()->getFlags());
381 } 395 }
382 396
383 void TargetMIPS32::lowerCall(const InstCall *Inst) { 397 void TargetMIPS32::lowerCall(const InstCall *Inst) {
384 (void)Inst; 398 (void)Inst;
385 llvm::report_fatal_error("Not yet implemented"); 399 UnimplementedError(Func->getContext()->getFlags());
386 } 400 }
387 401
388 void TargetMIPS32::lowerCast(const InstCast *Inst) { 402 void TargetMIPS32::lowerCast(const InstCast *Inst) {
389 InstCast::OpKind CastKind = Inst->getCastKind(); 403 InstCast::OpKind CastKind = Inst->getCastKind();
390 switch (CastKind) { 404 switch (CastKind) {
391 default: 405 default:
392 Func->setError("Cast type not supported"); 406 Func->setError("Cast type not supported");
393 return; 407 return;
394 case InstCast::Sext: { 408 case InstCast::Sext: {
395 llvm::report_fatal_error("Not yet implemented"); 409 UnimplementedError(Func->getContext()->getFlags());
396 break; 410 break;
397 } 411 }
398 case InstCast::Zext: { 412 case InstCast::Zext: {
399 llvm::report_fatal_error("Not yet implemented"); 413 UnimplementedError(Func->getContext()->getFlags());
400 break; 414 break;
401 } 415 }
402 case InstCast::Trunc: { 416 case InstCast::Trunc: {
403 llvm::report_fatal_error("Not yet implemented"); 417 UnimplementedError(Func->getContext()->getFlags());
404 break; 418 break;
405 } 419 }
406 case InstCast::Fptrunc: 420 case InstCast::Fptrunc:
407 llvm::report_fatal_error("Not yet implemented"); 421 UnimplementedError(Func->getContext()->getFlags());
408 break; 422 break;
409 case InstCast::Fpext: { 423 case InstCast::Fpext: {
410 llvm::report_fatal_error("Not yet implemented"); 424 UnimplementedError(Func->getContext()->getFlags());
411 break; 425 break;
412 } 426 }
413 case InstCast::Fptosi: 427 case InstCast::Fptosi:
414 llvm::report_fatal_error("Not yet implemented"); 428 UnimplementedError(Func->getContext()->getFlags());
415 break; 429 break;
416 case InstCast::Fptoui: 430 case InstCast::Fptoui:
417 llvm::report_fatal_error("Not yet implemented"); 431 UnimplementedError(Func->getContext()->getFlags());
418 break; 432 break;
419 case InstCast::Sitofp: 433 case InstCast::Sitofp:
420 llvm::report_fatal_error("Not yet implemented"); 434 UnimplementedError(Func->getContext()->getFlags());
421 break; 435 break;
422 case InstCast::Uitofp: { 436 case InstCast::Uitofp: {
423 llvm::report_fatal_error("Not yet implemented"); 437 UnimplementedError(Func->getContext()->getFlags());
424 break; 438 break;
425 } 439 }
426 case InstCast::Bitcast: { 440 case InstCast::Bitcast: {
427 llvm::report_fatal_error("Not yet implemented"); 441 UnimplementedError(Func->getContext()->getFlags());
428 break; 442 break;
429 } 443 }
430 } 444 }
431 } 445 }
432 446
433 void TargetMIPS32::lowerExtractElement(const InstExtractElement *Inst) { 447 void TargetMIPS32::lowerExtractElement(const InstExtractElement *Inst) {
434 (void)Inst; 448 (void)Inst;
435 llvm::report_fatal_error("Not yet implemented"); 449 UnimplementedError(Func->getContext()->getFlags());
436 } 450 }
437 451
438 void TargetMIPS32::lowerFcmp(const InstFcmp *Inst) { 452 void TargetMIPS32::lowerFcmp(const InstFcmp *Inst) {
439 (void)Inst; 453 (void)Inst;
440 llvm::report_fatal_error("Not yet implemented"); 454 UnimplementedError(Func->getContext()->getFlags());
441 } 455 }
442 456
443 void TargetMIPS32::lowerIcmp(const InstIcmp *Inst) { 457 void TargetMIPS32::lowerIcmp(const InstIcmp *Inst) {
444 (void)Inst; 458 (void)Inst;
445 llvm::report_fatal_error("Not yet implemented"); 459 UnimplementedError(Func->getContext()->getFlags());
446 } 460 }
447 461
448 void TargetMIPS32::lowerInsertElement(const InstInsertElement *Inst) { 462 void TargetMIPS32::lowerInsertElement(const InstInsertElement *Inst) {
449 (void)Inst; 463 (void)Inst;
450 llvm::report_fatal_error("Not yet implemented"); 464 UnimplementedError(Func->getContext()->getFlags());
451 } 465 }
452 466
453 void TargetMIPS32::lowerIntrinsicCall(const InstIntrinsicCall *Instr) { 467 void TargetMIPS32::lowerIntrinsicCall(const InstIntrinsicCall *Instr) {
454 switch (Intrinsics::IntrinsicID ID = Instr->getIntrinsicInfo().ID) { 468 switch (Intrinsics::IntrinsicID ID = Instr->getIntrinsicInfo().ID) {
455 case Intrinsics::AtomicCmpxchg: { 469 case Intrinsics::AtomicCmpxchg: {
456 llvm::report_fatal_error("Not yet implemented"); 470 UnimplementedError(Func->getContext()->getFlags());
457 return; 471 return;
458 } 472 }
459 case Intrinsics::AtomicFence: 473 case Intrinsics::AtomicFence:
460 llvm::report_fatal_error("Not yet implemented"); 474 UnimplementedError(Func->getContext()->getFlags());
461 return; 475 return;
462 case Intrinsics::AtomicFenceAll: 476 case Intrinsics::AtomicFenceAll:
463 // NOTE: FenceAll should prevent and load/store from being moved 477 // NOTE: FenceAll should prevent and load/store from being moved
464 // across the fence (both atomic and non-atomic). The InstMIPS32Mfence 478 // across the fence (both atomic and non-atomic). The InstMIPS32Mfence
465 // instruction is currently marked coarsely as "HasSideEffects". 479 // instruction is currently marked coarsely as "HasSideEffects".
466 llvm::report_fatal_error("Not yet implemented"); 480 UnimplementedError(Func->getContext()->getFlags());
467 return; 481 return;
468 case Intrinsics::AtomicIsLockFree: { 482 case Intrinsics::AtomicIsLockFree: {
469 llvm::report_fatal_error("Not yet implemented"); 483 UnimplementedError(Func->getContext()->getFlags());
470 return; 484 return;
471 } 485 }
472 case Intrinsics::AtomicLoad: { 486 case Intrinsics::AtomicLoad: {
473 llvm::report_fatal_error("Not yet implemented"); 487 UnimplementedError(Func->getContext()->getFlags());
474 return; 488 return;
475 } 489 }
476 case Intrinsics::AtomicRMW: 490 case Intrinsics::AtomicRMW:
477 llvm::report_fatal_error("Not yet implemented"); 491 UnimplementedError(Func->getContext()->getFlags());
478 return; 492 return;
479 case Intrinsics::AtomicStore: { 493 case Intrinsics::AtomicStore: {
480 llvm::report_fatal_error("Not yet implemented"); 494 UnimplementedError(Func->getContext()->getFlags());
481 return; 495 return;
482 } 496 }
483 case Intrinsics::Bswap: { 497 case Intrinsics::Bswap: {
484 llvm::report_fatal_error("Not yet implemented"); 498 UnimplementedError(Func->getContext()->getFlags());
485 return; 499 return;
486 } 500 }
487 case Intrinsics::Ctpop: { 501 case Intrinsics::Ctpop: {
488 llvm::report_fatal_error("Not yet implemented"); 502 UnimplementedError(Func->getContext()->getFlags());
489 return; 503 return;
490 } 504 }
491 case Intrinsics::Ctlz: { 505 case Intrinsics::Ctlz: {
492 llvm::report_fatal_error("Not yet implemented"); 506 UnimplementedError(Func->getContext()->getFlags());
493 return; 507 return;
494 } 508 }
495 case Intrinsics::Cttz: { 509 case Intrinsics::Cttz: {
496 llvm::report_fatal_error("Not yet implemented"); 510 UnimplementedError(Func->getContext()->getFlags());
497 return; 511 return;
498 } 512 }
499 case Intrinsics::Fabs: { 513 case Intrinsics::Fabs: {
500 llvm::report_fatal_error("Not yet implemented"); 514 UnimplementedError(Func->getContext()->getFlags());
501 return; 515 return;
502 } 516 }
503 case Intrinsics::Longjmp: { 517 case Intrinsics::Longjmp: {
504 InstCall *Call = makeHelperCall(H_call_longjmp, nullptr, 2); 518 InstCall *Call = makeHelperCall(H_call_longjmp, nullptr, 2);
505 Call->addArg(Instr->getArg(0)); 519 Call->addArg(Instr->getArg(0));
506 Call->addArg(Instr->getArg(1)); 520 Call->addArg(Instr->getArg(1));
507 lowerCall(Call); 521 lowerCall(Call);
508 return; 522 return;
509 } 523 }
510 case Intrinsics::Memcpy: { 524 case Intrinsics::Memcpy: {
(...skipping 24 matching lines...) Expand all
535 lowerCast(InstCast::create(Func, InstCast::Zext, ValExt, ValOp)); 549 lowerCast(InstCast::create(Func, InstCast::Zext, ValExt, ValOp));
536 InstCall *Call = makeHelperCall(H_call_memset, nullptr, 3); 550 InstCall *Call = makeHelperCall(H_call_memset, nullptr, 3);
537 Call->addArg(Instr->getArg(0)); 551 Call->addArg(Instr->getArg(0));
538 Call->addArg(ValExt); 552 Call->addArg(ValExt);
539 Call->addArg(Instr->getArg(2)); 553 Call->addArg(Instr->getArg(2));
540 lowerCall(Call); 554 lowerCall(Call);
541 return; 555 return;
542 } 556 }
543 case Intrinsics::NaClReadTP: { 557 case Intrinsics::NaClReadTP: {
544 if (Ctx->getFlags().getUseSandboxing()) { 558 if (Ctx->getFlags().getUseSandboxing()) {
545 llvm::report_fatal_error("Not yet implemented"); 559 UnimplementedError(Func->getContext()->getFlags());
546 } else { 560 } else {
547 InstCall *Call = makeHelperCall(H_call_read_tp, Instr->getDest(), 0); 561 InstCall *Call = makeHelperCall(H_call_read_tp, Instr->getDest(), 0);
548 lowerCall(Call); 562 lowerCall(Call);
549 } 563 }
550 return; 564 return;
551 } 565 }
552 case Intrinsics::Setjmp: { 566 case Intrinsics::Setjmp: {
553 InstCall *Call = makeHelperCall(H_call_setjmp, Instr->getDest(), 1); 567 InstCall *Call = makeHelperCall(H_call_setjmp, Instr->getDest(), 1);
554 Call->addArg(Instr->getArg(0)); 568 Call->addArg(Instr->getArg(0));
555 lowerCall(Call); 569 lowerCall(Call);
556 return; 570 return;
557 } 571 }
558 case Intrinsics::Sqrt: { 572 case Intrinsics::Sqrt: {
559 llvm::report_fatal_error("Not yet implemented"); 573 UnimplementedError(Func->getContext()->getFlags());
560 return; 574 return;
561 } 575 }
562 case Intrinsics::Stacksave: { 576 case Intrinsics::Stacksave: {
563 llvm::report_fatal_error("Not yet implemented"); 577 UnimplementedError(Func->getContext()->getFlags());
564 return; 578 return;
565 } 579 }
566 case Intrinsics::Stackrestore: { 580 case Intrinsics::Stackrestore: {
567 llvm::report_fatal_error("Not yet implemented"); 581 UnimplementedError(Func->getContext()->getFlags());
568 return; 582 return;
569 } 583 }
570 case Intrinsics::Trap: 584 case Intrinsics::Trap:
571 llvm::report_fatal_error("Not yet implemented"); 585 UnimplementedError(Func->getContext()->getFlags());
572 return; 586 return;
573 case Intrinsics::UnknownIntrinsic: 587 case Intrinsics::UnknownIntrinsic:
574 Func->setError("Should not be lowering UnknownIntrinsic"); 588 Func->setError("Should not be lowering UnknownIntrinsic");
575 return; 589 return;
576 } 590 }
577 return; 591 return;
578 } 592 }
579 593
580 void TargetMIPS32::lowerLoad(const InstLoad *Inst) { 594 void TargetMIPS32::lowerLoad(const InstLoad *Inst) {
581 (void)Inst; 595 (void)Inst;
582 llvm::report_fatal_error("Not yet implemented"); 596 UnimplementedError(Func->getContext()->getFlags());
583 } 597 }
584 598
585 void TargetMIPS32::doAddressOptLoad() { 599 void TargetMIPS32::doAddressOptLoad() {
586 llvm::report_fatal_error("Not yet implemented"); 600 UnimplementedError(Func->getContext()->getFlags());
587 } 601 }
588 602
589 void TargetMIPS32::randomlyInsertNop(float Probability) { 603 void TargetMIPS32::randomlyInsertNop(float Probability) {
590 RandomNumberGeneratorWrapper RNG(Ctx->getRNG()); 604 RandomNumberGeneratorWrapper RNG(Ctx->getRNG());
591 if (RNG.getTrueWithProbability(Probability)) { 605 if (RNG.getTrueWithProbability(Probability)) {
592 llvm::report_fatal_error("Not yet implemented"); 606 UnimplementedError(Func->getContext()->getFlags());
593 } 607 }
594 } 608 }
595 609
596 void TargetMIPS32::lowerPhi(const InstPhi * /*Inst*/) { 610 void TargetMIPS32::lowerPhi(const InstPhi * /*Inst*/) {
597 Func->setError("Phi found in regular instruction list"); 611 Func->setError("Phi found in regular instruction list");
598 } 612 }
599 613
600 void TargetMIPS32::lowerRet(const InstRet *Inst) { 614 void TargetMIPS32::lowerRet(const InstRet *Inst) {
601 (void)Inst; 615 Variable *Reg = nullptr;
602 llvm::report_fatal_error("Not yet implemented"); 616 if (Inst->hasRetValue())
617 UnimplementedError(Func->getContext()->getFlags());
618 _ret(getPhysicalRegister(RegMIPS32::Reg_RA), Reg);
603 } 619 }
604 620
605 void TargetMIPS32::lowerSelect(const InstSelect *Inst) { 621 void TargetMIPS32::lowerSelect(const InstSelect *Inst) {
606 (void)Inst; 622 (void)Inst;
607 llvm::report_fatal_error("Not yet implemented"); 623 UnimplementedError(Func->getContext()->getFlags());
608 } 624 }
609 625
610 void TargetMIPS32::lowerStore(const InstStore *Inst) { 626 void TargetMIPS32::lowerStore(const InstStore *Inst) {
611 (void)Inst; 627 (void)Inst;
612 llvm::report_fatal_error("Not yet implemented"); 628 UnimplementedError(Func->getContext()->getFlags());
613 } 629 }
614 630
615 void TargetMIPS32::doAddressOptStore() { 631 void TargetMIPS32::doAddressOptStore() {
616 llvm::report_fatal_error("Not yet implemented"); 632 UnimplementedError(Func->getContext()->getFlags());
617 } 633 }
618 634
619 void TargetMIPS32::lowerSwitch(const InstSwitch *Inst) { 635 void TargetMIPS32::lowerSwitch(const InstSwitch *Inst) {
620 (void)Inst; 636 (void)Inst;
621 llvm::report_fatal_error("Not yet implemented"); 637 UnimplementedError(Func->getContext()->getFlags());
622 } 638 }
623 639
624 void TargetMIPS32::lowerUnreachable(const InstUnreachable * /*Inst*/) { 640 void TargetMIPS32::lowerUnreachable(const InstUnreachable * /*Inst*/) {
625 llvm_unreachable("Not yet implemented"); 641 UnimplementedError(Func->getContext()->getFlags());
626 } 642 }
627 643
628 // Turn an i64 Phi instruction into a pair of i32 Phi instructions, to 644 // Turn an i64 Phi instruction into a pair of i32 Phi instructions, to
629 // preserve integrity of liveness analysis. Undef values are also 645 // preserve integrity of liveness analysis. Undef values are also
630 // turned into zeroes, since loOperand() and hiOperand() don't expect 646 // turned into zeroes, since loOperand() and hiOperand() don't expect
631 // Undef input. 647 // Undef input.
632 void TargetMIPS32::prelowerPhis() { 648 void TargetMIPS32::prelowerPhis() {
633 llvm::report_fatal_error("Not yet implemented"); 649 UnimplementedError(Func->getContext()->getFlags());
634 } 650 }
635 651
636 // Lower the pre-ordered list of assignments into mov instructions. 652 // Lower the pre-ordered list of assignments into mov instructions.
637 // Also has to do some ad-hoc register allocation as necessary. 653 // Also has to do some ad-hoc register allocation as necessary.
638 void TargetMIPS32::lowerPhiAssignments(CfgNode *Node, 654 void TargetMIPS32::lowerPhiAssignments(CfgNode *Node,
639 const AssignList &Assignments) { 655 const AssignList &Assignments) {
640 (void)Node; 656 (void)Node;
641 (void)Assignments; 657 (void)Assignments;
642 llvm::report_fatal_error("Not yet implemented"); 658 UnimplementedError(Func->getContext()->getFlags());
643 } 659 }
644 660
645 void TargetMIPS32::postLower() { 661 void TargetMIPS32::postLower() {
646 if (Ctx->getFlags().getOptLevel() == Opt_m1) 662 if (Ctx->getFlags().getOptLevel() == Opt_m1)
647 return; 663 return;
648 // Find two-address non-SSA instructions where Dest==Src0, and set 664 // Find two-address non-SSA instructions where Dest==Src0, and set
649 // the DestNonKillable flag to keep liveness analysis consistent. 665 // the DestNonKillable flag to keep liveness analysis consistent.
650 llvm::report_fatal_error("Not yet implemented"); 666 UnimplementedError(Func->getContext()->getFlags());
651 } 667 }
652 668
653 void TargetMIPS32::makeRandomRegisterPermutation( 669 void TargetMIPS32::makeRandomRegisterPermutation(
654 llvm::SmallVectorImpl<int32_t> &Permutation, 670 llvm::SmallVectorImpl<int32_t> &Permutation,
655 const llvm::SmallBitVector &ExcludeRegisters) const { 671 const llvm::SmallBitVector &ExcludeRegisters) const {
656 (void)Permutation; 672 (void)Permutation;
657 (void)ExcludeRegisters; 673 (void)ExcludeRegisters;
658 llvm::report_fatal_error("Not yet implemented"); 674 UnimplementedError(Func->getContext()->getFlags());
659 } 675 }
660 676
661 /* TODO(jvoung): avoid duplicate symbols with multiple targets. 677 /* TODO(jvoung): avoid duplicate symbols with multiple targets.
662 void ConstantUndef::emitWithoutDollar(GlobalContext *) const { 678 void ConstantUndef::emitWithoutDollar(GlobalContext *) const {
663 llvm_unreachable("Not expecting to emitWithoutDollar undef"); 679 llvm_unreachable("Not expecting to emitWithoutDollar undef");
664 } 680 }
665 681
666 void ConstantUndef::emit(GlobalContext *) const { 682 void ConstantUndef::emit(GlobalContext *) const {
667 llvm_unreachable("undef value encountered by emitter."); 683 llvm_unreachable("undef value encountered by emitter.");
668 } 684 }
(...skipping 18 matching lines...) Expand all
687 emitGlobal(*Var, SectionSuffix); 703 emitGlobal(*Var, SectionSuffix);
688 } 704 }
689 } 705 }
690 } break; 706 } break;
691 } 707 }
692 } 708 }
693 709
694 void TargetDataMIPS32::lowerConstants() { 710 void TargetDataMIPS32::lowerConstants() {
695 if (Ctx->getFlags().getDisableTranslation()) 711 if (Ctx->getFlags().getDisableTranslation())
696 return; 712 return;
697 llvm::report_fatal_error("Not yet implemented"); 713 UnimplementedError(Ctx->getFlags());
698 } 714 }
699 715
700 TargetHeaderMIPS32::TargetHeaderMIPS32(GlobalContext *Ctx) 716 TargetHeaderMIPS32::TargetHeaderMIPS32(GlobalContext *Ctx)
701 : TargetHeaderLowering(Ctx) {} 717 : TargetHeaderLowering(Ctx) {}
702 718
703 } // end of namespace Ice 719 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698