[all-commits] [llvm/llvm-project] 488185: [Clang][DebugInfo][AMDGPU] Emit zero size bitfield...
Juan Manuel Martinez Caamaño via All-commits
all-commits at lists.llvm.org
Tue Mar 28 01:19:54 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 488185cca3871a0ef2ec3b9b4c642dc6db6eeea5
https://github.com/llvm/llvm-project/commit/488185cca3871a0ef2ec3b9b4c642dc6db6eeea5
Author: Juan Manuel MARTINEZ CAAMAÑO <juamarti at amd.com>
Date: 2023-03-28 (Tue, 28 Mar 2023)
Changed paths:
M clang/lib/CodeGen/CGDebugInfo.cpp
M clang/lib/CodeGen/CGDebugInfo.h
M clang/lib/CodeGen/TargetInfo.cpp
M clang/lib/CodeGen/TargetInfo.h
A clang/test/CodeGen/debug-info-bitfield-0-struct.c
Log Message:
-----------
[Clang][DebugInfo][AMDGPU] Emit zero size bitfields in the debug info to delimit bitfields in different allocation units.
Consider the following sturctures when targetting:
struct foo {
int space[4];
char a : 8;
char b : 8;
char x : 8;
char y : 8;
};
struct bar {
int space[4];
char a : 8;
char b : 8;
char : 0;
char x : 8;
char y : 8;
};
Even if both structs have the same layout in memory, they are handled
differenlty by the AMDGPU ABI.
With the following code:
// clang --target=amdgcn-amd-amdhsa -g -O1 example.c -S
char use_foo(struct foo f) { return f.y; }
char use_bar(struct bar b) { return b.y; }
For use_foo, the 'y' field is passed in v4
; v_ashrrev_i32_e32 v0, 24, v4
; s_setpc_b64 s[30:31]
For use_bar, the 'y' field is passed in v5
; v_bfe_i32 v0, v5, 8, 8
; s_setpc_b64 s[30:31]
To make this distinction, we record a single 0-size bitfield for every member that is preceded
by it.
Reviewed By: probinson
Differential Revision: https://reviews.llvm.org/D144870
More information about the All-commits
mailing list