FusionCore.DSASM.AddressType getOpType(FusionCore.PrimitiveType type) { FusionCore.DSASM.AddressType optype = FusionCore.DSASM.AddressType.Int; // Data coercion for the prototype // The JIL executive handles int primitives if (FusionCore.PrimitiveType.kTypeInt == type || FusionCore.PrimitiveType.kTypeDouble == type || FusionCore.PrimitiveType.kTypeBool == type || FusionCore.PrimitiveType.kTypeChar == type || FusionCore.PrimitiveType.kTypeString == type) { optype = FusionCore.DSASM.AddressType.Int; } else if (FusionCore.PrimitiveType.kTypeVar == type) { optype = FusionCore.DSASM.AddressType.VarIndex; } else if (FusionCore.PrimitiveType.kTypeReturn == type) { optype = FusionCore.DSASM.AddressType.Register; } else { Debug.Assert(false); } return(optype); }
private void AllocateArg(string ident, int funcIndex, FusionCore.PrimitiveType datatype, int datasize = (int)FusionCore.DSASM.Constants.kPrimitiveSize) { FusionCore.DSASM.SymbolNode node = new FusionCore.DSASM.SymbolNode(); node.name = ident; node.size = datasize; node.functionIndex = funcIndex; node.datatype = datatype; node.isArgument = true; int locOffset = functions.functionList[funcIndex].localCount; // This is standard argOffset++; node.index = -2 - (locOffset + argOffset); // This is through FEP //node.index = argOffset++; symbols.Update(node); }
private void Allocate(string ident, int funcIndex, FusionCore.PrimitiveType datatype, int datasize = (int)FusionCore.DSASM.Constants.kPrimitiveSize) { FusionCore.DSASM.SymbolNode node = new FusionCore.DSASM.SymbolNode(); node.name = ident; node.size = datasize; node.functionIndex = funcIndex; node.datatype = datatype; node.isArgument = false; // TODO Jun: Shouldnt the offset increment be done upon successfully appending the symbol? if ((int)FusionCore.DSASM.Constants.kGlobalScope == funcIndex) { node.index = globOffset; globOffset += node.size; } else { node.index = -2 - baseOffset; baseOffset += node.size; } symbols.Update(node); }