diff options
| author | Alon Zakai <alonzakai@gmail.com> | 2013-12-13 13:58:38 -0800 |
|---|---|---|
| committer | Alon Zakai <alonzakai@gmail.com> | 2013-12-13 13:58:38 -0800 |
| commit | c26dff697a002a67a4a546719671cc14e76e52a0 (patch) | |
| tree | 53e6740a12a35cb9d0a725e4c9920ec844438c05 /lib/Transforms | |
| parent | 817a707d8cffa3adef82d3c61b8240b773a81e87 (diff) | |
horrible wip - clean up illegal funcs that were legalized
Diffstat (limited to 'lib/Transforms')
| -rw-r--r-- | lib/Transforms/NaCl/ExpandI64.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/Transforms/NaCl/ExpandI64.cpp b/lib/Transforms/NaCl/ExpandI64.cpp index 5909f686ca..bb84c6d9a9 100644 --- a/lib/Transforms/NaCl/ExpandI64.cpp +++ b/lib/Transforms/NaCl/ExpandI64.cpp @@ -78,6 +78,9 @@ namespace { // If the function has an illegal return or argument, create a legal version void ensureLegalFunc(Function *F); + // If a function is illegal, remove it + void removeIllegalFunc(Function *F); + // splits a 64-bit instruction into 32-bit chunks. We do // not yet have the values yet, as they depend on other // splits, so store the parts in Splits, for FinalizeInst. @@ -181,7 +184,18 @@ dumpv("rename %s => %s", CName, NewName); if (NewArg->hasName()) LH.High->setName(NewArg->getName() + "_high"); } } - // TODO: F->eraseFromParent(); + break; + } + } +} + +void ExpandI64::removeIllegalFunc(Function *F) { + FunctionType *FT = F->getFunctionType(); + int Num = FT->getNumParams(); + for (int i = -1; i < Num; i++) { + Type *T = i == -1 ? FT->getReturnType() : FT->getParamType(i); + if (isIllegal(T)) { + F->eraseFromParent(); break; } } @@ -754,6 +768,13 @@ bool ExpandI64::runOnModule(Module &M) { } } } + + // post pass - clean up illegal functions that were legalized + for (Module::iterator Iter = M.begin(), E = M.end(); Iter != E; ) { + Function *Func = Iter++; + removeIllegalFunc(Func); + } + return Changed; } |
