Package soot

Examples of soot.Type


  }

  public Set<ArrayType> create(Set<ArrayType> types){
    Set<ArrayType> ret = new HashSet<ArrayType>();
    for(ArrayType type : types){
      Type base_type = type.baseType;
      int dim = type.numDimensions;
      for(int i = dim - 1; i > 0; --i){
        ArrayType curr = ArrayType.v(base_type, i);
        if(types.contains(curr) == false){
          ret.add(curr);
View Full Code Here


    OpenCLClass ocl_class = OpenCLScene.v().getOpenCLClass(real_field.getDeclaringClass());
    return ocl_class.getName()+"_"+getName();
  }
 
  public OpenCLType getClassType(){
    Type soot_type = m_sootClass.getType();
    return new OpenCLType(soot_type);
  }
View Full Code Here

    Type soot_type = m_sootClass.getType();
    return new OpenCLType(soot_type);
  }

  public OpenCLType getType(){
    Type soot_type = m_sootField.getType();
    return new OpenCLType(soot_type);
  }
View Full Code Here

      if(decl instanceof FunctionDeclaration) {
        new FunctionCodeGenerator(this).generate((FunctionDeclaration)decl, klass);
      } else if(decl instanceof FieldDeclaration) {
        VarDecl vd = ((FieldDeclaration)decl).getVarDecl();
        String fieldName = vd.getName();
        Type fieldType = SootTypeUtil.getSootType(vd.getTypeName().getDescriptor());
        int fieldModifiers = getModifiers(decl);
        SootField sootField = new SootField(fieldName, fieldType, fieldModifiers);
        klass.addField(sootField);
      }
    }
View Full Code Here

  }
 
  /** Generate code for an array literal. */
  @Override
  public Value visitArrayLiteral(ArrayLiteral nd) {
    Type elttp = SootTypeUtil.getSootType(nd.getElement(0).type());
    // create a new array with the appropriate number of elements
    Value array = wrap(Jimple.v().newNewArrayExpr(elttp, IntConstant.v(nd.getNumElement())));
    for(int i=0;i<nd.getNumElement();++i) {
      // generate code to store the individual expressions into the elements of the array
      Value elt = wrap(nd.getElement(i).accept(this));
View Full Code Here

    // determine whether this name refers to a local or to a field
    if(decl.isLocal()) {
      return fcg.getSootLocal(decl);
    } else {
      SootClass declaringClass = fcg.getModuleCodeGenerator().getProgramCodeGenerator().getSootClass(decl.getModule());
      Type fieldType = SootTypeUtil.getSootType(decl.getTypeName().getDescriptor());
      return Jimple.v().newStaticFieldRef(Scene.v().makeFieldRef(declaringClass, decl.getName(), fieldType, true));
    }
  }
View Full Code Here

    FunctionDeclaration calleeDecl = nd.getCallTarget();
    Module calleeModule = calleeDecl.getModule();
    ArrayList<Type> parmTypes = new ArrayList<Type>(calleeDecl.getNumParameter());
    for(Parameter parm : calleeDecl.getParameters())
      parmTypes.add(SootTypeUtil.getSootType(parm.type()));
    Type rettp = SootTypeUtil.getSootType(calleeDecl.getReturnType().getDescriptor());
   
    // compute reference to callee
    SootClass calleeSootClass = fcg.getModuleCodeGenerator().getProgramCodeGenerator().getSootClass(calleeModule);
    SootMethodRef callee = Scene.v().makeMethodRef(calleeSootClass, calleeName, parmTypes, rettp, true);
   
View Full Code Here

   */
  public Local getSootLocal(VarDecl decl) {
    Local local = sootLocalMap.get(decl);
    if(local == null) {
      String varName = decl.getName();
      Type varType = SootTypeUtil.getSootType(decl.getTypeName().getDescriptor());
      local = Jimple.v().newLocal(mkTempName(varName), varType);
      body.getLocals().add(local);
      sootLocalMap.put(decl, local);
    }
    return local;
View Full Code Here

    for(Parameter parm : fn.getParameters())
      parmtps.add(SootTypeUtil.getSootType(parm.type()));
   
    // create SootMethod
    String fnName = fn.getName();
    Type fnReturnType = SootTypeUtil.getSootType(fn.getReturnType().getDescriptor());
    int fnModifiers = ModuleCodeGenerator.getModifiers(fn);
    SootMethod method = new SootMethod(fnName, parmtps, fnReturnType, fnModifiers);
    klass.addMethod(method);
   
    // create body
    body = Jimple.v().newBody(method);
    method.setActiveBody(body);
   
    // create identity statements
    int nparm = fn.getNumParameter();
    for(int i=0;i<nparm;++i) {
      Parameter parm = fn.getParameter(i);
      Local sootLocal = getSootLocal(parm);
      Type parmType = SootTypeUtil.getSootType(parm.type());
      ParameterRef soot_parm = Jimple.v().newParameterRef(parmType, i);
      body.getUnits().add(Jimple.v().newIdentityStmt(sootLocal, soot_parm));
    }   
   
    // generate code for statements
View Full Code Here

    public List<SootMethod> getTargetsOf(InstanceInvokeExpr expr) {
        Value v = expr.getBase();
       
        SootMethod m = expr.getMethod();
        SootClass rc;
        Type t = v.getType();
        List<SootMethod> targets;
        if (t instanceof NullType) {
          return Collections.emptyList();
        } else if (t instanceof ArrayType) {
            rc = Scene.v().getSootClass("java.lang.Object");
View Full Code Here

TOP

Related Classes of soot.Type

Copyright © 2018 www.massapicom. 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.