Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 6fbcecb

Browse files
committed
Lower signatures exposing struct registers to byval struct pointers
The new phase, NormalizeStructRegSignatures, converts signatures having parameters, or returning struct registers; or using structs that transitively reference such function types. The phase relies on a subsequent phase to clean up the redundant alloca/load/store instructions, however, I'm still investigating which such phase should be. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3857 R=dschuff@chromium.org, jfb@chromium.org, mseaborn@chromium.org Review URL: https://codereview.chromium.org/992493002
1 parent a508ed2 commit 6fbcecb

11 files changed

+1021
-0
lines changed

include/llvm/InitializePasses.h

+1
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ void initializeGlobalCleanupPass(PassRegistry&);
313313
void initializeGlobalizeConstantVectorsPass(PassRegistry&);
314314
void initializeInsertDivideCheckPass(PassRegistry&);
315315
void initializeNaClCcRewritePass(PassRegistry&);
316+
void initializeSimplifyStructRegSignaturesPass(PassRegistry&);
316317
void initializePNaClABIVerifyFunctionsPass(PassRegistry&);
317318
void initializePNaClABIVerifyModulePass(PassRegistry&);
318319
void initializePNaClSjLjEHPass(PassRegistry&);

include/llvm/Transforms/NaCl.h

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ ModulePass *createExpandVarArgsPass();
5252
ModulePass *createFlattenGlobalsPass();
5353
ModulePass *createGlobalCleanupPass();
5454
ModulePass *createGlobalizeConstantVectorsPass();
55+
ModulePass *createSimplifyStructRegSignaturesPass();
5556
ModulePass *createPNaClSjLjEHPass();
5657
ModulePass *createReplacePtrsWithIntsPass();
5758
ModulePass *createResolveAliasesPass();

lib/Transforms/NaCl/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ add_llvm_library(LLVMNaClTransforms
3434
RewriteLLVMIntrinsics.cpp
3535
RewritePNaClLibraryCalls.cpp
3636
SimplifyAllocas.cpp
37+
SimplifyStructRegSignatures.cpp
3738
StripAttributes.cpp
3839
StripMetadata.cpp
3940
)

lib/Transforms/NaCl/PNaClABISimplify.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ void llvm::PNaClABISimplifyAddPostOptPasses(PassManagerBase &PM) {
154154
// ConstantExprs have already been expanded out.
155155
PM.add(createReplacePtrsWithIntsPass());
156156

157+
// Convert struct reg function params to struct* byval
158+
PM.add(createSimplifyStructRegSignaturesPass());
159+
157160
// The atomic cmpxchg instruction returns a struct, and is rewritten to an
158161
// intrinsic as a post-opt pass, we therefore need to expand struct regs.
159162
PM.add(createExpandStructRegsPass());

0 commit comments

Comments
 (0)