Examples of TACInstruction


Examples of edu.cmu.cs.crystal.tac.model.TACInstruction

    }
    else {
      if(afterResult && targetInstr == this)
        return value;
      for(int i = instructions.length - 1; i >= 0; i--) {
        TACInstruction instr = instructions[i];
        if(afterResult && instr == targetInstr)
          return value;
        value = instr.transfer(tf, value);
        if(!afterResult && instr == targetInstr)
          return value;
      }
      if(!afterResult && targetInstr == this)
        return value;
View Full Code Here

Examples of edu.cmu.cs.crystal.tac.model.TACInstruction

    switch(tf.getAnalysisDirection()) {
    case FORWARD_ANALYSIS:
      if(!afterResult && targetInstr == this)
        return LabeledSingleResult.createResult(value, normalOnly);
      for(int i = 0; i < instructions.length-1; i++) {
        TACInstruction instr = instructions[i];
        if(!afterResult && instr == targetInstr)
          return LabeledSingleResult.createResult(value, normalOnly);
        IResult<LE> result = instr.transfer(tf, normalOnly, value);
        if(afterResult && instr == targetInstr)
          return result;
        value = result.get(normal);
      }
      TACInstruction last = instructions[instructions.length-1];
      if(!afterResult && last == targetInstr)
        return LabeledSingleResult.createResult(value, normalOnly);
      else if(afterResult && (last == targetInstr || this == targetInstr))
          return last.transfer(tf, labels, value);
      else
        break;
    case BACKWARD_ANALYSIS:
      if(afterResult && targetInstr == this)
        return LabeledSingleResult.createResult(value, normalOnly);
      for(int i = instructions.length-1; i > 0; i--) {
        TACInstruction instr = instructions[i];
        if(afterResult && instr == targetInstr)
          return LabeledSingleResult.createResult(value, normalOnly);
        IResult<LE> result = instr.transfer(tf, normalOnly, value);
        if(!afterResult && instr == targetInstr)
          return result;
        value = result.get(normal);
      }
      TACInstruction instr = instructions[0];
      if(afterResult && instr == targetInstr)
        return LabeledSingleResult.createResult(value, normalOnly);
      else if(!afterResult && (instr == targetInstr || this == targetInstr))
        return instr.transfer(tf, labels, value);
      else
        break;
    default:
      throw new UnsupportedOperationException("Unknown analysis direction: " + tf.getAnalysisDirection());
    }
View Full Code Here

Examples of edu.cmu.cs.crystal.tac.model.TACInstruction

  public void testOuter() throws Exception {
    CompilationUnit cu = EclipseTACSimpleTestDriver.parseCode("MainClass", MAIN);
    MethodDeclaration m = EclipseTACSimpleTestDriver.getFirstMethod(cu);
    EclipseTAC tac = new EclipseTAC(m.resolveBinding());
    ClassInstanceCreation instance = (ClassInstanceCreation) EclipseTACSimpleTestDriver.getLastStatementReturn(m).getExpression();
    TACInstruction instr = tac.instruction(instance);
    Assert.assertTrue(instr != null);
    Assert.assertTrue(instr instanceof NewObjectInstruction);
    NewObjectInstruction newobj = (NewObjectInstruction) instr;
   
    Assert.assertFalse(newobj.isAnonClassType());
View Full Code Here

Examples of edu.cmu.cs.crystal.tac.model.TACInstruction

  public void testTopLevel() throws Exception {
    CompilationUnit cu = EclipseTACSimpleTestDriver.parseCode("TopLevel", TOP_LEVEL);
    MethodDeclaration m = EclipseTACSimpleTestDriver.getFirstMethod(cu);
    EclipseTAC tac = new EclipseTAC(m.resolveBinding());
    ClassInstanceCreation instance = (ClassInstanceCreation) EclipseTACSimpleTestDriver.getLastStatementReturn(m).getExpression();
    TACInstruction instr = tac.instruction(instance);
    Assert.assertTrue(instr != null);
    Assert.assertTrue(instr instanceof NewObjectInstruction);
    NewObjectInstruction newobj = (NewObjectInstruction) instr;
   
    Assert.assertFalse(newobj.isAnonClassType());
View Full Code Here

Examples of edu.cmu.cs.crystal.tac.model.TACInstruction

  public void testInner() throws Exception {
    CompilationUnit cu = EclipseTACSimpleTestDriver.parseCode("Outer", INNER);
    MethodDeclaration m = EclipseTACSimpleTestDriver.getFirstMethod(cu);
    EclipseTAC tac = new EclipseTAC(m.resolveBinding());
    ClassInstanceCreation instance = (ClassInstanceCreation) EclipseTACSimpleTestDriver.getLastStatementReturn(m).getExpression();
    TACInstruction instr = tac.instruction(instance);
    Assert.assertTrue(instr != null);
    Assert.assertTrue(instr instanceof NewObjectInstruction);
    NewObjectInstruction newobj = (NewObjectInstruction) instr;
   
    Assert.assertFalse(newobj.isAnonClassType());
View Full Code Here

Examples of edu.cmu.cs.crystal.tac.model.TACInstruction

  public void testExplicitInner() throws Exception {
    CompilationUnit cu = EclipseTACSimpleTestDriver.parseCode("OuterExplicit", EXPLICIT_INNER);
    MethodDeclaration m = EclipseTACSimpleTestDriver.getFirstMethod(cu);
    EclipseTAC tac = new EclipseTAC(m.resolveBinding());
    ClassInstanceCreation instance = (ClassInstanceCreation) EclipseTACSimpleTestDriver.getLastStatementReturn(m).getExpression();
    TACInstruction instr = tac.instruction(instance);
    Assert.assertTrue(instr != null);
    Assert.assertTrue(instr instanceof NewObjectInstruction);
    NewObjectInstruction newobj = (NewObjectInstruction) instr;
   
    Assert.assertFalse(newobj.isAnonClassType());
View Full Code Here

Examples of edu.cmu.cs.crystal.tac.model.TACInstruction

  public void testStaticInner() throws Exception {
    CompilationUnit cu = EclipseTACSimpleTestDriver.parseCode("OuterStaticInner", STATIC_INNER);
    MethodDeclaration m = EclipseTACSimpleTestDriver.getFirstMethod(cu);
    EclipseTAC tac = new EclipseTAC(m.resolveBinding());
    ClassInstanceCreation instance = (ClassInstanceCreation) EclipseTACSimpleTestDriver.getLastStatementReturn(m).getExpression();
    TACInstruction instr = tac.instruction(instance);
    Assert.assertTrue(instr != null);
    Assert.assertTrue(instr instanceof NewObjectInstruction);
    NewObjectInstruction newobj = (NewObjectInstruction) instr;
   
    Assert.assertFalse(newobj.isAnonClassType());
View Full Code Here

Examples of edu.cmu.cs.crystal.tac.model.TACInstruction

  public void testLocal() throws Exception {
    CompilationUnit cu = EclipseTACSimpleTestDriver.parseCode("OuterLocal", LOCAL);
    MethodDeclaration m = EclipseTACSimpleTestDriver.getFirstMethod(cu);
    EclipseTAC tac = new EclipseTAC(m.resolveBinding());
    ClassInstanceCreation instance = (ClassInstanceCreation) EclipseTACSimpleTestDriver.getLastStatementReturn(m).getExpression();
    TACInstruction instr = tac.instruction(instance);
    Assert.assertTrue(instr != null);
    Assert.assertTrue(instr instanceof NewObjectInstruction);
    NewObjectInstruction newobj = (NewObjectInstruction) instr;
   
    Assert.assertFalse(newobj.isAnonClassType());
View Full Code Here

Examples of edu.cmu.cs.crystal.tac.model.TACInstruction

  public void testAnonymous() throws Exception {
    CompilationUnit cu = EclipseTACSimpleTestDriver.parseCode("OuterAnon", ANON);
    MethodDeclaration m = EclipseTACSimpleTestDriver.getFirstMethod(cu);
    EclipseTAC tac = new EclipseTAC(m.resolveBinding());
    ClassInstanceCreation instance = (ClassInstanceCreation) EclipseTACSimpleTestDriver.getLastStatementReturn(m).getExpression();
    TACInstruction instr = tac.instruction(instance);
    Assert.assertTrue(instr != null);
    Assert.assertTrue(instr instanceof NewObjectInstruction);
    NewObjectInstruction newobj = (NewObjectInstruction) instr;
   
    Assert.assertTrue(newobj.isAnonClassType());
View Full Code Here

Examples of edu.cmu.cs.crystal.tac.model.TACInstruction

      operator = BinaryOperator.SHIFT_UNSIGNED_RIGHT;
    else if(Assignment.Operator.TIMES_ASSIGN.equals(node.getOperator()))
      operator = BinaryOperator.ARIT_MULTIPLY;
    else if(Assignment.Operator.ASSIGN.equals(node.getOperator())) {
      // normal assignment
      TACInstruction store = createStore(
          node,
          node.getLeftHandSide(),
          eclipseVariableQuery.variable(node.getRightHandSide()),
          eclipseVariableQuery);
      return store;
    }
    else
      throw new IllegalArgumentException("Unknown assignment operator \"" + node.getOperator() + "\" in: " + node);

    BinaryOperation binop = new EclipseBinaryAssignOperation(
        node, operator, eclipseVariableQuery);
    TACInstruction store = createStore(
        node,
        node.getLeftHandSide(),
        binop.getTarget(),
        eclipseVariableQuery);
    return new EclipseInstructionSequence(node, new TACInstruction[] { binop, store }, 0, eclipseVariableQuery);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.