Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tamer ignores tic/toc without parentheses #5

Open
gnuvince opened this issue Feb 22, 2016 · 1 comment
Open

Tamer ignores tic/toc without parentheses #5

gnuvince opened this issue Feb 22, 2016 · 1 comment

Comments

@gnuvince
Copy link
Contributor

If a MATLAB function contains calls to tic and/or toc and they do not have an empty list of arguments (e.g. tic()), the calls are not included in the TameIR output.

Example:

    $ cat /tmp/test.m
    function test(x)
            tic;
            toc;
    end


    $ ./McLabCore.sh -t /tmp/test.m
    test
    InterproceduralAnalysis:test
      AnalysisNode: test([(double,[1, 1],REAL)])  --> []
    % args: {x=(double,[1, 1],REAL)}
    function  [] = test(x)
    end
    % results: []
@isbadawi
Copy link
Member

Prototype fix:

diff --git a/languages/Natlab/src/natlab/tame/simplification/ThreeAddressToIR.java b/languages/Natlab/src/natlab/tame/simplification/ThreeAddressToIR.java
index ecdcd4f..6b7d602 100644
--- a/languages/Natlab/src/natlab/tame/simplification/ThreeAddressToIR.java
+++ b/languages/Natlab/src/natlab/tame/simplification/ThreeAddressToIR.java
@@ -590,7 +590,7 @@ public class ThreeAddressToIR extends AbstractSimplification {
     private Expr expandExpr(Expr exp,LinkedList<AssignStmt> assignments){
         if (exp == null) return null;

-        if (exp instanceof NameExpr){
+        if (exp instanceof NameExpr && !isCall(exp)){
             return (NameExpr)exp;
         } else if (exp instanceof LiteralExpr){
             TempFactory tmp = TempFactory.genFreshTempFactory();

Note I have not tested this at all beyond checking your example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants