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

Side by Side Diff: src/llvm2ice.cpp

Issue 321993002: Add a few Subzero intrinsics (not the atomic ones yet). (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: add a run test Created 6 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/llvm2ice.cpp - Driver for testing ----------------------===// 1 //===- subzero/src/llvm2ice.cpp - Driver for testing ----------------------===//
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 defines a driver that uses LLVM capabilities to parse a 10 // This file defines a driver that uses LLVM capabilities to parse a
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 } 519 }
520 return Switch; 520 return Switch;
521 } 521 }
522 522
523 Ice::Inst *convertCallInstruction(const CallInst *Inst) { 523 Ice::Inst *convertCallInstruction(const CallInst *Inst) {
524 Ice::Variable *Dest = mapValueToIceVar(Inst); 524 Ice::Variable *Dest = mapValueToIceVar(Inst);
525 Ice::Operand *CallTarget = convertValue(Inst->getCalledValue()); 525 Ice::Operand *CallTarget = convertValue(Inst->getCalledValue());
526 unsigned NumArgs = Inst->getNumArgOperands(); 526 unsigned NumArgs = Inst->getNumArgOperands();
527 // Note: Subzero doesn't (yet) do anything special with the Tail 527 // Note: Subzero doesn't (yet) do anything special with the Tail
528 // flag in the bitcode, i.e. CallInst::isTailCall(). 528 // flag in the bitcode, i.e. CallInst::isTailCall().
529 Ice::InstCall *NewInst = 529 Ice::InstCall *NewInst = NULL;
530 Ice::InstCall::create(Func, NumArgs, Dest, CallTarget); 530
531 if (Ice::ConstantRelocatable *Target =
532 llvm::dyn_cast<Ice::ConstantRelocatable>(CallTarget)) {
533 // Check if this direct call is to an Intrinsic (starts with "llvm.")
534 Ice::IceString Name = Target->getName();
535 if (Name.substr(0, 5) == "llvm.") {
536 Ice::IceString NameSuffix = Name.substr(5);
537 Ice::IntrinsicInfo Info = Ctx->getIntrinsicInfo(NameSuffix);
538 if (Info == Ice::UnknownIntrinsicInfo) {
539 report_fatal_error(std::string("Invalid PNaCl intrinsic call: ") +
540 LLVMObjectAsString(Inst));
541 }
542 NewInst = Ice::InstIntrinsicCall::create(Func, NumArgs, Dest,
543 CallTarget, Info);
544 }
545 }
546
547 // Not an intrinsic call.
548 if (NewInst == NULL) {
549 NewInst = Ice::InstCall::create(Func, NumArgs, Dest, CallTarget);
550 }
531 for (unsigned i = 0; i < NumArgs; ++i) { 551 for (unsigned i = 0; i < NumArgs; ++i) {
532 NewInst->addArg(convertOperand(Inst, i)); 552 NewInst->addArg(convertOperand(Inst, i));
533 } 553 }
534 return NewInst; 554 return NewInst;
535 } 555 }
536 556
537 Ice::Inst *convertAllocaInstruction(const AllocaInst *Inst) { 557 Ice::Inst *convertAllocaInstruction(const AllocaInst *Inst) {
538 // PNaCl bitcode only contains allocas of byte-granular objects. 558 // PNaCl bitcode only contains allocas of byte-granular objects.
539 Ice::Operand *ByteCount = convertValue(Inst->getArraySize()); 559 Ice::Operand *ByteCount = convertValue(Inst->getArraySize());
540 uint32_t Align = Inst->getAlignment(); 560 uint32_t Align = Inst->getAlignment();
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 << " sec\n"; 745 << " sec\n";
726 } 746 }
727 } 747 }
728 } 748 }
729 749
730 if (!DisableTranslation && Func) 750 if (!DisableTranslation && Func)
731 Func->getTarget()->emitConstants(); 751 Func->getTarget()->emitConstants();
732 752
733 return ExitStatus; 753 return ExitStatus;
734 } 754 }
OLDNEW
« src/IceTargetLoweringX8632.cpp ('K') | « src/IceTargetLoweringX8632.cpp ('k') | szdiff.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698