Exemple #1
0
        public string ParseInstruction()
        {
            StringBuilder sb = new StringBuilder("\t");

            sb.Append(LRefHelper.GetIdentifierOf(Result)).Append(" = ").Append(LKeywords.Zext);
            sb.Append(Value.ParseType()).Append(" ").Append(LRefHelper.GetValueOrIdentifierOf(Value));
            sb.Append(" ").Append(LKeywords.To).Append(" ").Append(Result.ParseType());
            return(sb.ToString());
        }
Exemple #2
0
        public LPointerRef(LBaseRef parentRef)
        {
            string identifier = LRefHelper.GetIdentifierOf(parentRef);

            if (String.IsNullOrEmpty(identifier))
            {
                throw new Exception("Parent references which don't use any identifier are not valid.");
            }

            Identifier = identifier;
            ParentRef  = parentRef;
        }
Exemple #3
0
        public string ParseInstruction()
        {
            StringBuilder sb = new StringBuilder("\t");

            sb.Append(LRefHelper.GetIdentifierOf(Result));
            sb.Append(" = ").Append(LKeywords.Icmp).Append(" ");
            sb.Append(Condition.Parse()).Append(" ");
            sb.Append(Result.ParseType()).Append(" ");
            sb.Append(LRefHelper.GetValueOrIdentifierOf(Op1)).Append(", ");
            sb.Append(LRefHelper.GetValueOrIdentifierOf(Op2));
            return(sb.ToString());
        }
Exemple #4
0
        public string ParseInstruction()
        {
            if (RetValue.IsValue() && RetValue.BaseType.IsPrimitiveType() &&
                RetValue.BaseType.CheckedCast <LPrimitiveType>().Type == LPrimitiveTypes.@void)
            {
                return($"\t{LKeywords.Ret} {LKeywords.Void}");
            }

            StringBuilder sb = new StringBuilder("\t");

            sb.Append(LKeywords.Ret).Append(" ");
            sb.Append(RetValue.ParseType()).Append(" ").Append(LRefHelper.GetValueOrIdentifierOf(RetValue));
            return(sb.ToString());
        }
Exemple #5
0
        public string ParseInstruction()
        {
            StringBuilder sb = new StringBuilder("\t");

            sb.Append(LRefHelper.GetIdentifierOf(FnType.ReturnType)).Append(" ");
            sb.Append(" = ").Append(LKeywords.Call).Append(" ");
            sb.Append(FnType.Parse()).Append(" ");
            sb.Append(FnIdentifier).Append("(");

            for (int i = 0; i < FnType.Parameters.Length; ++i)
            {
                if (i > 0)
                {
                    sb.Append(", ");
                }
                sb.Append(FnType.Parameters[i].ParseType()).Append(" ");
                sb.Append(LRefHelper.GetValueOrIdentifierOf(FnType.Parameters[i]));
            }
            sb.Append(")");

            return(sb.ToString());
        }