diff options
author | Araq <rumpf_a@web.de> | 2011-04-12 01:13:42 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-04-12 01:13:42 +0200 |
commit | cd292568d775d55d9abb51e962882ecda12c03a9 (patch) | |
tree | 85451f0e1f17dc0463350915f12bdd0a82a73455 /nim/passaux.pas | |
parent | 46c41e43690cba9bc1caff6a994bb6915df8a1b7 (diff) | |
download | Nim-cd292568d775d55d9abb51e962882ecda12c03a9.tar.gz |
big repo cleanup
Diffstat (limited to 'nim/passaux.pas')
-rwxr-xr-x | nim/passaux.pas | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/nim/passaux.pas b/nim/passaux.pas deleted file mode 100755 index 7898d8278..000000000 --- a/nim/passaux.pas +++ /dev/null @@ -1,77 +0,0 @@ -// -// -// The Nimrod Compiler -// (c) Copyright 2008 Andreas Rumpf -// -// See the file "copying.txt", included in this -// distribution, for details about the copyright. -// -unit passaux; - -// implements some little helper passes -{$include 'config.inc'} - -interface - -uses - nsystem, strutils, ast, astalgo, passes, msgs, options; - -function verbosePass: TPass; -function cleanupPass: TPass; - -implementation - -function verboseOpen(s: PSym; const filename: string): PPassContext; -begin - //MessageOut('compiling ' + s.name.s); - result := nil; // we don't need a context - if gVerbosity > 0 then - rawMessage(hintProcessing, s.name.s); -end; - -function verboseProcess(context: PPassContext; n: PNode): PNode; -begin - result := n; - if context <> nil then InternalError('logpass: context is not nil'); - if gVerbosity = 3 then - liMessage(n.info, hintProcessing, toString(ast.gid)); -end; - -function verbosePass: TPass; -begin - initPass(result); - result.open := verboseOpen; - result.process := verboseProcess; -end; - -function cleanUp(c: PPassContext; n: PNode): PNode; -var - i: int; - s: PSym; -begin - result := n; - // we cannot clean up if dead code elimination is activated - if (optDeadCodeElim in gGlobalOptions) then exit; - case n.kind of - nkStmtList: begin - for i := 0 to sonsLen(n)-1 do {@discard} cleanup(c, n.sons[i]); - end; - nkProcDef, nkMethodDef: begin - if (n.sons[namePos].kind = nkSym) then begin - s := n.sons[namePos].sym; - if not (sfDeadCodeElim in getModule(s).flags) and - not astNeeded(s) then s.ast.sons[codePos] := nil; // free the memory - end - end - else begin end; - end -end; - -function cleanupPass: TPass; -begin - initPass(result); - result.process := cleanUp; - result.close := cleanUp; -end; - -end. |