aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/NaCl/ExpandStructRegs.cpp
AgeCommit message (Collapse)Author
2013-06-25PNaCl: Fix ExpandStructRegs to handle "select" instructionsMark Seaborn
The code is similar to the case for handling phi nodes. It turns out that "select" on struct values can occur in practice with use of C++ method pointers. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3514 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/17706002
2013-06-10PNaCl: Extend ExpandStructRegs to handle "insertvalue" instructionsMark Seaborn
Previously, the pass could expand out struct_load+extractvalue combinations (via ReplaceUsesOfStructWithFields()). This change makes the pass more general by converting struct_loads to scalar_load+insertvalue combinations and then by expanding out insertvalue+extractvalue combinations. This means the pass can now handle the insertvalue instructions that are sometimes generated by the SROA pass. (Clang compiles ScummVM's use of C++ method pointers to struct loads+stores which SROA generates insertvalue instructions from.) To make the pass more general, we also extend it to be able to handle phi nodes of struct type. These are split into extractvalue+scalar_phi+insertvalue combinations. However, the pass is not yet fully general, because it doesn't handle: * nested struct types * array types Change ExpandArithWithOverflow to rely on ExpandStructRegs' insertvalue handling rather than the less general ReplaceUsesOfStructWithFields() helper function, which can now be removed. SplitUpStore() no longer needs to handle Constants, because this case is handled by ExpandExtractValue(). BUG=https://code.google.com/p/nativeclient/issues/detail?id=3476 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/16448006
2013-05-30PNaCl: Add a pass to expand out Clang's use of registers of struct typeMark Seaborn
Clang's implementation of C++ method pointers generates IR that uses LLVM registers with struct type -- specifically, loads and stores of struct values, and extractvalue instructions. See lib/CodeGen/ItaniumCXXABI.cpp in Clang. Add a pass, ExpandStructRegs, which expands out those uses. Factor out a function from ExpandArithWithOverflow so that the two passes can share some code. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3343 TEST=*.ll tests + trybots + GCC torture tests Review URL: https://codereview.chromium.org/15692014