- Timestamp:
- May 30, 2023, 5:35:57 PM (3 years ago)
- Branches:
- ast-experimental, master, stuck-waitfor-destruct
- Children:
- dd3baf4
- Parents:
- 44198fb9 (diff), 8913de4 (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. - Location:
- src
- Files:
-
- 7 edited
-
AST/Pass.impl.hpp (modified) (1 diff)
-
AST/Pass.proto.hpp (modified) (1 diff)
-
Concurrency/Waituntil.cpp (modified) (3 diffs)
-
SymTab/Autogen.h (modified) (2 diffs)
-
SymTab/GenImplicitCall.cpp (modified) (2 diffs)
-
SymTab/GenImplicitCall.hpp (modified) (2 diffs)
-
Validate/Autogen.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Pass.impl.hpp
r44198fb9 r2cb8bf71 46 46 47 47 #ifdef PEDANTIC_PASS_ASSERT 48 #define __pedantic_pass_assert(...) assert (__VA_ARGS__)48 #define __pedantic_pass_assert(...) assert(__VA_ARGS__) 49 49 #define __pedantic_pass_assertf(...) assertf(__VA_ARGS__) 50 50 #else -
src/AST/Pass.proto.hpp
r44198fb9 r2cb8bf71 27 27 28 28 #ifdef PEDANTIC_PASS_ASSERT 29 #define __pedantic_pass_assert(...) assert (__VA_ARGS__)29 #define __pedantic_pass_assert(...) assert(__VA_ARGS__) 30 30 #define __pedantic_pass_assertf(...) assertf(__VA_ARGS__) 31 31 #else -
src/Concurrency/Waituntil.cpp
r44198fb9 r2cb8bf71 940 940 } 941 941 942 // C_TODO: will remove this commented code later. Currently it isn't needed but may switch to a modified version of this later if it has better performance943 // std::vector<ptr<CaseClause>> switchCases;944 945 // int idx = 0;946 // for ( const auto & clause: stmt->clauses ) {947 // const CodeLocation & cLoc = clause->location;948 // switchCases.push_back(949 // new CaseClause( cLoc,950 // new CastExpr( cLoc,951 // new AddressExpr( cLoc, new NameExpr( cLoc, data.at(idx)->targetName ) ),952 // new BasicType( BasicType::Kind::LongUnsignedInt ), GeneratedFlag::ExplicitCast953 // ),954 // {955 // new CompoundStmt( cLoc,956 // {957 // ast::deepCopy( clause->stmt ),958 // new BranchStmt( cLoc, BranchStmt::Kind::Break, Label( cLoc ) )959 // }960 // )961 // }962 // )963 // );964 // idx++;965 // }966 967 942 return new CompoundStmt( loc, 968 943 { 969 944 new ExprStmt( loc, new UntypedExpr( loc, new NameExpr( loc, "park" ) ) ), 970 945 outerIf 971 // new SwitchStmt( loc,972 // new NameExpr( loc, statusName ),973 // std::move( switchCases )974 // )975 946 } 976 947 ); … … 1015 986 const CodeLocation & cLoc = stmt->clauses.at(idx)->location; 1016 987 988 Expr * baseCond = genSelectTraitCall( stmt->clauses.at(idx), data.at(idx), "register_select" ); 1017 989 Expr * ifCond; 1018 990 … … 1025 997 ), 1026 998 new CastExpr( cLoc, 1027 genSelectTraitCall( stmt->clauses.at(idx), data.at(idx), "register_select" ),999 baseCond, 1028 1000 new BasicType( BasicType::Kind::Bool ), GeneratedFlag::ExplicitCast 1029 1001 ), 1030 1002 LogicalFlag::AndExpr 1031 1003 ); 1032 } else ifCond = genSelectTraitCall( stmt->clauses.at(idx), data.at(idx), "register_select" );1004 } else ifCond = baseCond; 1033 1005 1034 1006 return new CompoundStmt( cLoc, -
src/SymTab/Autogen.h
r44198fb9 r2cb8bf71 20 20 #include <string> // for string 21 21 22 #include "AST/Decl.hpp"23 #include "AST/Expr.hpp"24 #include "AST/Init.hpp"25 #include "AST/Node.hpp"26 #include "AST/Stmt.hpp"27 #include "AST/Type.hpp"28 22 #include "CodeGen/OperatorTable.h" 29 23 #include "Common/UniqueName.h" // for UniqueName … … 57 51 /// maybePolymorphic is true if the resulting FunctionType is allowed to be polymorphic 58 52 FunctionType * genCopyType( Type * paramType, bool maybePolymorphic = true ); 59 60 /// Enum for loop direction61 enum LoopDirection { LoopBackward, LoopForward };62 53 63 54 /// inserts into out a generated call expression to function fname with arguments dstParam and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls. -
src/SymTab/GenImplicitCall.cpp
r44198fb9 r2cb8bf71 16 16 #include "GenImplicitCall.hpp" 17 17 18 #include "AST/Decl.hpp" // for ObjectDecl 19 #include "AST/Expr.hpp" // for ConstantExpr, UntypedExpr,... 20 #include "AST/Init.hpp" // for SingleInit 18 21 #include "AST/Inspect.hpp" // for isUnnamedBitfield 22 #include "AST/Stmt.hpp" // for ExprStmt 23 #include "AST/Type.hpp" // for ArrayType, BasicType, ... 19 24 #include "CodeGen/OperatorTable.h" // for isCtorDtor 20 25 #include "Common/UniqueName.h" // for UniqueName 21 26 22 27 namespace SymTab { 28 29 namespace { 23 30 24 31 template< typename OutIter > … … 173 180 } 174 181 182 } // namespace 183 175 184 ast::ptr< ast::Stmt > genImplicitCall( 176 185 InitTweak::InitExpander_new & srcParam, const ast::Expr * dstParam, -
src/SymTab/GenImplicitCall.hpp
r44198fb9 r2cb8bf71 17 17 18 18 #include "InitTweak/InitTweak.h" // for InitExpander 19 #include "SymTab/Autogen.h" // for LoopDirection20 19 21 20 namespace SymTab { 22 21 22 /// Enum for loop direction 23 enum LoopDirection { LoopBackward, LoopForward }; 24 25 /// Returns a generated call expression to function fname with srcParam and 26 /// dstParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls. 23 27 ast::ptr<ast::Stmt> genImplicitCall( 24 28 InitTweak::InitExpander_new & srcParam, const ast::Expr * dstParam, … … 34 38 // compile-command: "make install" // 35 39 // End: // 36 -
src/Validate/Autogen.cpp
r44198fb9 r2cb8bf71 44 44 #include "CompilationState.h" 45 45 46 // TODO: The other new ast function should be moved over to this file.47 #include "SymTab/Autogen.h"48 49 46 namespace Validate { 50 47 … … 96 93 97 94 const CodeLocation& getLocation() const { return getDecl()->location; } 98 ast::FunctionDecl * genProto( const std::string& name,95 ast::FunctionDecl * genProto( std::string&& name, 99 96 std::vector<ast::ptr<ast::DeclWithType>>&& params, 100 97 std::vector<ast::ptr<ast::DeclWithType>>&& returns ) const; … … 337 334 } 338 335 336 void replaceAll( std::vector<ast::ptr<ast::DeclWithType>> & dwts, 337 const ast::DeclReplacer::TypeMap & map ) { 338 for ( auto & dwt : dwts ) { 339 dwt = strict_dynamic_cast<const ast::DeclWithType *>( 340 ast::DeclReplacer::replace( dwt, map ) ); 341 } 342 } 343 339 344 /// Generates a basic prototype function declaration. 340 ast::FunctionDecl * FuncGenerator::genProto( const std::string& name,345 ast::FunctionDecl * FuncGenerator::genProto( std::string&& name, 341 346 std::vector<ast::ptr<ast::DeclWithType>>&& params, 342 347 std::vector<ast::ptr<ast::DeclWithType>>&& returns ) const { … … 344 349 // Handle generic prameters and assertions, if any. 345 350 auto const & old_type_params = getGenericParams( type ); 351 ast::DeclReplacer::TypeMap oldToNew; 346 352 std::vector<ast::ptr<ast::TypeDecl>> type_params; 347 353 std::vector<ast::ptr<ast::DeclWithType>> assertions; 348 354 for ( auto & old_param : old_type_params ) { 349 355 ast::TypeDecl * decl = ast::deepCopy( old_param ); 350 for ( auto assertion : decl->assertions ) { 351 assertions.push_back( assertion ); 352 } 353 decl->assertions.clear(); 356 decl->init = nullptr; 357 splice( assertions, decl->assertions ); 358 oldToNew.emplace( std::make_pair( old_param, decl ) ); 354 359 type_params.push_back( decl ); 355 360 } 356 // TODO: The values in params and returns still may point at the old357 // generic params, that does not appear to be an issue but perhaps it358 // should be addressed.361 replaceAll( params, oldToNew ); 362 replaceAll( returns, oldToNew ); 363 replaceAll( assertions, oldToNew ); 359 364 360 365 ast::FunctionDecl * decl = new ast::FunctionDecl( 361 366 // Auto-generated routines use the type declaration's location. 362 367 getLocation(), 363 name,368 std::move( name ), 364 369 std::move( type_params ), 365 370 std::move( assertions ),
Note:
See TracChangeset
for help on using the changeset viewer.