]> sourceware.org Git - systemtap.git/commitdiff
2007-05-02 David Smith <dsmith@redhat.com>
authordsmith <dsmith>
Wed, 2 May 2007 21:27:10 +0000 (21:27 +0000)
committerdsmith <dsmith>
Wed, 2 May 2007 21:27:10 +0000 (21:27 +0000)
* translate.cxx (c_tmpcounter::visit_functioncall): Updated
temporary handling.
(c_unparser::visit_functioncall): No longer copies numeric and
string constants to temporary variables.

ChangeLog
translate.cxx

index 2677c85b5ccf175b90656a5dea829415a6a2db33..505bac06e778c098864305dd309a4dd1e4a0edb7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-05-02  David Smith  <dsmith@redhat.com>
+
+       * translate.cxx (c_tmpcounter::visit_functioncall): Updated
+       temporary handling.
+       (c_unparser::visit_functioncall): No longer copies numeric and
+       string constants to temporary variables.
+
 2007-05-01  David Smith  <dsmith@redhat.com>
 
        * translate.cxx (c_tmpcounter::visit_binary_expression): Updated
index c48fccddbc3ce8c89090aa7a359e56b4b2afc7fc..8996bc4ce4e943a41bccc41c0cf9446392bc3258 100644 (file)
@@ -3785,11 +3785,13 @@ c_tmpcounter::visit_functioncall (functioncall *e)
 {
   assert (e->referent != 0);
   functiondecl* r = e->referent;
-  // one temporary per argument
+  // one temporary per argument, unless literal numbers or strings
   for (unsigned i=0; i<r->formal_args.size(); i++)
     {
       tmpvar t = parent->gensym (r->formal_args[i]->type);
-      t.declare (*parent);
+      if (e->args[i]->tok->type != tok_number
+         && e->args[i]->tok->type != tok_string)
+       t.declare (*parent);
       e->args[i]->visit (this);
     }
 }
@@ -3816,15 +3818,22 @@ c_unparser::visit_functioncall (functioncall* e)
   for (unsigned i=0; i<e->args.size(); i++)
     {
       tmpvar t = gensym(e->args[i]->type);
-      tmp.push_back(t);
 
       if (r->formal_args[i]->type != e->args[i]->type)
        throw semantic_error ("function argument type mismatch",
                              e->args[i]->tok, "vs", r->formal_args[i]->tok);
 
-      o->newline() << "c->last_stmt = "
-                  << lex_cast_qstring(*e->args[i]->tok) << ";";
-      c_assign (t.value(), e->args[i], "function actual argument evaluation");
+      if (e->args[i]->tok->type == tok_number
+         || e->args[i]->tok->type == tok_string)
+       t.override(c_expression(e->args[i]));
+      else
+        {
+         o->newline() << "c->last_stmt = "
+                      << lex_cast_qstring(*e->args[i]->tok) << ";";
+         c_assign (t.value(), e->args[i],
+                   "function actual argument evaluation");
+       }
+      tmp.push_back(t);
     }
 
   o->newline();
This page took 0.048254 seconds and 5 git commands to generate.