Ejemplo n.º 1
0
        private void BuildUsedToDeclMap( )
        {
            UsedToDeclMap.Clear( );
            foreach (var used in GVarsUsed)
            {
                foreach (var v in GVarsDecl)
                {
                    if (Regex.IsMatch(used, $"^{v.Name}(_[0123456789]+)?$"))
                    {
                        UsedToDeclMap[used] = v;
                    }
                }
                if (!UsedToDeclMap.ContainsKey(used))
                {
                    var v = new GVar( )
                    {
                        Name = used,
                        Type = "void *"
                    };
                    GVarsDecl.Add(v);
                    UsedToDeclMap[used] = v;
                }
            }

            foreach (var v in GVarsDecl)
            {
                UsedToDeclMap[v.Name] = v;
            }
        }
Ejemplo n.º 2
0
 private void GetVarsDecl(List <string> gimple)
 {
     GVarsDecl.Clear( );
     foreach (var line in gimple)
     {
         if (line == "" || GBBStmt.Matches(line))
         {
             break;
         }
         string declPattern = @"\s*(?<type>.*) (?<name>\S*);";
         var    match       = Regex.Match(line, declPattern);
         var    gVar        = new GVar
         {
             Name = match.Groups["name"].Value,
             Type = match.Groups["type"].Value
         };
         GVarsDecl.Add(gVar);
     }
 }