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

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: Run clang format Created 5 years, 6 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 // This file implements the TargetLoweringMIPS32 class, which consists almost 10 // This file implements the TargetLoweringMIPS32 class, which consists almost
(...skipping 12 matching lines...) Expand all
23 #include "IceInstMIPS32.h" 23 #include "IceInstMIPS32.h"
24 #include "IceLiveness.h" 24 #include "IceLiveness.h"
25 #include "IceOperand.h" 25 #include "IceOperand.h"
26 #include "IceRegistersMIPS32.h" 26 #include "IceRegistersMIPS32.h"
27 #include "IceTargetLoweringMIPS32.def" 27 #include "IceTargetLoweringMIPS32.def"
28 #include "IceTargetLoweringMIPS32.h" 28 #include "IceTargetLoweringMIPS32.h"
29 #include "IceUtils.h" 29 #include "IceUtils.h"
30 30
31 namespace Ice { 31 namespace Ice {
32 32
33 namespace {
34 void UnimplementedError(const ClFlags &Flags) {
35 if (!Flags.getSkipUnimplemented()) {
36 // Use llvm_unreachable instead of report_fatal_error, which gives better
37 // stack traces.
38 llvm_unreachable("Not yet implemented");
39 abort();
40 }
41 }
42 } // end of anonymous namespace
43
33 TargetMIPS32::TargetMIPS32(Cfg *Func) 44 TargetMIPS32::TargetMIPS32(Cfg *Func)
34 : TargetLowering(Func), UsesFramePointer(false) { 45 : TargetLowering(Func), UsesFramePointer(false) {
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);
(...skipping 155 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());
359 ;
Jim Stichnoth 2015/06/12 18:03:14 stray ;
345 break; 360 break;
346 case InstArithmetic::Sdiv: 361 case InstArithmetic::Sdiv:
347 llvm::report_fatal_error("Not yet implemented"); 362 UnimplementedError(Func->getContext()->getFlags());
348 break; 363 break;
349 case InstArithmetic::Urem: 364 case InstArithmetic::Urem:
350 llvm::report_fatal_error("Not yet implemented"); 365 UnimplementedError(Func->getContext()->getFlags());
351 break; 366 break;
352 case InstArithmetic::Srem: 367 case InstArithmetic::Srem:
353 llvm::report_fatal_error("Not yet implemented"); 368 UnimplementedError(Func->getContext()->getFlags());
354 break; 369 break;
355 case InstArithmetic::Fadd: 370 case InstArithmetic::Fadd:
356 llvm::report_fatal_error("Not yet implemented"); 371 UnimplementedError(Func->getContext()->getFlags());
357 break; 372 break;
358 case InstArithmetic::Fsub: 373 case InstArithmetic::Fsub:
359 llvm::report_fatal_error("Not yet implemented"); 374 UnimplementedError(Func->getContext()->getFlags());
360 break; 375 break;
361 case InstArithmetic::Fmul: 376 case InstArithmetic::Fmul:
362 llvm::report_fatal_error("Not yet implemented"); 377 UnimplementedError(Func->getContext()->getFlags());
363 break; 378 break;
364 case InstArithmetic::Fdiv: 379 case InstArithmetic::Fdiv:
365 llvm::report_fatal_error("Not yet implemented"); 380 UnimplementedError(Func->getContext()->getFlags());
366 break; 381 break;
367 case InstArithmetic::Frem: 382 case InstArithmetic::Frem:
368 llvm::report_fatal_error("Not yet implemented"); 383 UnimplementedError(Func->getContext()->getFlags());
369 break; 384 break;
370 } 385 }
371 } 386 }
372 387
373 void TargetMIPS32::lowerAssign(const InstAssign *Inst) { 388 void TargetMIPS32::lowerAssign(const InstAssign *Inst) {
374 (void)Inst; 389 (void)Inst;
375 llvm::report_fatal_error("Not yet implemented"); 390 UnimplementedError(Func->getContext()->getFlags());
391 ;
Jim Stichnoth 2015/06/12 18:03:14 stray ;
376 } 392 }
377 393
378 void TargetMIPS32::lowerBr(const InstBr *Inst) { 394 void TargetMIPS32::lowerBr(const InstBr *Inst) {
379 (void)Inst; 395 (void)Inst;
380 llvm::report_fatal_error("Not yet implemented"); 396 UnimplementedError(Func->getContext()->getFlags());
381 } 397 }
382 398
383 void TargetMIPS32::lowerCall(const InstCall *Inst) { 399 void TargetMIPS32::lowerCall(const InstCall *Inst) {
384 (void)Inst; 400 (void)Inst;
385 llvm::report_fatal_error("Not yet implemented"); 401 UnimplementedError(Func->getContext()->getFlags());
386 } 402 }
387 403
388 void TargetMIPS32::lowerCast(const InstCast *Inst) { 404 void TargetMIPS32::lowerCast(const InstCast *Inst) {
389 InstCast::OpKind CastKind = Inst->getCastKind(); 405 InstCast::OpKind CastKind = Inst->getCastKind();
390 switch (CastKind) { 406 switch (CastKind) {
391 default: 407 default:
392 Func->setError("Cast type not supported"); 408 Func->setError("Cast type not supported");
393 return; 409 return;
394 case InstCast::Sext: { 410 case InstCast::Sext: {
395 llvm::report_fatal_error("Not yet implemented"); 411 UnimplementedError(Func->getContext()->getFlags());
396 break; 412 break;
397 } 413 }
398 case InstCast::Zext: { 414 case InstCast::Zext: {
399 llvm::report_fatal_error("Not yet implemented"); 415 UnimplementedError(Func->getContext()->getFlags());
400 break; 416 break;
401 } 417 }
402 case InstCast::Trunc: { 418 case InstCast::Trunc: {
403 llvm::report_fatal_error("Not yet implemented"); 419 UnimplementedError(Func->getContext()->getFlags());
404 break; 420 break;
405 } 421 }
406 case InstCast::Fptrunc: 422 case InstCast::Fptrunc:
407 llvm::report_fatal_error("Not yet implemented"); 423 UnimplementedError(Func->getContext()->getFlags());
408 break; 424 break;
409 case InstCast::Fpext: { 425 case InstCast::Fpext: {
410 llvm::report_fatal_error("Not yet implemented"); 426 UnimplementedError(Func->getContext()->getFlags());
411 break; 427 break;
412 } 428 }
413 case InstCast::Fptosi: 429 case InstCast::Fptosi:
414 llvm::report_fatal_error("Not yet implemented"); 430 UnimplementedError(Func->getContext()->getFlags());
415 break; 431 break;
416 case InstCast::Fptoui: 432 case InstCast::Fptoui:
417 llvm::report_fatal_error("Not yet implemented"); 433 UnimplementedError(Func->getContext()->getFlags());
418 break; 434 break;
419 case InstCast::Sitofp: 435 case InstCast::Sitofp:
420 llvm::report_fatal_error("Not yet implemented"); 436 UnimplementedError(Func->getContext()->getFlags());
421 break; 437 break;
422 case InstCast::Uitofp: { 438 case InstCast::Uitofp: {
423 llvm::report_fatal_error("Not yet implemented"); 439 UnimplementedError(Func->getContext()->getFlags());
424 break; 440 break;
425 } 441 }
426 case InstCast::Bitcast: { 442 case InstCast::Bitcast: {
427 llvm::report_fatal_error("Not yet implemented"); 443 UnimplementedError(Func->getContext()->getFlags());
428 break; 444 break;
429 } 445 }
430 } 446 }
431 } 447 }
432 448
433 void TargetMIPS32::lowerExtractElement(const InstExtractElement *Inst) { 449 void TargetMIPS32::lowerExtractElement(const InstExtractElement *Inst) {
434 (void)Inst; 450 (void)Inst;
435 llvm::report_fatal_error("Not yet implemented"); 451 UnimplementedError(Func->getContext()->getFlags());
436 } 452 }
437 453
438 void TargetMIPS32::lowerFcmp(const InstFcmp *Inst) { 454 void TargetMIPS32::lowerFcmp(const InstFcmp *Inst) {
439 (void)Inst; 455 (void)Inst;
440 llvm::report_fatal_error("Not yet implemented"); 456 UnimplementedError(Func->getContext()->getFlags());
441 } 457 }
442 458
443 void TargetMIPS32::lowerIcmp(const InstIcmp *Inst) { 459 void TargetMIPS32::lowerIcmp(const InstIcmp *Inst) {
444 (void)Inst; 460 (void)Inst;
445 llvm::report_fatal_error("Not yet implemented"); 461 UnimplementedError(Func->getContext()->getFlags());
446 } 462 }
447 463
448 void TargetMIPS32::lowerInsertElement(const InstInsertElement *Inst) { 464 void TargetMIPS32::lowerInsertElement(const InstInsertElement *Inst) {
449 (void)Inst; 465 (void)Inst;
450 llvm::report_fatal_error("Not yet implemented"); 466 UnimplementedError(Func->getContext()->getFlags());
451 } 467 }
452 468
453 void TargetMIPS32::lowerIntrinsicCall(const InstIntrinsicCall *Instr) { 469 void TargetMIPS32::lowerIntrinsicCall(const InstIntrinsicCall *Instr) {
454 switch (Intrinsics::IntrinsicID ID = Instr->getIntrinsicInfo().ID) { 470 switch (Intrinsics::IntrinsicID ID = Instr->getIntrinsicInfo().ID) {
455 case Intrinsics::AtomicCmpxchg: { 471 case Intrinsics::AtomicCmpxchg: {
456 llvm::report_fatal_error("Not yet implemented"); 472 UnimplementedError(Func->getContext()->getFlags());
457 return; 473 return;
458 } 474 }
459 case Intrinsics::AtomicFence: 475 case Intrinsics::AtomicFence:
460 llvm::report_fatal_error("Not yet implemented"); 476 UnimplementedError(Func->getContext()->getFlags());
461 return; 477 return;
462 case Intrinsics::AtomicFenceAll: 478 case Intrinsics::AtomicFenceAll:
463 // NOTE: FenceAll should prevent and load/store from being moved 479 // NOTE: FenceAll should prevent and load/store from being moved
464 // across the fence (both atomic and non-atomic). The InstMIPS32Mfence 480 // across the fence (both atomic and non-atomic). The InstMIPS32Mfence
465 // instruction is currently marked coarsely as "HasSideEffects". 481 // instruction is currently marked coarsely as "HasSideEffects".
466 llvm::report_fatal_error("Not yet implemented"); 482 UnimplementedError(Func->getContext()->getFlags());
467 return; 483 return;
468 case Intrinsics::AtomicIsLockFree: { 484 case Intrinsics::AtomicIsLockFree: {
469 llvm::report_fatal_error("Not yet implemented"); 485 UnimplementedError(Func->getContext()->getFlags());
470 return; 486 return;
471 } 487 }
472 case Intrinsics::AtomicLoad: { 488 case Intrinsics::AtomicLoad: {
473 llvm::report_fatal_error("Not yet implemented"); 489 UnimplementedError(Func->getContext()->getFlags());
474 return; 490 return;
475 } 491 }
476 case Intrinsics::AtomicRMW: 492 case Intrinsics::AtomicRMW:
477 llvm::report_fatal_error("Not yet implemented"); 493 UnimplementedError(Func->getContext()->getFlags());
478 return; 494 return;
479 case Intrinsics::AtomicStore: { 495 case Intrinsics::AtomicStore: {
480 llvm::report_fatal_error("Not yet implemented"); 496 UnimplementedError(Func->getContext()->getFlags());
481 return; 497 return;
482 } 498 }
483 case Intrinsics::Bswap: { 499 case Intrinsics::Bswap: {
484 llvm::report_fatal_error("Not yet implemented"); 500 UnimplementedError(Func->getContext()->getFlags());
485 return; 501 return;
486 } 502 }
487 case Intrinsics::Ctpop: { 503 case Intrinsics::Ctpop: {
488 llvm::report_fatal_error("Not yet implemented"); 504 UnimplementedError(Func->getContext()->getFlags());
489 return; 505 return;
490 } 506 }
491 case Intrinsics::Ctlz: { 507 case Intrinsics::Ctlz: {
492 llvm::report_fatal_error("Not yet implemented"); 508 UnimplementedError(Func->getContext()->getFlags());
493 return; 509 return;
494 } 510 }
495 case Intrinsics::Cttz: { 511 case Intrinsics::Cttz: {
496 llvm::report_fatal_error("Not yet implemented"); 512 UnimplementedError(Func->getContext()->getFlags());
497 return; 513 return;
498 } 514 }
499 case Intrinsics::Fabs: { 515 case Intrinsics::Fabs: {
500 llvm::report_fatal_error("Not yet implemented"); 516 UnimplementedError(Func->getContext()->getFlags());
501 return; 517 return;
502 } 518 }
503 case Intrinsics::Longjmp: { 519 case Intrinsics::Longjmp: {
504 InstCall *Call = makeHelperCall(H_call_longjmp, nullptr, 2); 520 InstCall *Call = makeHelperCall(H_call_longjmp, nullptr, 2);
505 Call->addArg(Instr->getArg(0)); 521 Call->addArg(Instr->getArg(0));
506 Call->addArg(Instr->getArg(1)); 522 Call->addArg(Instr->getArg(1));
507 lowerCall(Call); 523 lowerCall(Call);
508 return; 524 return;
509 } 525 }
510 case Intrinsics::Memcpy: { 526 case Intrinsics::Memcpy: {
(...skipping 24 matching lines...) Expand all
535 lowerCast(InstCast::create(Func, InstCast::Zext, ValExt, ValOp)); 551 lowerCast(InstCast::create(Func, InstCast::Zext, ValExt, ValOp));
536 InstCall *Call = makeHelperCall(H_call_memset, nullptr, 3); 552 InstCall *Call = makeHelperCall(H_call_memset, nullptr, 3);
537 Call->addArg(Instr->getArg(0)); 553 Call->addArg(Instr->getArg(0));
538 Call->addArg(ValExt); 554 Call->addArg(ValExt);
539 Call->addArg(Instr->getArg(2)); 555 Call->addArg(Instr->getArg(2));
540 lowerCall(Call); 556 lowerCall(Call);
541 return; 557 return;
542 } 558 }
543 case Intrinsics::NaClReadTP: { 559 case Intrinsics::NaClReadTP: {
544 if (Ctx->getFlags().getUseSandboxing()) { 560 if (Ctx->getFlags().getUseSandboxing()) {
545 llvm::report_fatal_error("Not yet implemented"); 561 UnimplementedError(Func->getContext()->getFlags());
546 } else { 562 } else {
547 InstCall *Call = makeHelperCall(H_call_read_tp, Instr->getDest(), 0); 563 InstCall *Call = makeHelperCall(H_call_read_tp, Instr->getDest(), 0);
548 lowerCall(Call); 564 lowerCall(Call);
549 } 565 }
550 return; 566 return;
551 } 567 }
552 case Intrinsics::Setjmp: { 568 case Intrinsics::Setjmp: {
553 InstCall *Call = makeHelperCall(H_call_setjmp, Instr->getDest(), 1); 569 InstCall *Call = makeHelperCall(H_call_setjmp, Instr->getDest(), 1);
554 Call->addArg(Instr->getArg(0)); 570 Call->addArg(Instr->getArg(0));
555 lowerCall(Call); 571 lowerCall(Call);
556 return; 572 return;
557 } 573 }
558 case Intrinsics::Sqrt: { 574 case Intrinsics::Sqrt: {
559 llvm::report_fatal_error("Not yet implemented"); 575 UnimplementedError(Func->getContext()->getFlags());
560 return; 576 return;
561 } 577 }
562 case Intrinsics::Stacksave: { 578 case Intrinsics::Stacksave: {
563 llvm::report_fatal_error("Not yet implemented"); 579 UnimplementedError(Func->getContext()->getFlags());
564 return; 580 return;
565 } 581 }
566 case Intrinsics::Stackrestore: { 582 case Intrinsics::Stackrestore: {
567 llvm::report_fatal_error("Not yet implemented"); 583 UnimplementedError(Func->getContext()->getFlags());
568 return; 584 return;
569 } 585 }
570 case Intrinsics::Trap: 586 case Intrinsics::Trap:
571 llvm::report_fatal_error("Not yet implemented"); 587 UnimplementedError(Func->getContext()->getFlags());
572 return; 588 return;
573 case Intrinsics::UnknownIntrinsic: 589 case Intrinsics::UnknownIntrinsic:
574 Func->setError("Should not be lowering UnknownIntrinsic"); 590 Func->setError("Should not be lowering UnknownIntrinsic");
575 return; 591 return;
576 } 592 }
577 return; 593 return;
578 } 594 }
579 595
580 void TargetMIPS32::lowerLoad(const InstLoad *Inst) { 596 void TargetMIPS32::lowerLoad(const InstLoad *Inst) {
581 (void)Inst; 597 (void)Inst;
582 llvm::report_fatal_error("Not yet implemented"); 598 UnimplementedError(Func->getContext()->getFlags());
583 } 599 }
584 600
585 void TargetMIPS32::doAddressOptLoad() { 601 void TargetMIPS32::doAddressOptLoad() {
586 llvm::report_fatal_error("Not yet implemented"); 602 UnimplementedError(Func->getContext()->getFlags());
587 } 603 }
588 604
589 void TargetMIPS32::randomlyInsertNop(float Probability) { 605 void TargetMIPS32::randomlyInsertNop(float Probability) {
590 RandomNumberGeneratorWrapper RNG(Ctx->getRNG()); 606 RandomNumberGeneratorWrapper RNG(Ctx->getRNG());
591 if (RNG.getTrueWithProbability(Probability)) { 607 if (RNG.getTrueWithProbability(Probability)) {
592 llvm::report_fatal_error("Not yet implemented"); 608 UnimplementedError(Func->getContext()->getFlags());
593 } 609 }
594 } 610 }
595 611
596 void TargetMIPS32::lowerPhi(const InstPhi * /*Inst*/) { 612 void TargetMIPS32::lowerPhi(const InstPhi * /*Inst*/) {
597 Func->setError("Phi found in regular instruction list"); 613 Func->setError("Phi found in regular instruction list");
598 } 614 }
599 615
600 void TargetMIPS32::lowerRet(const InstRet *Inst) { 616 void TargetMIPS32::lowerRet(const InstRet *Inst) {
601 (void)Inst; 617 Variable *Reg = nullptr;
602 llvm::report_fatal_error("Not yet implemented"); 618 (void)Reg;
Jim Stichnoth 2015/06/12 18:03:14 remove this?
619 if (Inst->hasRetValue())
620 UnimplementedError(Func->getContext()->getFlags());
621 _ret(getPhysicalRegister(RegMIPS32::Reg_RA), Reg);
603 } 622 }
604 623
605 void TargetMIPS32::lowerSelect(const InstSelect *Inst) { 624 void TargetMIPS32::lowerSelect(const InstSelect *Inst) {
606 (void)Inst; 625 (void)Inst;
607 llvm::report_fatal_error("Not yet implemented"); 626 UnimplementedError(Func->getContext()->getFlags());
608 } 627 }
609 628
610 void TargetMIPS32::lowerStore(const InstStore *Inst) { 629 void TargetMIPS32::lowerStore(const InstStore *Inst) {
611 (void)Inst; 630 (void)Inst;
612 llvm::report_fatal_error("Not yet implemented"); 631 UnimplementedError(Func->getContext()->getFlags());
613 } 632 }
614 633
615 void TargetMIPS32::doAddressOptStore() { 634 void TargetMIPS32::doAddressOptStore() {
616 llvm::report_fatal_error("Not yet implemented"); 635 UnimplementedError(Func->getContext()->getFlags());
617 } 636 }
618 637
619 void TargetMIPS32::lowerSwitch(const InstSwitch *Inst) { 638 void TargetMIPS32::lowerSwitch(const InstSwitch *Inst) {
620 (void)Inst; 639 (void)Inst;
621 llvm::report_fatal_error("Not yet implemented"); 640 UnimplementedError(Func->getContext()->getFlags());
622 } 641 }
623 642
624 void TargetMIPS32::lowerUnreachable(const InstUnreachable * /*Inst*/) { 643 void TargetMIPS32::lowerUnreachable(const InstUnreachable * /*Inst*/) {
625 llvm_unreachable("Not yet implemented"); 644 UnimplementedError(Func->getContext()->getFlags());
626 } 645 }
627 646
628 // Turn an i64 Phi instruction into a pair of i32 Phi instructions, to 647 // Turn an i64 Phi instruction into a pair of i32 Phi instructions, to
629 // preserve integrity of liveness analysis. Undef values are also 648 // preserve integrity of liveness analysis. Undef values are also
630 // turned into zeroes, since loOperand() and hiOperand() don't expect 649 // turned into zeroes, since loOperand() and hiOperand() don't expect
631 // Undef input. 650 // Undef input.
632 void TargetMIPS32::prelowerPhis() { 651 void TargetMIPS32::prelowerPhis() {
633 llvm::report_fatal_error("Not yet implemented"); 652 UnimplementedError(Func->getContext()->getFlags());
634 } 653 }
635 654
636 // Lower the pre-ordered list of assignments into mov instructions. 655 // Lower the pre-ordered list of assignments into mov instructions.
637 // Also has to do some ad-hoc register allocation as necessary. 656 // Also has to do some ad-hoc register allocation as necessary.
638 void TargetMIPS32::lowerPhiAssignments(CfgNode *Node, 657 void TargetMIPS32::lowerPhiAssignments(CfgNode *Node,
639 const AssignList &Assignments) { 658 const AssignList &Assignments) {
640 (void)Node; 659 (void)Node;
641 (void)Assignments; 660 (void)Assignments;
642 llvm::report_fatal_error("Not yet implemented"); 661 UnimplementedError(Func->getContext()->getFlags());
643 } 662 }
644 663
645 void TargetMIPS32::postLower() { 664 void TargetMIPS32::postLower() {
646 if (Ctx->getFlags().getOptLevel() == Opt_m1) 665 if (Ctx->getFlags().getOptLevel() == Opt_m1)
647 return; 666 return;
648 // Find two-address non-SSA instructions where Dest==Src0, and set 667 // Find two-address non-SSA instructions where Dest==Src0, and set
649 // the DestNonKillable flag to keep liveness analysis consistent. 668 // the DestNonKillable flag to keep liveness analysis consistent.
650 llvm::report_fatal_error("Not yet implemented"); 669 UnimplementedError(Func->getContext()->getFlags());
651 } 670 }
652 671
653 void TargetMIPS32::makeRandomRegisterPermutation( 672 void TargetMIPS32::makeRandomRegisterPermutation(
654 llvm::SmallVectorImpl<int32_t> &Permutation, 673 llvm::SmallVectorImpl<int32_t> &Permutation,
655 const llvm::SmallBitVector &ExcludeRegisters) const { 674 const llvm::SmallBitVector &ExcludeRegisters) const {
656 (void)Permutation; 675 (void)Permutation;
657 (void)ExcludeRegisters; 676 (void)ExcludeRegisters;
658 llvm::report_fatal_error("Not yet implemented"); 677 UnimplementedError(Func->getContext()->getFlags());
659 } 678 }
660 679
661 /* TODO(jvoung): avoid duplicate symbols with multiple targets. 680 /* TODO(jvoung): avoid duplicate symbols with multiple targets.
662 void ConstantUndef::emitWithoutDollar(GlobalContext *) const { 681 void ConstantUndef::emitWithoutDollar(GlobalContext *) const {
663 llvm_unreachable("Not expecting to emitWithoutDollar undef"); 682 llvm_unreachable("Not expecting to emitWithoutDollar undef");
664 } 683 }
665 684
666 void ConstantUndef::emit(GlobalContext *) const { 685 void ConstantUndef::emit(GlobalContext *) const {
667 llvm_unreachable("undef value encountered by emitter."); 686 llvm_unreachable("undef value encountered by emitter.");
668 } 687 }
669 */ 688 */
670 689
671 TargetDataMIPS32::TargetDataMIPS32(GlobalContext *Ctx) 690 TargetDataMIPS32::TargetDataMIPS32(GlobalContext *Ctx)
672 : TargetDataLowering(Ctx) {} 691 : TargetDataLowering(Ctx) {}
673 692
674 void TargetDataMIPS32::lowerGlobal(const VariableDeclaration &Var) const { 693 void TargetDataMIPS32::lowerGlobal(const VariableDeclaration &Var) const {
675 (void)Var; 694 (void)Var;
676 llvm::report_fatal_error("Not yet implemented"); 695 UnimplementedError(Ctx->getFlags());
677 } 696 }
678 697
679 void TargetDataMIPS32::lowerGlobals( 698 void TargetDataMIPS32::lowerGlobals(
680 std::unique_ptr<VariableDeclarationList> Vars) const { 699 std::unique_ptr<VariableDeclarationList> Vars) const {
681 switch (Ctx->getFlags().getOutFileType()) { 700 switch (Ctx->getFlags().getOutFileType()) {
682 case FT_Elf: { 701 case FT_Elf: {
683 ELFObjectWriter *Writer = Ctx->getObjectWriter(); 702 ELFObjectWriter *Writer = Ctx->getObjectWriter();
684 Writer->writeDataSection(*Vars, llvm::ELF::R_MIPS_GLOB_DAT); 703 Writer->writeDataSection(*Vars, llvm::ELF::R_MIPS_GLOB_DAT);
685 } break; 704 } break;
686 case FT_Asm: 705 case FT_Asm:
687 case FT_Iasm: { 706 case FT_Iasm: {
688 const IceString &TranslateOnly = Ctx->getFlags().getTranslateOnly(); 707 const IceString &TranslateOnly = Ctx->getFlags().getTranslateOnly();
689 OstreamLocker L(Ctx); 708 OstreamLocker L(Ctx);
690 for (const VariableDeclaration *Var : *Vars) { 709 for (const VariableDeclaration *Var : *Vars) {
691 if (GlobalContext::matchSymbolName(Var->getName(), TranslateOnly)) { 710 if (GlobalContext::matchSymbolName(Var->getName(), TranslateOnly)) {
692 lowerGlobal(*Var); 711 lowerGlobal(*Var);
693 } 712 }
694 } 713 }
695 } break; 714 } break;
696 } 715 }
697 } 716 }
698 717
699 void TargetDataMIPS32::lowerConstants() const { 718 void TargetDataMIPS32::lowerConstants() const {
700 if (Ctx->getFlags().getDisableTranslation()) 719 if (Ctx->getFlags().getDisableTranslation())
701 return; 720 return;
702 llvm::report_fatal_error("Not yet implemented"); 721 UnimplementedError(Ctx->getFlags());
703 } 722 }
704 723
705 } // end of namespace Ice 724 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698