-
Notifications
You must be signed in to change notification settings - Fork 99
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
LLVM converts integer types to floats #194
Comments
Could you clarify which version of LLVMSharp you're using? For reference, this is incorrect usage and likely and I'm actually surprised its producing IR at all:
LLVMSharp is ultimately fairly simple bindings over LLVM. As such, it is very lowlevel and only really has the safety that libLLVM has built into itself, but should in general work exactly like it does in C. I'd like to eventually build a higher level safe wrapper on top (much like I did for ClangSharp) and there is some semblance on the start of that with things like: https://github.com/dotnet/LLVMSharp/blob/main/sources/LLVMSharp/LLVMContext.cs, but its not nearly there or close to complete yet. |
I'm using LLVMSharp 14.0.0-beta1 from NuGet.
I'm fairly new to LLVM in general, so I just guessed how to use it. And documentation doesn't really help in my case, as I'm not actually making an AST or anything, I'm transforming the bytecode to LLVM IR. So I guess it's not how you create constant values. So yeah, it doesn't generate any error or anything. For reference (which may or may not help), here is what I get when running
|
Thanks! That all lines up then. I'm unsure why its not erroring, as it really should be. I'll leave this issue open to track adding some diagnostics on the LLVMSharp side to help catch some of these issues. The raw |
Hey!
I'm making a compiler which will use LLVM as its backend. But while I was doing some tests, I saw that LLVM, for some reason, was transforming any integer types (i8, i16, i32 or i64) to floats (more precisely,
ppc_fp128
). But some other types like double work and are not converted to floats (since doubles can hold decimals already).What I don't understand is that I'm not using any decimal values, and it is still converting them into floats, which actually breaks my code.
Here is a sample demo which does this behavior:
Here is the LLVM IR output:
I'm not quite sure if this is a bug, or if I'm using LLVM(Sharp) wrong here. Any help would be greatly appreciated!
The text was updated successfully, but these errors were encountered: