summary refs log tree commit diff stats
path: root/nim/ccgstmts.pas
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2009-01-07 17:03:25 +0100
committerAndreas Rumpf <rumpf_a@web.de>2009-01-07 17:03:25 +0100
commit439aa2d04d5528b5aed288f70895515d1da2dc3d (patch)
treecda2d0bc4d4f2bab189c4a0567cae3c1428c5ed0 /nim/ccgstmts.pas
parent1c8ddca7e08af9075a930edaca6c522d5e6fd8b5 (diff)
downloadNim-439aa2d04d5528b5aed288f70895515d1da2dc3d.tar.gz
version 0.7.4
Diffstat (limited to 'nim/ccgstmts.pas')
-rw-r--r--nim/ccgstmts.pas37
1 files changed, 26 insertions, 11 deletions
diff --git a/nim/ccgstmts.pas b/nim/ccgstmts.pas
index 0e93d6b0f..e611bbeea 100644
--- a/nim/ccgstmts.pas
+++ b/nim/ccgstmts.pas
@@ -801,9 +801,16 @@ begin
     assert(key.kind = nkIdent);
     case whichKeyword(key.ident) of
       wBreakpoint: genBreakPoint(p, it);
+      wDeadCodeElim: begin
+        if not (optDeadCodeElim in gGlobalOptions) then begin
+          // we need to keep track of ``deadCodeElim`` pragma
+          if (sfDeadCodeElim in p.module.module.flags) then
+            addPendingModule(p.module)
+        end            
+      end
       else begin end
     end
-  end
+  end;
 end;
 
 procedure genAsgn(p: BProc; e: PNode);
@@ -816,6 +823,17 @@ begin
   expr(p, e.sons[1], a);
 end;
 
+procedure genFastAsgn(p: BProc; e: PNode);
+var
+  a: TLoc;
+begin
+  genLineDir(p, e); // BUGFIX
+  InitLocExpr(p, e.sons[0], a);
+  include(a.flags, lfNoDeepCopy);
+  assert(a.t <> nil);
+  expr(p, e.sons[1], a);
+end;
+
 procedure genStmts(p: BProc; t: PNode);
 var
   a: TLoc;
@@ -844,6 +862,7 @@ begin
       initLocExpr(p, t, a);
     end;
     nkAsgn: genAsgn(p, t);
+    nkFastAsgn: genFastAsgn(p, t);
     nkDiscardStmt: begin
       genLineDir(p, t);
       initLocExpr(p, t.sons[0], a);
@@ -865,17 +884,13 @@ begin
     nkProcDef, nkConverterDef: begin
       if (t.sons[genericParamsPos] = nil) then begin
         prc := t.sons[namePos].sym;
-        if (t.sons[codePos] <> nil)
-        or (lfDynamicLib in prc.loc.flags) then begin // BUGFIX
-          if IntSetContainsOrIncl(p.module.debugDeclared, prc.id) then begin
-            internalError(t.info, 'genStmts(): ' + toString(prc.id)); 
-            // XXX: remove this check!
-          end;
-          //if IntSetContains(p.module.debugDeclared, 2642) then 
-          //  InternalError(t.info, 'this sucks '  + toString(prc.id));
-          genProc(p.module, prc)
+        if not (optDeadCodeElim in gGlobalOptions) and
+            not (sfDeadCodeElim in getModule(prc).flags)
+        or ([sfExportc, sfCompilerProc] * prc.flags = [sfExportc]) then begin
+          if (t.sons[codePos] <> nil) or (lfDynamicLib in prc.loc.flags) then begin
+            genProc(p.module, prc)
+          end
         end
-        //else if sfCompilerProc in prc.flags then genProcPrototype(prc);
       end
     end;
     else