Changeset 3d4b23fa for src/CodeGen


Ignore:
Timestamp:
Jul 13, 2017, 3:57:04 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
0720e049, 9a1e509
Parents:
55a68c3 (diff), d6ff3ff (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:/u/cforall/software/cfa/cfa-cc

Location:
src/CodeGen
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r55a68c3 r3d4b23fa  
    1414//
    1515
    16 #include <algorithm>
    17 #include <iostream>
    18 #include <cassert>
    19 #include <list>
    20 
    21 #include "Parser/ParseNode.h"
    22 
    23 #include "SynTree/Declaration.h"
    24 #include "SynTree/Expression.h"
    25 #include "SynTree/Initializer.h"
    26 #include "SynTree/Statement.h"
    27 #include "SynTree/Type.h"
    28 #include "SynTree/Attribute.h"
    29 
    30 #include "Common/utility.h"
    31 #include "Common/UnimplementedError.h"
     16#include <cassert>                   // for assert, assertf
     17#include <list>                      // for _List_iterator, list, list<>::it...
    3218
    3319#include "CodeGenerator.h"
    34 #include "OperatorTable.h"
    35 #include "GenType.h"
    36 
    37 #include "InitTweak/InitTweak.h"
     20#include "Common/SemanticError.h"    // for SemanticError
     21#include "Common/UniqueName.h"       // for UniqueName
     22#include "Common/utility.h"          // for CodeLocation, toString
     23#include "GenType.h"                 // for genType
     24#include "InitTweak/InitTweak.h"     // for getPointerBase
     25#include "OperatorTable.h"           // for OperatorInfo, operatorLookup
     26#include "Parser/LinkageSpec.h"      // for Spec, Intrinsic
     27#include "SynTree/Attribute.h"       // for Attribute
     28#include "SynTree/BaseSyntaxNode.h"  // for BaseSyntaxNode
     29#include "SynTree/Constant.h"        // for Constant
     30#include "SynTree/Declaration.h"     // for DeclarationWithType, TypeDecl
     31#include "SynTree/Expression.h"      // for Expression, UntypedExpr, Applica...
     32#include "SynTree/Initializer.h"     // for Initializer, ListInit, Designation
     33#include "SynTree/Label.h"           // for Label, operator<<
     34#include "SynTree/Statement.h"       // for Statement, AsmStmt, BranchStmt
     35#include "SynTree/Type.h"            // for Type, Type::StorageClasses, Func...
    3836
    3937using namespace std;
  • src/CodeGen/CodeGenerator.h

    r55a68c3 r3d4b23fa  
    1717#define CODEGENV_H
    1818
    19 #include <list>
     19#include <list>                   // for list
     20#include <ostream>                // for ostream, operator<<
     21#include <string>                 // for string
    2022
    21 #include "SynTree/Declaration.h"
    22 #include "SynTree/SynTree.h"
    23 #include "SynTree/Visitor.h"
    24 
    25 #include "SymTab/Indexer.h"
    26 
    27 #include "Common/Indenter.h"
    28 #include "Common/utility.h"
     23#include "SynTree/Declaration.h"  // for DeclarationWithType (ptr only), Fun...
     24#include "SynTree/Visitor.h"      // for Visitor
     25#include "SynTree/SynTree.h"      // for Visitor Nodes
    2926
    3027namespace CodeGen {
  • src/CodeGen/FixMain.cc

    r55a68c3 r3d4b23fa  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // FixMain.cc -- 
     7// FixMain.cc --
    88//
    99// Author           : Thierry Delisle
    1010// Created On       : Thr Jan 12 14:11:09 2017
    11 // Last Modified By : 
    12 // Last Modified On : 
     11// Last Modified By :
     12// Last Modified On :
    1313// Update Count     : 0
    1414//
    1515
    1616
    17 #include "FixMain.h"   
     17#include "FixMain.h"
    1818
    19 #include <fstream>
    20 #include <iostream>
     19#include <cassert>                 // for assert, assertf
     20#include <fstream>                 // for operator<<, basic_ostream::operator<<
     21#include <list>                    // for list
     22#include <string>                  // for operator<<
    2123
    22 #include "Common/SemanticError.h"
    23 #include "SynTree/Declaration.h"
     24#include "Common/SemanticError.h"  // for SemanticError
     25#include "SynTree/Declaration.h"   // for FunctionDecl, operator<<
     26#include "SynTree/Type.h"          // for FunctionType
    2427
    2528namespace CodeGen {
    2629        bool FixMain::replace_main = false;
    2730        std::unique_ptr<FunctionDecl> FixMain::main_signature = nullptr;
    28        
    29         void FixMain::registerMain(FunctionDecl* functionDecl) 
     31
     32        void FixMain::registerMain(FunctionDecl* functionDecl)
    3033        {
    31                 if(main_signature) { 
    32                         throw SemanticError("Multiple definition of main routine\n", functionDecl); 
     34                if(main_signature) {
     35                        throw SemanticError("Multiple definition of main routine\n", functionDecl);
    3336                }
    3437                main_signature.reset( functionDecl->clone() );
  • src/CodeGen/FixNames.cc

    r55a68c3 r3d4b23fa  
    1414//
    1515
    16 #include <memory>
     16#include "FixNames.h"
    1717
    18 #include "FixNames.h"
    19 #include "SynTree/Declaration.h"
    20 #include "SynTree/Expression.h"
    21 #include "SynTree/Visitor.h"
    22 #include "SymTab/Mangler.h"
    23 #include "OperatorTable.h"
    24 #include "FixMain.h"
     18#include <memory>                  // for unique_ptr
     19#include <string>                  // for string, operator!=, operator==
     20
     21#include "Common/SemanticError.h"  // for SemanticError
     22#include "FixMain.h"               // for FixMain
     23#include "Parser/LinkageSpec.h"    // for Cforall, isMangled
     24#include "SymTab/Mangler.h"        // for Mangler
     25#include "SynTree/Constant.h"      // for Constant
     26#include "SynTree/Declaration.h"   // for FunctionDecl, ObjectDecl, Declarat...
     27#include "SynTree/Expression.h"    // for ConstantExpr
     28#include "SynTree/Label.h"         // for Label, noLabels
     29#include "SynTree/Statement.h"     // for ReturnStmt, CompoundStmt
     30#include "SynTree/Type.h"          // for Type, BasicType, Type::Qualifiers
     31#include "SynTree/Visitor.h"       // for Visitor, acceptAll
    2532
    2633namespace CodeGen {
     
    4249                                                                                                                                   main_type = new FunctionType( Type::Qualifiers(), true ), nullptr )
    4350                                };
    44                 main_type->get_returnVals().push_back( 
     51                main_type->get_returnVals().push_back(
    4552                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    4653                );
     
    5259        std::string mangle_main_args() {
    5360                FunctionType* main_type;
    54                 std::unique_ptr<FunctionDecl> mainDecl { new FunctionDecl( "main", Type::StorageClasses(), LinkageSpec::Cforall, 
     61                std::unique_ptr<FunctionDecl> mainDecl { new FunctionDecl( "main", Type::StorageClasses(), LinkageSpec::Cforall,
    5562                                                                                                                                   main_type = new FunctionType( Type::Qualifiers(), false ), nullptr )
    5663                                };
    57                 main_type->get_returnVals().push_back( 
     64                main_type->get_returnVals().push_back(
    5865                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    5966                );
    6067
    61                 mainDecl->get_functionType()->get_parameters().push_back( 
     68                mainDecl->get_functionType()->get_parameters().push_back(
    6269                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    6370                );
    6471
    65                 mainDecl->get_functionType()->get_parameters().push_back( 
    66                         new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, 
    67                         new PointerType( Type::Qualifiers(), new PointerType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::Char ) ) ), 
     72                mainDecl->get_functionType()->get_parameters().push_back(
     73                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0,
     74                        new PointerType( Type::Qualifiers(), new PointerType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::Char ) ) ),
    6875                        nullptr )
    6976                );
     
    7582
    7683        bool is_main(const std::string& name) {
    77                 static std::string mains[] = { 
    78                         mangle_main(), 
     84                static std::string mains[] = {
     85                        mangle_main(),
    7986                        mangle_main_args()
    8087                };
     
    112119                        int nargs = functionDecl->get_functionType()->get_parameters().size();
    113120                        if( !(nargs == 0 || nargs == 2 || nargs == 3) ) {
    114                                 throw SemanticError("Main expected to have 0, 2 or 3 arguments\n", functionDecl); 
     121                                throw SemanticError("Main expected to have 0, 2 or 3 arguments\n", functionDecl);
    115122                        }
    116123                        functionDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new ConstantExpr( Constant::from_int( 0 ) ) ) );
  • src/CodeGen/FixNames.h

    r55a68c3 r3d4b23fa  
    1717#define FIXNAMES_H
    1818
    19 #include "SynTree/SynTree.h"
     19#include <list>  // for list
     20
     21class Declaration;
    2022
    2123namespace CodeGen {
  • src/CodeGen/GenType.cc

    r55a68c3 r3d4b23fa  
    1414//
    1515
    16 #include <sstream>
    17 #include <cassert>
    18 
     16#include <cassert>                // for assert, assertf
     17#include <list>                   // for _List_iterator, _List_const_iterator
     18#include <sstream>                // for operator<<, ostringstream, basic_os...
     19
     20#include "CodeGenerator.h"        // for CodeGenerator
    1921#include "GenType.h"
    20 #include "CodeGenerator.h"
    21 
    22 #include "SynTree/Declaration.h"
    23 #include "SynTree/Expression.h"
    24 #include "SynTree/Type.h"
    25 #include "SynTree/Visitor.h"
     22#include "SynTree/Declaration.h"  // for DeclarationWithType
     23#include "SynTree/Expression.h"   // for Expression
     24#include "SynTree/Type.h"         // for PointerType, Type, FunctionType
     25#include "SynTree/Visitor.h"      // for Visitor
    2626
    2727namespace CodeGen {
  • src/CodeGen/GenType.h

    r55a68c3 r3d4b23fa  
    1717#define _GENTYPE_H
    1818
    19 #include <string>
    20 #include "SynTree/SynTree.h"
     19#include <string>  // for string
     20
     21class Type;
    2122
    2223namespace CodeGen {
  • src/CodeGen/Generate.cc

    r55a68c3 r3d4b23fa  
    1414//
    1515
    16 #include <algorithm>
    17 #include <iostream>
    18 #include <cassert>
    19 #include <list>
     16#include <iostream>                  // for ostream, endl, operator<<
     17#include <list>                      // for list
     18#include <string>                    // for operator<<
    2019
     20#include "CodeGenerator.h"           // for CodeGenerator, doSemicolon, oper...
     21#include "GenType.h"                 // for genPrettyType
    2122#include "Generate.h"
    22 #include "SynTree/Declaration.h"
    23 #include "CodeGenerator.h"
    24 #include "GenType.h"
    25 #include "SynTree/SynTree.h"
    26 #include "SynTree/Type.h"
    27 #include "SynTree/BaseSyntaxNode.h"
    28 // #include "Tuples/Tuples.h"
     23#include "Parser/LinkageSpec.h"      // for isBuiltin, isGeneratable
     24#include "SynTree/BaseSyntaxNode.h"  // for BaseSyntaxNode
     25#include "SynTree/Declaration.h"     // for Declaration
     26#include "SynTree/Type.h"            // for Type
    2927
    3028using namespace std;
  • src/CodeGen/Generate.h

    r55a68c3 r3d4b23fa  
    1717#define GENERATE_H
    1818
    19 #include <list>
    20 #include <iostream>
     19#include <iostream>  // for ostream
     20#include <list>      // for list
    2121
    22 #include "SynTree/SynTree.h"
     22class BaseSyntaxNode;
     23class Declaration;
    2324
    2425namespace CodeGen {
  • src/CodeGen/OperatorTable.cc

    r55a68c3 r3d4b23fa  
    1414//
    1515
    16 #include <map>
     16#include <map>      // for map, _Rb_tree_const_iterator, map<>::const_iterator
     17#include <utility>  // for pair
     18
    1719#include "OperatorTable.h"
    1820
Note: See TracChangeset for help on using the changeset viewer.