-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code generator does not support intrinsic function llvm.fshl.i32
#111
Comments
Hello, I am compiling cpp program, and llvm cbe also complains unsupported intrinsic(#102) |
@hzhangxyz That is a completely different intrinsic. |
It looks like this is yet another intrinsic we don't have support for, and that must be because it's quite new. Unfortunately, LLVM won't lower it (convert it to instructions we do support) for us. So I guess we have to implement it ourselves. Anyway, I hacked the C backend to pretend to support the fshl intrinsic: diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index 7116b94..d9e2cbc 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -4673,6 +4673,9 @@ bool CWriter::lowerIntrinsics(Function &F) {
case Intrinsic::dbg_value:
case Intrinsic::dbg_declare:
// We directly implement these intrinsics
+
+ //FIXME:
+ case Intrinsic::fshl:
break;
default:
@@ -4833,7 +4836,8 @@ bool CWriter::visitBuiltinCall(CallInst &I, Intrinsic::ID ID) {
switch (ID) {
default: {
DBG_ERRS("Unknown LLVM intrinsic! " << I);
- errorWithMessage("unknown llvm instrinsic");
+ //errorWithMessage("unknown llvm instrinsic");
+ Out << ";"; // FIXME
return false;
}
case Intrinsic::dbg_value: I wanted to see if I'd get any more intrinsic errors. Sure enough, it complained about There was also By the way, if you want to try to add support to LLVM-CBE for these intrinsics, it should be fairly easy. You just need to look up the intrinsic's definition in the LLVM Language Reference to find out what it does, write a simple C function that does the required task, and then modify (I will probably implement these intrinsics myself at some point, though.) As an aside: wow, that's one massive LLVM IR file! 22MB, 256k lines… I guess that's a result of Rust considering an entire crate as one translation unit! |
Unfortunately I don't have much if any experience with C (hence all the Rust), and wouldn't really feel comfortable writing those definitions.
Well I'm not too concerned with the C being portable beyond being C, as I can use targets from rustc or add custom targets to rustc make sure it generates the right intrinsics. So it's more important that the code can run on that platform, than whether or not it's abstract over a number of platforms. |
That's fine, I'm happy to do it myself (eventually). |
In more attempts to compile Rust generated IR, I tried compiling the output from my project
tokei
, and I immediately get an error about an unsupported intrinsic.The text was updated successfully, but these errors were encountered: