當前位置: 首頁>>代碼示例>>Java>>正文


Java StaticFunction類代碼示例

本文整理匯總了Java中natlab.tame.callgraph.StaticFunction的典型用法代碼示例。如果您正苦於以下問題:Java StaticFunction類的具體用法?Java StaticFunction怎麽用?Java StaticFunction使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


StaticFunction類屬於natlab.tame.callgraph包,在下文中一共展示了StaticFunction類的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import natlab.tame.callgraph.StaticFunction; //導入依賴的package包/類
public static void main(String args[]) {
	String fileName = "/home/sameer/interview/mclab/fft/drv_fft.m";//args[0];

	// Get the callgraph of the main function
	Callgraph<SimpleMatrixValue> callgraph = TamerTool.getCallgraph(
			new FileEnvironment(GenericFile.create(fileName)), Collections
					.singletonList(new SimpleMatrixValue(null,
							PrimitiveClassReference.DOUBLE)),
			new SimpleMatrixValueFactory());

	List<StaticFunction> functionList = callgraph.getAnalysis()
			.getFunctionCollection().getAllFunctions();

	for (StaticFunction function : functionList) {
		//TamerPlusUtils.debugMode();
		System.out.println(function.getAst().getPrettyPrinted());
		System.err.println(TransformationEngine.forAST(function.getAst())
				.getTIRToMcSAFIRWithoutTemp().getTransformedTree()
				.getPrettyPrinted());
	}
}
 
開發者ID:Sable,項目名稱:mclab-core,代碼行數:22,代碼來源:TamerPlusMain.java

示例2: runTest

import natlab.tame.callgraph.StaticFunction; //導入依賴的package包/類
public static Res<?> runTest(GenericFile testFile){        
    //load the unit test
    FileEnvironment fileEnvironment = new FileEnvironment(testFile);
    SimpleFunctionCollection functions = new SimpleFunctionCollection(fileEnvironment);
    StaticFunction aFunction = functions.getAsInlinedStaticFunction();
    IntraproceduralValueAnalysis<AggrValue<SimpleMatrixValue>> classAnalysis =
        new IntraproceduralValueAnalysis<AggrValue<SimpleMatrixValue>>(null,
            aFunction,SimpleMatrixValue.FACTORY,
            Args.<AggrValue<SimpleMatrixValue>>newInstance(new SimpleMatrixValue(PrimitiveClassReference.DOUBLE)));
    try{
        FlowAnalysisTestTool test = new FlowAnalysisTestTool(classAnalysis);
        String s = test.run(true,true);
        //System.out.println(s);
    } catch (UnsupportedOperationException e){
        System.err.println(e.getMessage());
        return Res.<AggrValue<SimpleMatrixValue>>newInstance();
    }
    System.out.println("test result for "+testFile.getName()+": "+classAnalysis.getResult());
    return classAnalysis.getResult();
}
 
開發者ID:sshrdp,項目名稱:mclab,代碼行數:21,代碼來源:Test.java

示例3: getVariableList

import natlab.tame.callgraph.StaticFunction; //導入依賴的package包/類
public static ArrayList<String> getVariableList(UDDUWeb web,
		StaticFunction function) {
	/*
	 * This is definitely an unoptimized way of doing it. Replace it with a
	 * better way. Other things: 1. Considers only those variables which are
	 * used somewhere.
	 */
	DUChain vDUChain = web.getDUChain();
	Map<String, HashSet<TIRNode>> varUses;
	ArrayList<String> varList = new ArrayList<String>();
	// Make a list of variables
	LinkedList<TIRNode> allStatements = web.getVisitedStmtsLinkedList();
	for (TIRNode statement : allStatements) {

		if (debug) {
			System.out.println("~~" + statement + "\n");
		}
		varUses = vDUChain.getUsesMapForDefinitionStmt(statement);

		if (null != varUses) {
			for (String var : varUses.keySet()) {
				// if (!function.getAst().getOutParamSet().contains(var))
				{
					// Do not rename return variable
					// if (debug)
					// System.out.println("==" + statement.toString()
					// + " defines " + var + "==");
					if (!varList.contains(var)) {
						varList.add(var);
					}
				}
			}
		}
	}

	return varList;

}
 
開發者ID:Sable,項目名稱:mclab-core,代碼行數:39,代碼來源:IntOkAnalysis.java

示例4: newFunctionAnalysis

import natlab.tame.callgraph.StaticFunction; //導入依賴的package包/類
@Override
public CallStringAnalysis newFunctionAnalysis(
        StaticFunction function,
        CallString<?> argumentSet,
        InterproceduralAnalysisNode<CallStringAnalysis, CallString<?>, CallStrings> node) {
    return new CallStringAnalysis(function,node);
}
 
開發者ID:Sable,項目名稱:mclab-core,代碼行數:8,代碼來源:CallStringAnalysis.java

示例5: CallStringAnalysis

import natlab.tame.callgraph.StaticFunction; //導入依賴的package包/類
private CallStringAnalysis(StaticFunction function,
        InterproceduralAnalysisNode<CallStringAnalysis, CallString<?>, CallStrings> node) {
    super(function.getAst());
    this.node = node;
    this.callstring = node.getCallString();
    this.function = function;
    this.result = newInitialFlow();
    result.add(callstring);
}
 
開發者ID:Sable,項目名稱:mclab-core,代碼行數:10,代碼來源:CallStringAnalysis.java

