本文整理汇总了Java中natlab.tame.tir.TIRAssignLiteralStmt类的典型用法代码示例。如果您正苦于以下问题:Java TIRAssignLiteralStmt类的具体用法?Java TIRAssignLiteralStmt怎么用?Java TIRAssignLiteralStmt使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TIRAssignLiteralStmt类属于natlab.tame.tir包,在下文中一共展示了TIRAssignLiteralStmt类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleAssignLiteralStmt
import natlab.tame.tir.TIRAssignLiteralStmt; //导入依赖的package包/类
public static IntOk handleAssignLiteralStmt(TIRAssignLiteralStmt defNode) {
IntOk varIntOk = new IntOk(false, false, new ArrayList<String>());
LiteralExpr rhs = ((LiteralExpr)(((TIRAssignLiteralStmt)defNode).getRHS()));
if (rhs instanceof IntLiteralExpr){
varIntOk.setIsInt(true);
}
else if (rhs instanceof FPLiteralExpr){
double x = ((FPLiteralExpr)rhs).getValue().getValue().doubleValue();
if (debug ==true) System.out.println("I am a literal "+x);
if (Math.ceil(x) == Math.floor(x)){
varIntOk.setIsInt(true);
}
else
varIntOk.setIsInt(false);
}
return varIntOk;
}
示例2: caseTIRAssignLiteralStmt
import natlab.tame.tir.TIRAssignLiteralStmt; //导入依赖的package包/类
@Override
public void caseTIRAssignLiteralStmt(TIRAssignLiteralStmt node)
{
try
{
AssignStmt assignStmt = new AssignStmt();
TIRAssignLiteralStmt assignLiteralStmtClone = (TIRAssignLiteralStmt) node.clone();
assignStmt.setLHS(assignLiteralStmtClone.getLHS());
assignStmt.setRHS(assignLiteralStmtClone.getRHS());
fTIRToMcSAFIRTable.put(node, assignStmt);
if (DEBUG) printTableEntry(node, assignStmt);
} catch (CloneNotSupportedException e)
{
throw new RuntimeException(e);
}
}
示例3: caseTIRAssignLiteralStmt
import natlab.tame.tir.TIRAssignLiteralStmt; //导入依赖的package包/类
@Override
public void caseTIRAssignLiteralStmt(TIRAssignLiteralStmt node) {
if (checkNonViable(node)) return;
if (Debug) System.out.println("case assign literal: "+node.getPrettyPrinted());
//get literal and make constant
Constant constant = Constant.get(node.getRHS());
//put in flow map
ValueFlowMap<V> flow = getCurrentInSet();
String targetName = node.getTargetName().getID();
/*
* this comment and code below modified added by XU @ 6:36pm March 9th 2013
* this targetName can be used as a symbolic value of this target variable,
* so I passed this symbolic info to newValueSet method below.
*/
//assign result
setCurrentOutSet(assign(flow,targetName,
Res.newInstance(factory.newValueSet(targetName, constant))));
//set in/out set
associateInAndOut(node);
}
示例4: caseTIRAssignLiteralStmt
import natlab.tame.tir.TIRAssignLiteralStmt; //导入依赖的package包/类
@Override
public void caseTIRAssignLiteralStmt(TIRAssignLiteralStmt node) {
/*
* insert constant variable replacement check.
*/
String targetName = node.getTargetName().getVarName();
if (hasSingleton(targetName)
&& getMatrixValue(targetName).hasConstant()
&& !outRes.contains(targetName)
&& !inArgs.contains(targetName)
&& node.getTargetName().tmpVar) {
tempVarsBeforeF.add(targetName);
if (Debug) System.out.println(targetName
+ " has a constant value and safe to be replaced.");
}
else {
HandleCaseTIRAssignLiteralStmt assignLiteralStmt =
new HandleCaseTIRAssignLiteralStmt();
if (ifWhileForBlockNest != 0)
stmtSecForIfWhileForBlock.addStatement(
assignLiteralStmt.getFortran(this, node));
else
subprogram.getStatementSection().addStatement(
assignLiteralStmt.getFortran(this, node));
}
}
示例5: caseTIRAssignLiteralStmt
import natlab.tame.tir.TIRAssignLiteralStmt; //导入依赖的package包/类
@Override
public void caseTIRAssignLiteralStmt(TIRAssignLiteralStmt node){
/**
* insert constant variable replacement check.
*/
if(((BasicMatrixValue)(this.analysis.getNodeList().get(this.index).getAnalysis().getCurrentOutSet().
get(node.getTargetName().getVarName()).getSingleton())).isConstant()
&&(this.outRes.contains(node.getTargetName().getVarName())==false)){
if (Debug) System.out.println(node.getTargetName().getVarName()+" is a constant");
}
else{
HandleCaseTIRAssignLiteralStmt assignLiteralStmt = new HandleCaseTIRAssignLiteralStmt();
if(this.inIfWhileForBlock==true){
this.stmtSecForIfWhileForBlock.addStatement(assignLiteralStmt.getFortran(this, node));
}
else{
this.SubProgram.getStatementSection().addStatement(assignLiteralStmt.getFortran(this, node));
}
}
}
示例6: renameInDef
import natlab.tame.tir.TIRAssignLiteralStmt; //导入依赖的package包/类
private static void renameInDef(TIRNode statement, String var,
String newName) {
if (statement instanceof TIRAssignLiteralStmt) {
rename(((TIRAssignLiteralStmt) statement).getLHS(),
var, newName);
}
}
示例7: caseTIRAssignLiteralStmt
import natlab.tame.tir.TIRAssignLiteralStmt; //导入依赖的package包/类
@Override
public void caseTIRAssignLiteralStmt(TIRAssignLiteralStmt node)
{
TIRCommaSeparatedList definedVariablesNames = new TIRCommaSeparatedList(new NameExpr(node.getTargetName()));
renameDefinedVariablesForNode(definedVariablesNames, node);
}
示例8: caseTIRAssignLiteralStmt
import natlab.tame.tir.TIRAssignLiteralStmt; //导入依赖的package包/类
@Override
public void caseTIRAssignLiteralStmt(TIRAssignLiteralStmt node) {
parentForwarder.caseTIRAssignLiteralStmt(node);
}
示例9: caseTIRAssignLiteralStmt
import natlab.tame.tir.TIRAssignLiteralStmt; //导入依赖的package包/类
@Override
public void caseTIRAssignLiteralStmt(TIRAssignLiteralStmt node) {
caseTIRAbstractAssignToVarStmt(node);
}
示例10: caseTIRAssignLiteralStmt
import natlab.tame.tir.TIRAssignLiteralStmt; //导入依赖的package包/类
@Override
public void caseTIRAssignLiteralStmt(TIRAssignLiteralStmt node) {
irCallback.caseTIRAbstractAssignToVarStmt(node);
}
示例11: getFortran
import natlab.tame.tir.TIRAssignLiteralStmt; //导入依赖的package包/类
/**
* AssignLiteralStmt: Statement ::= <RuntimeAllocate> Variable <Literal>;
*/
public Statement getFortran(FortranCodeASTGenerator fcg, TIRAssignLiteralStmt node) {
if (Debug) System.out.println("in an assignLiteral statement");
AssignLiteralStmt stmt = new AssignLiteralStmt();
String indent = new String();
for (int i = 0; i < fcg.indentNum; i++) {
indent = indent + fcg.standardIndent;
}
stmt.setIndent(indent);
Variable var = new Variable();
String targetName = node.getTargetName().getVarName();
/*
* TODO need more consideration, what if the input argument is an array,
* but inside subroutine, it has been assigned a constant, this problem
* also relates to different shape var merging problem.
*/
if (fcg.hasSingleton(targetName)) {
/*
* if input argument on the LHS of assignment stmt,
* we assume that this input argument maybe modified.
*/
if (fcg.isInSubroutine && fcg.inArgs.contains(targetName)) {
if (Debug) System.out.println("subroutine's input " + targetName
+ " has been modified!");
fcg.inputHasChanged.add(targetName);
var.setName(targetName+"_copy");
}
else if (fcg.outRes.contains(targetName))
var.setName(fcg.functionName);
else
var.setName(targetName);
stmt.setVariable(var);
stmt.setLiteral(node.getRHS().getNodeString());
/*
* literal assignment target variable should be a constant, if it's not a constant,
* we need allocate it as a 1 by 1 array.
*/
@SuppressWarnings("rawtypes")
Shape targetVar= fcg.getMatrixValue(targetName).getShape();
if (!targetVar.isConstant()) {
RuntimeAllocate rtc = new RuntimeAllocate();
rtc.setBlock("ALLOCATE("+targetName+"(1, 1));");
stmt.setRuntimeAllocate(rtc);
}
}
else {
/*
* assign different type value to the same variable,
* we need to generate a derived type in Fortran for
* this variable, the fields in the derived type
* correspond to different type.
*/
if (fcg.forCellArr.keySet().contains(targetName)) {
int fieldNum = 0, i = 0;
for (BasicMatrixValue fieldValue : fcg.forCellArr.get(targetName)) {
Constant constant = Constant.get(node.getRHS());
if (fieldValue.getMatlabClass().equals(constant.getMatlabClass())
&& fieldValue.getShape().equals(constant.getShape())) {
fieldNum = i;
}
else i++;
}
var.setName(targetName+"%f"+fieldNum);
stmt.setVariable(var);
stmt.setLiteral(node.getRHS().getNodeString());
}
else {
ArrayList<BasicMatrixValue> valueList = new ArrayList<BasicMatrixValue>();
int length = fcg.getValueSet(targetName).values().toArray().length;
for (int i=0; i<length; i++) {
valueList.add((BasicMatrixValue)fcg.getValueSet(targetName).values().toArray()[i]);
}
fcg.forCellArr.put(targetName, valueList);
}
}
return stmt;
}
示例12: caseTIRAssignLiteralStmt
import natlab.tame.tir.TIRAssignLiteralStmt; //导入依赖的package包/类
public void caseTIRAssignLiteralStmt(TIRAssignLiteralStmt node);