Package org.trifort.rootbeer.generate.opencl.body

Examples of org.trifort.rootbeer.generate.opencl.body.OpenCLBody


    StringBuilder ret = new StringBuilder();
    if(shouldEmitBody()){
      ret.append(getMethodDecl(false)+"{\n");
      try {
        if(methodIsKernel() == false){
          OpenCLBody ocl_body = new OpenCLBody(body_method, isConstructor());
          ret.append(ocl_body.getLocals());
          if(isSynchronized()){
            ret.append(synchronizedEnter());
          }
          try {
            ret.append(ocl_body.getBodyNoLocals());
          } catch(Exception ex){
            ex.printStackTrace();
            System.out.println("soot_method: "+body_method.getSignature());
            System.exit(1);
          }
          if(isSynchronized()){
            if(isLinux()){
              ret.append("  } else {");
              ret.append("    count++;\n");
              ret.append("    if(count > 50 || (*((int *) mystery)) == 0){\n");
              ret.append("      count = 0;\n");
              ret.append("    }\n");
              ret.append("  }\n");
              ret.append("}\n");
            } else {
              ret.append("  }\n");
              ret.append("}\n");
            }
          }
        }
      } catch(RuntimeException ex){
        System.out.println("error creating method body: "+body_method.getSignature());
        OpenCLMethod ocl_method = new OpenCLMethod(body_method, body_method.getDeclaringClass());
        if(ocl_method.returnsAValue())
          ret.append("return 0;\n");
        else
          ret.append("\n");
      }
      if(returnsAValue()){
        ret.append("  return 0;\n");
      }
      ret.append("}\n");
      if(isConstructor()){
        ret.append(getMethodDecl(true)+"{\n");
        OpenCLBody ocl_body = new OpenCLBody(body_method.retrieveActiveBody());
        ret.append(ocl_body.getBody());
        ret.append("}\n");
      }
    }
    return ret.toString();
  }
View Full Code Here

TOP

Related Classes of org.trifort.rootbeer.generate.opencl.body.OpenCLBody

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.