LLVM. How to access to struct fields based on their names?
问题 I have little example code in C++: struct RecordTest { int value1; int value2; }; void test() { RecordTest rt; rt.value1 = 15; rt.value2 = 75; } and LLVM 3.4 IR for it: %struct.RecordTest = type { i32, i32 } ; Function Attrs: nounwind define void @_Z4testv() #0 { entry: %rt = alloca %struct.RecordTest, align 4 %value1 = getelementptr inbounds %struct.RecordTest* %rt, i32 0, i32 0 store i32 15, i32* %value1, align 4 %value2 = getelementptr inbounds %struct.RecordTest* %rt, i32 0, i32 1 store