Closed EricLBuehler closed 1 year ago
What about the size_of method? You'd get a runtime value but that's maybe expected?
The size_of method gets the size at runtime, but I need it at compile time to determine the largest variant. I would appreciate your guidance on how to find the length of an ArrayType
(although I could track this), width of FloatType
and width of PointerType
.
@EricLBuehler How did you solve this? For anyone from the future searching for the same answer
I solved this by:
FloatType
.ArrayType
length.PointerType
width.They all revolve around tracking various metadata.
Hello everyone,
I am creating a programming language that will have tagged enums. To do this, I need to find the largest element. The way to do this (to my knowledge) is by finding the width of each variant.
I know how to do this for
IntType
(using theget_bit_width
method), however, I cannot find how to do this withPointerType
,VectorType
, andFloatType
. I realize that getting the width ofPointerType
is likely out of the scope of LLVM in general and would need to associated with the target. However, it seems strange to me thatFloatType
has noget_bit_width
method?In addition, how would I do this for
VectorType
? This type has no static length, so there must be another way?Thank you!