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

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: doesn't matter if eax or not 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.")
Jim Stichnoth 2014/06/10 22:58:28 I hate that std::string doesn't have a simple star
jvoung (off chromium) 2014/06/12 05:48:30 Done -- at some point we might want to just some s
Jim Stichnoth 2014/06/12 20:52:06 Sorry, I used the constant 5 in my suggestion just
jvoung (off chromium) 2014/06/16 20:51:58 Done.
534 Ice::IceString Name = Target->getName();
535 size_t Dot = Name.find('.');
536 if (Dot != Ice::IceString::npos &&
537 Name.substr(0, Dot) == Ice::IceString("llvm")) {
538 Ice::IceString NameSuffix = Name.substr(Dot + 1);
539 Ice::IntrinsicInfo Info = Ctx->getIntrinsicInfo(NameSuffix);
540 if (Info == Ice::UnknownIntrinsicInfo) {
541 report_fatal_error(std::string("Invalid PNaCl intrinsic call: ") +
542 LLVMObjectAsString(Inst));
543 }
544 NewInst = Ice::InstIntrinsicCall::create(Func, NumArgs, Dest,
545 CallTarget, Info);
546 }
547 }
548
549 // Not an intrinsic call.
550 if (NewInst == NULL) {
551 NewInst = Ice::InstCall::create(Func, NumArgs, Dest, CallTarget);
552 }
531 for (unsigned i = 0; i < NumArgs; ++i) { 553 for (unsigned i = 0; i < NumArgs; ++i) {
532 NewInst->addArg(convertOperand(Inst, i)); 554 NewInst->addArg(convertOperand(Inst, i));
533 } 555 }
534 return NewInst; 556 return NewInst;
535 } 557 }
536 558
537 Ice::Inst *convertAllocaInstruction(const AllocaInst *Inst) { 559 Ice::Inst *convertAllocaInstruction(const AllocaInst *Inst) {
538 // PNaCl bitcode only contains allocas of byte-granular objects. 560 // PNaCl bitcode only contains allocas of byte-granular objects.
539 Ice::Operand *ByteCount = convertValue(Inst->getArraySize()); 561 Ice::Operand *ByteCount = convertValue(Inst->getArraySize());
540 uint32_t Align = Inst->getAlignment(); 562 uint32_t Align = Inst->getAlignment();
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 << " sec\n"; 747 << " sec\n";
726 } 748 }
727 } 749 }
728 } 750 }
729 751
730 if (!DisableTranslation && Func) 752 if (!DisableTranslation && Func)
731 Func->getTarget()->emitConstants(); 753 Func->getTarget()->emitConstants();
732 754
733 return ExitStatus; 755 return ExitStatus;
734 } 756 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698