[cfe-dev] Fixed-size argument arrays in LLVM assembly

nkavv at physics.auth.gr nkavv at physics.auth.gr
Wed Feb 13 09:55:46 PST 2013


Hi all,

I've noticed that fixed-size arrays are not always preserved in LLVM  
assembly. This happens in the case of procedure argument arrays. While  
an alloca declares the size of fixed-size local arrays (for instance),  
argument arrays are always accessed as pointers (with getelementptr,  
which is not intuitive for an LLVM n00b).

While C (and other languages that share this approach) does not impose  
any bounds checking, maintaining the sizes may be meaningful for  
certain targets, e.g. non-programmable hardware.

1) Does the in-memory data structures that represent LLVM IR maintain  
argument array sizes? If yes, how is this information accessed? Or is  
it lost in translation?

2) If this is not the case, can the LLVM IR (in principle) cope with  
array arguments without converting them to pointers?

Thank you in advance.

Best regards
Nikolaos Kavvadias






More information about the cfe-dev mailing list