-
Notifications
You must be signed in to change notification settings - Fork 69
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
Add saw-script llvm_struct_type
function
#1085
Comments
Wow, that's pretty confusing. I wonder if we should use a name like |
One problem with renaming I suppose we could always just introduce a new name |
Right, this is what I was thinking. Having |
Having both `llvm_struct` and `llvm_struct_type` invites potential confusion, and moreover, `llvm_alias` is a more accurate name anyways. See the discussion in #1085.
This introduces the `llvm_alias` function and makes `llvm_struct` a synonym for `llvm_alias`. For now, `llvm_struct` continues to be available without a deprecation notice. In the future, we may want to deprecate `llvm_struct` in favor of `llvm_alias`, as having two separate functions named `llvm_struct` and `llvm_struct_type` could invite confusion. See the discussion in #1085.
We have a function
llvm_struct_value : [SetupValue] -> SetupValue
for creating LLVM values in saw-script, but we do not have a corresponding functionllvm_struct_type : [LLVMType] -> LLVMType
for creating LLVM struct types. We should add it.Note that we do already have a function called
llvm_struct
that gives you anLLVMType
, but it only takes a string as an argument and gives you the corresponding alias type (which is often, but not necessarily, defined as a struct type).The
llvm_struct_type
function will be specifically useful when you have a program that has defined a variable-length struct (i.e. one where the last field is an array with unspecified length, which is compiled to LLVM with an array length of 0) and you want to allocate one with a non-zero array length in the last field.For completeness, we should probably also add a variant for packed struct types too, although these are rarely used in practice.
The text was updated successfully, but these errors were encountered: