琬菁楊
2010-Apr-01 20:27 UTC
[LLVMdev] Idea for Google Summer Code : C Compiler for EFI Byte Code implement in LLVM
Hello, Chris> 2010/3/20 Chris Lattner <clattner at apple.com> > > >> On Mar 19, 2010, at 2:40 PM, Louis Gerbarg wrote: >> >> >>> What do you mean by "variable sized pointers"? What does: >>> >>> struct S {void *X; }; >>> >>> return for sizeof(struct S); ? >>> >> >> It doesn't, at least not for Intel's EBC compiler. They error out on any >> sizeof that include a pointer. A piece of EBC code can run in either a 32 >> bit or 64 bit environment, and everything in the compiler either needs to >> cope with it (by conditionally choosing the size of offsets into structs, >> for instance) or give up on it and abort. That also means that you cannot >> compile code that depends on knowing pointer sizes in the preprocessor, etc. >> >> >> Ok, that makes sense. It could be done by generalizing the notions of >> variably modified types (which are VLAs in C99) to include pointers. >> >I have read the sizeof and VLA in C99 I found a example: EXAMPLE 3 In this example, the size of a variable-length array is computed and returned from a function: #include <stddef.h> size_t fsize3(int n) { char b[n+3]; // variable length array return sizeof b; // execution time sizeof } int main() { size_t size; size = fsize3(10); // fsize3 returns 13 return 0; } And I found some information with clang about VLA (http://clang.llvm.org/cxx_compatibility.html#vla) Does llvm/clang doesn't support sizeof is evaluated at run time?? thanks ching>-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100402/337df99f/attachment.html>
琬菁楊
2010-Apr-02 16:28 UTC
[LLVMdev] Idea for Google Summer Code : C Compiler for EFI Byte Code implement in LLVM
Hello Chris, I have survey the efi specification and ask some question to efi engineer. Difference between EFI C and ANSI C is as following: 1. void* In EFI C, the void* is 4-byte for 32-bit processor and 8-byte for 64-bit processor. And it can appears in any where like ANSI C. So the main problem is that struct layout like struct S{ void* X; }; is not static. 2. no floating support in EFI C 3. no C++ support in EFI C 4. no assembly support in EFI C, all assembly must convert to C I am wondering that does LLVM support model which structure layout is determined at run time?? If not, do I need to modify the parser in clang to support this feature?? thanks ching -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100403/c4d0de77/attachment.html>
Reasonably Related Threads
- [LLVMdev] Idea for Google Summer Code : C Compiler for EFI Byte Code implement in LLVM
- [LLVMdev] Idea for Google Summer Code : C Compiler for EFI Byte Code implement in LLVM
- [LLVMdev] Idea for Google Summer Code : C Compiler for EFI Byte Code implement in LLVM
- [LLVMdev] Idea for Google Summer Code : C Compiler for EFI Byte Code implement in LLVM
- [LLVMdev] Idea for Google Summer Code : C Compiler for EFI Byte Code implement in LLVM