0

I searched the source code of LLVM, but I failed to find the exact code slices which show how LLVM generate bitcodes(IR) for structure. I search the keyword 'StructType::create' and 'StructType::get', but there are so many occurrences. Could anyone tell me where to find the exact code slices. My purpose is to change the order of elements in a structure and something else. Thank you.

  • Do you want to write an LLVM pass which detects a certain structure layout and changes all the occurrences? Where the structure you want to "change" is coming from? Please be more specific. – SK-logic Dec 10 '13 at 10:12

1 Answers1

1

The component which is responsible for initially generating the IR is called a front-end. The LLVM core itself does not contain any front-ends, but there are many front-ends written that target it, most famously Clang - a C, C++ and Objective-C front-end for LLVM.

So if by "generate bitcode for structure" you mean "generate bitcode for C structure", then the code responsible for it will be in Clang. Specifically, the CGRecordLayout and CGRecordLayoutBuilder classes are responsible for creating the LLVM struct type.

Oak
  • 26,231
  • 8
  • 93
  • 152