diff options
author | Reid Kleckner <rnk@google.com> | 2016-06-22 17:15:28 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-06-22 17:15:28 +0000 |
commit | 643dd83661d46f69d5f7a6dd0ec0e4df764ba6e3 (patch) | |
tree | 6ab7de8f881e89dd255c72473285ce425671eba4 /llvm/lib/CodeGen/MachineInstr.cpp | |
parent | b12b353a4103f88ce635a609b3513b5a3b7f6e70 (diff) | |
download | llvm-643dd83661d46f69d5f7a6dd0ec0e4df764ba6e3.zip llvm-643dd83661d46f69d5f7a6dd0ec0e4df764ba6e3.tar.gz llvm-643dd83661d46f69d5f7a6dd0ec0e4df764ba6e3.tar.bz2 |
[codeview] Defer emission of all referenced complete records
This is the motivating example:
struct B { int b; };
struct A { B *b; };
int f(A *p) { return p->b->b; }
Clang emits complete types for both A and B because they are required to
be complete, but our CodeView emission would only emit forward
declarations of A and B. This was a consequence of the fact that the A*
type must reference the forward declaration of A, which doesn't
reference B at all.
We can't eagerly emit complete definitions of A and B when we request
the forward declaration's type index because of recursive types like
linked lists. If we did that, our stack usage could get out of hand, and
it would be possible to lower a type while attempting to lower a type,
and we would need to double check if our type is already present in the
TypeIndexMap after all recursive getTypeIndex calls.
Instead, defer complete type emission until after all type lowering has
completed. This ensures that all referenced complete types are emitted,
and that type lowering is not re-entrant.
llvm-svn: 273443
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
0 files changed, 0 insertions, 0 deletions