1 /*
   2  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 package com.oracle.graal.compiler.ptx.test;
  24 
  25 import org.junit.Ignore;
  26 
  27 import com.oracle.graal.api.code.CodeCacheProvider;
  28 import com.oracle.graal.api.code.CompilationResult;
  29 import com.oracle.graal.api.code.SpeculationLog;
  30 import com.oracle.graal.api.code.TargetDescription;
  31 import com.oracle.graal.api.runtime.Graal;
  32 import com.oracle.graal.compiler.GraalCompiler;
  33 import com.oracle.graal.compiler.ptx.PTXBackend;
  34 import com.oracle.graal.compiler.ptx.test.PTXPhase;
  35 import com.oracle.graal.compiler.test.GraalCompilerTest;
  36 import com.oracle.graal.debug.Debug;
  37 import com.oracle.graal.java.GraphBuilderConfiguration;
  38 import com.oracle.graal.java.GraphBuilderPhase;
  39 import com.oracle.graal.nodes.StructuredGraph;
  40 import com.oracle.graal.phases.OptimisticOptimizations;
  41 import com.oracle.graal.phases.PhasePlan;
  42 import com.oracle.graal.phases.PhasePlan.PhasePosition;
  43 import com.oracle.graal.ptx.PTX;
  44 
  45 @Ignore
  46 public class PTXTestBase extends GraalCompilerTest {
  47     
  48     protected CompilationResult compile(String test) {
  49         StructuredGraph graph = parse(test);
  50         Debug.dump(graph, "Graph");
  51         TargetDescription target = new TargetDescription(new PTX(), true, 1, 0, true);
  52         PTXBackend ptxBackend = new PTXBackend(Graal.getRequiredCapability(CodeCacheProvider.class), target);
  53         PhasePlan phasePlan = new PhasePlan();
  54         GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.NONE);
  55         phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase);
  56         phasePlan.addPhase(PhasePosition.AFTER_PARSING, new PTXPhase());
  57         new PTXPhase().apply(graph);
  58         CompilationResult result = GraalCompiler.compileMethod(runtime, ptxBackend, target, 
  59                         graph.method(), graph, null, phasePlan, OptimisticOptimizations.NONE, new SpeculationLog());
  60         return result;
  61     }
  62 
  63 }