示例6: IntraproceduralValueAnalysis

import natlab.tame.callgraph.StaticFunction; //導入依賴的package包/類
public IntraproceduralValueAnalysis(InterproceduralAnalysisNode<IntraproceduralValueAnalysis<V>, Args<V>, Res<V>> node,
        StaticFunction function, ValueFactory<V> factory) {
    super(function.getAst());
    this.node = node;
    this.function = function;
    this.factory = factory;
    this.valuePropagator = factory.getValuePropagator();
    this.classRepository = node.getInterproceduralAnalysis().getFunctionCollection().getClassRepository();
}
 
開發者ID:Sable,項目名稱:mclab-core,代碼行數:10,代碼來源:IntraproceduralValueAnalysis.java

示例7: newFunctionAnalysis

import natlab.tame.callgraph.StaticFunction; //導入依賴的package包/類
public IntraproceduralLiveVariableAnalysis newFunctionAnalysis(
		StaticFunction function,
		LiveInput argumentSet,
		InterproceduralAnalysisNode<IntraproceduralLiveVariableAnalysis, LiveInput, List<LiveValue>> node) {
	return new IntraproceduralLiveVariableAnalysis(node, argumentSet);
}
 
開發者ID:Sable,項目名稱:mclab-core,代碼行數:7,代碼來源:LiveVariableAnalysis.java

示例8: getFunction

import natlab.tame.callgraph.StaticFunction; //導入依賴的package包/類
public StaticFunction getFunction() {
	return function;
}
 
開發者ID:Sable,項目名稱:mclab-core,代碼行數:4,代碼來源:InterproceduralAnalysisNode.java

示例9: newFunctionAnalysis

import natlab.tame.callgraph.StaticFunction; //導入依賴的package包/類
public F newFunctionAnalysis(
StaticFunction function, A argumentSet,
InterproceduralAnalysisNode<F, A,R> node);
 
開發者ID:Sable,項目名稱:mclab-core,代碼行數:4,代碼來源:InterproceduralAnalysisFactory.java

示例10: FileEnvironment

import natlab.tame.callgraph.StaticFunction; //導入依賴的package包/類
/**
 * tames a matlab project, by inlining all the code into one function,
 * using the tame IR, and then running the value analysis.
 * Returns an IntraproceduralValueAnalysis node, which contains
 * both the function (via getTree()), and the value flowmap associated
 * with every statement (via getInFlowSets() and getOutFlowSets(), which
 * return maps that associate flow maps with every statement).
 * 
 * The inputs are the location of the entry point (main file), and the
 * abstract values of the incoming arguments to the entry point, as a 
 * list of AggrValue<SimpleMatrixValue>, i.e. SimpleMatrixValue. One can
 * use the constructors provided by SimpleMatrixValue or SimpleMatrixValueFactory
 * to generate such abstract values. Alternatively, one can use the
 * tameMatlabToSingleFunctionFromClassReferences method, which only needs
 * the PrimitiveClassReferences of arguments.
 * 
 * This is a rough approximation of matlab, and does not support
 * recursion (do to full inlining), early returns, or overloading. There may also
 * be issues with variable names. This is intended to start playing with
 * simple Matlab projects, to get a sense on how to approach a possible backend.
 * 
 * This uses The Builtin information provided by the natlab.tame.builtin package
 */
public IntraproceduralValueAnalysis<AggrValue<SimpleMatrixValue>> 
		tameMatlabToSingleFunction(java.io.File mainFile, List<AggrValue<SimpleMatrixValue>> inputValues){
	GenericFile gFile = GenericFile.create(mainFile); //file -> generic file
	FileEnvironment env = new FileEnvironment(gFile); //get path environment obj
	SimpleFunctionCollection callgraph = new SimpleFunctionCollection(env); //build simple callgraph
	StaticFunction function = callgraph.getAsInlinedStaticFunction(); //inline all

	//build intra-analysis
	IntraproceduralValueAnalysis<AggrValue<SimpleMatrixValue>> analysis = 
			new IntraproceduralValueAnalysis<AggrValue<SimpleMatrixValue>>(
					null, function, new SimpleMatrixValueFactory(), 
					Args.<AggrValue<SimpleMatrixValue>>newInstance(inputValues));
	analysis.analyze(); //run analysis
	return analysis;
}
 
開發者ID:Sable,項目名稱:mclab-core,代碼行數:39,代碼來源:TamerTool.java

示例11: newFunctionAnalysis

import natlab.tame.callgraph.StaticFunction; //導入依賴的package包/類
public IntraproceduralValueAnalysis<V> newFunctionAnalysis(
        StaticFunction function,
        Args<V> argumentSet,
        InterproceduralAnalysisNode<IntraproceduralValueAnalysis<V>, Args<V>, Res<V>> node) {
    return new IntraproceduralValueAnalysis<V>(node,function,valueFactory,argumentSet);
}
 
開發者ID:Sable,項目名稱:mclab-core,代碼行數:7,代碼來源:ValueAnalysis.java

示例12: getFunction

import natlab.tame.callgraph.StaticFunction; //導入依賴的package包/類
public StaticFunction getFunction(){
    return function;
}
 
開發者ID:sshrdp,項目名稱:mclab,代碼行數:4,代碼來源:InterproceduralAnalysisNode.java


注:本文中的natlab.tame.callgraph.StaticFunction類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。