예제 #1
0
  public static Ident Var(String name, Xtype t, Xtype addrt, VarScope scope, Xobject codimensions) {
    StorageClass sclass;
    Xcode addrCode;

    if (XmOption.isLanguageC()) {
      sclass = (scope == VarScope.PARAM) ? StorageClass.PARAM : StorageClass.AUTO;
      addrCode = t.isArray() ? Xcode.ARRAY_ADDR : Xcode.VAR_ADDR;
    } else {
      sclass = (scope == VarScope.PARAM) ? StorageClass.FPARAM : StorageClass.FLOCAL;
      addrCode = Xcode.VAR;
    }

    return new Ident(name, sclass, t, Xcons.Symbol(addrCode, addrt, name), scope, codimensions);
  }
예제 #2
0
 public static Ident TempVar(int num, Xtype t) {
   if (t.isArray()) {
     t = Xtype.Pointer(t.getRef()); // convert to pointer
     return new Ident(num, t);
   } else return new Ident(num, t);
 }