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

Unified 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: tweak test some 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 side-by-side diff with in-line comments
Download patch
Index: src/llvm2ice.cpp
diff --git a/src/llvm2ice.cpp b/src/llvm2ice.cpp
index 374d753769eff6b00403fb787bd52ce49430a428..180c5c2c5529d62f9c7c83ba0bde3f6911d55beb 100644
--- a/src/llvm2ice.cpp
+++ b/src/llvm2ice.cpp
@@ -526,8 +526,28 @@ private:
unsigned NumArgs = Inst->getNumArgOperands();
// Note: Subzero doesn't (yet) do anything special with the Tail
// flag in the bitcode, i.e. CallInst::isTailCall().
- Ice::InstCall *NewInst =
- Ice::InstCall::create(Func, NumArgs, Dest, CallTarget);
+ Ice::InstCall *NewInst = NULL;
+
+ if (Ice::ConstantRelocatable *Target =
+ llvm::dyn_cast<Ice::ConstantRelocatable>(CallTarget)) {
+ // Check if this direct call is to an Intrinsic (starts with "llvm.")
+ Ice::IceString Name = Target->getName();
+ if (Name.substr(0, 5) == "llvm.") {
+ Ice::IceString NameSuffix = Name.substr(5);
+ Ice::IntrinsicInfo Info = Ctx->getIntrinsicInfo(NameSuffix);
+ if (Info == Ice::UnknownIntrinsicInfo) {
+ report_fatal_error(std::string("Invalid PNaCl intrinsic call: ") +
+ LLVMObjectAsString(Inst));
+ }
+ NewInst = Ice::InstIntrinsicCall::create(Func, NumArgs, Dest,
+ CallTarget, Info);
+ }
+ }
+
+ // Not an intrinsic call.
+ if (NewInst == NULL) {
+ NewInst = Ice::InstCall::create(Func, NumArgs, Dest, CallTarget);
+ }
for (unsigned i = 0; i < NumArgs; ++i) {
NewInst->addArg(convertOperand(Inst, i));
}

Powered by Google App Engine
This is Rietveld 408576698