#include <stdint.h>#include <stdlib.h>#include <dirent.h>#include <fstream>#include <iostream>#include <string>#include <sstream>#include <gmp.h>#include <errno.h>#include <assert.h>#include "Version.hxx"#include "UocInfo.hxx"#include "Options.hxx"#include "AST.hxx"#include "Type.hxx"#include "TypeInfer.hxx"#include "inter-pass.hxx"#include "Special.hxx"Go to the source code of this file.
Defines | |
| #define | STRICTLYEQUALS(x) strictlyCompatible(x) |
| #define | DEBUG if(0) |
| #define | NAMKARAN(ast, name) |
Functions | |
| static bool | reRandT (std::ostream &errStream, UocInfo *uoc, AST *ast) |
| static bool | reRandT (std::ostream &errStream, UocInfo *uoc, unsigned long rFlags=POLY_SYM_FLAGS, unsigned long tFlags=POLY_TYP_FLAGS, std::string mess="FINAL Polyinstantiation (s):\n") |
| static bool | removeAndReRandT (std::ostream &errStream, UocInfo *uoc, AST *ast) |
| void | sub (AST *ast, AST *tv, AST *newAst, Type *typ, AST *parent, size_t chno) |
| static void | substitute (AST *ast, AST *from, AST *to) |
| static void | add_todo (std::ostream &errStream, CVector< AST * > &todo, AST *copy) |
| void | add_relevant_items_todo (std::ostream &errStream, CVector< AST * > &todo, AST *ast) |
| static void | markReached (std::ostream &out, AST *ast) |
| static void | unmarkReached (std::ostream &out, AST *ast) |
| std::string | getNewName (AST *def, Type *typ) |
| void | clearConstraints (AST *ast, AST *parent=NULL, size_t chno=0) |
| AST * | Specialize (std::ostream &errStream, bool &errF, UocInfo *uoc, AST *def, Type *typ, AST *mod, CVector< AST * > &todo) |
| static bool | lbMustNotSurvive (const AST *lb) |
| static void | setupTypApp (AST *ast) |
| bool | polyinst (std::ostream &errStream, UocInfo *uoc, AST *ast, AST *mod, CVector< AST * > &todo) |
| void | getLetintoLetStream (std::ostream &errStream, AST *ast) |
| void | getValuesIntoMainStream (std::ostream &errStream, AST *mod) |
| void | getTypesIntoMainStream (std::ostream &errStream, AST *mod) |
| void | getIntoMainStream (std::ostream &errStream, AST *mod) |
| void | removeUnreached (AST *mod) |
| void | addType (AST *def, AST *mod, CVector< AST * > &deps) |
| void | addCompType (AST *ast, AST *mod, CVector< AST * > &deps) |
| void | moveTypesUp (AST *start) |
| bool | checkInfTypedValues (AST *ast, std::ostream &errStream) |
| void | mangleIDs (AST *ast) |
| static void | proclaimsAboveDefs (AST *ast) |
| #define DEBUG if(0) |
Definition at line 70 of file Polyinst.cxx.
| #define NAMKARAN | ( | ast, | |||
| name | ) |
Value:
do { \ ast->s = name; \ ast->Flags2 |= IDENT_MANGLED; \ } while(0);
Definition at line 154 of file Polyinst.cxx.
| #define STRICTLYEQUALS | ( | x | ) | strictlyCompatible(x) |
Definition at line 69 of file Polyinst.cxx.
Definition at line 182 of file Polyinst.cxx.
References add_todo(), assert(), AST::astType, at_declstruct, at_declunion, at_defexception, at_define, at_defstruct, at_defunion, at_letbinding, at_proclaim, and AST::children.
Referenced by polyinst(), and Specialize().
| static void add_todo | ( | std::ostream & | errStream, | |
| CVector< AST * > & | todo, | |||
| AST * | copy | |||
| ) | [inline, static] |
Definition at line 173 of file Polyinst.cxx.
References AST::asString(), and DEBUG.
Referenced by add_relevant_items_todo(), and polyinst().
Definition at line 1116 of file Polyinst.cxx.
References addType(), AST::astType, at_ident, AST::children, AST::defForm, and AST::symbolDef.
Referenced by addType().
Definition at line 1135 of file Polyinst.cxx.
References addCompType(), assert(), at_defexception, at_defstruct, at_defunion, and AST::children.
Referenced by addCompType(), and moveTypesUp().
| bool checkInfTypedValues | ( | AST * | ast, | |
| std::ostream & | errStream | |||
| ) |
Definition at line 1241 of file Polyinst.cxx.
References AST::astType, at_declstruct, at_declunion, at_defexception, at_define, at_defstruct, at_defunion, at_field, at_ident, at_proclaim, at_select, BE_CHKERR, AST::children, AST::loc, and AST::symType.
Definition at line 260 of file Polyinst.cxx.
References assert(), AST::astType, at_constraints, at_qualType, AST::children, and clearConstraints().
| void getIntoMainStream | ( | std::ostream & | errStream, | |
| AST * | mod | |||
| ) |
Definition at line 1081 of file Polyinst.cxx.
References getTypesIntoMainStream(), and getValuesIntoMainStream().
| void getLetintoLetStream | ( | std::ostream & | errStream, | |
| AST * | ast | |||
| ) |
Definition at line 927 of file Polyinst.cxx.
References assert(), AST::astType, at_let, at_letbinding, at_letbindings, at_letrec, AST::children, and lbs.
Referenced by getValuesIntoMainStream().
Definition at line 244 of file Polyinst.cxx.
References assert(), Type::getUnionType(), Type::isUcon(), Type::isUval(), Type::mangledString(), and AST::s.
Referenced by Specialize().
| void getTypesIntoMainStream | ( | std::ostream & | errStream, | |
| AST * | mod | |||
| ) |
Definition at line 1038 of file Polyinst.cxx.
References assert(), at_declstruct, at_declunion, at_defexception, at_define, at_definstance, at_defstruct, at_deftypeclass, at_defunion, at_proclaim, AST::children, markReached(), and unmarkReached().
Referenced by getIntoMainStream().
| void getValuesIntoMainStream | ( | std::ostream & | errStream, | |
| AST * | mod | |||
| ) |
Definition at line 979 of file Polyinst.cxx.
References assert(), AST::astType, at_declstruct, at_declunion, at_defexception, at_define, at_definstance, at_defstruct, at_deftypeclass, at_defunion, at_proclaim, AST::children, DEF_IS_EXTERNAL, getLetintoLetStream(), markReached(), AST::symType, and unmarkReached().
Referenced by getIntoMainStream().
| static bool lbMustNotSurvive | ( | const AST * | lb | ) | [static] |
Definition at line 683 of file Polyinst.cxx.
References assert(), AST::astType, at_letbinding, AST::children, and AST::symType.
Referenced by polyinst().
| void mangleIDs | ( | AST * | ast | ) |
Definition at line 1315 of file Polyinst.cxx.
References AST::astType, at_declares, at_ident, AST::children, and AST::s.
| static void markReached | ( | std::ostream & | out, | |
| AST * | ast | |||
| ) | [inline, static] |
Definition at line 229 of file Polyinst.cxx.
Referenced by getTypesIntoMainStream(), getValuesIntoMainStream(), polyinst(), and Specialize().
| void moveTypesUp | ( | AST * | start | ) |
Definition at line 1162 of file Polyinst.cxx.
References addType(), assert(), at_declstruct, at_declunion, at_defexception, at_define, at_defstruct, at_defunion, at_module, at_proclaim, AST::children, and AST::loc.
| bool polyinst | ( | std::ostream & | errStream, | |
| UocInfo * | uoc, | |||
| AST * | ast, | |||
| AST * | mod, | |||
| CVector< AST * > & | todo | |||
| ) |
Definition at line 713 of file Polyinst.cxx.
References add_relevant_items_todo(), add_todo(), assert(), AST::asString(), AST::astType, at_arrayType, at_declare, at_definstance, at_deftypeclass, at_field, at_floatLiteral, at_ident, at_interface, at_intLiteral, at_let, at_letbinding, at_letrec, at_letStar, at_module, at_select, at_typeapp, AST::atKwd(), BE_CHKERR, AST::children, DEBUG, AST::defForm, AST::defn, AST::isDecl, AST::isGlobal(), AST::isUnionLeg(), lbMustNotSurvive(), AST::loc, markReached(), NAMKARAN, AST::s, setupTypApp(), Specialize(), AST::symbolDef, AST::symType, and uoc.
| static void proclaimsAboveDefs | ( | AST * | ast | ) | [static] |
Definition at line 1337 of file Polyinst.cxx.
References assert(), AST::astType, at_declstruct, at_declunion, at_defexception, at_define, at_defstruct, at_defunion, at_module, at_proclaim, AST::children, AST::getID(), and AST::loc.
Definition at line 111 of file Polyinst.cxx.
References assert(), AST::getID(), nm, reRandT(), and uoc.
Referenced by Specialize().
| void removeUnreached | ( | AST * | mod | ) |
Definition at line 1088 of file Polyinst.cxx.
References AST::astType, at_definstance, at_deftypeclass, at_interface, and AST::children.
Definition at line 74 of file Polyinst.cxx.
References AST::asString(), DEBUG, POLY_SYM_FLAGS, POLY_TYP_FLAGS, and uoc.
| static void setupTypApp | ( | AST * | ast | ) | [static] |
Definition at line 702 of file Polyinst.cxx.
References AST::loc, and AST::symType.
Referenced by polyinst().
| AST* Specialize | ( | std::ostream & | errStream, | |
| bool & | errF, | |||
| UocInfo * | uoc, | |||
| AST * | def, | |||
| Type * | typ, | |||
| AST * | mod, | |||
| CVector< AST * > & | todo | |||
| ) |
Definition at line 281 of file Polyinst.cxx.
References add_relevant_items_todo(), Type::asAST(), assert(), AST::asString(), Type::asString(), AST::astType, at_declstruct, at_declunion, at_defexception, at_define, at_defstruct, at_defunion, at_fill, at_ident, at_identPattern, at_letbinding, at_letbindings, at_proclaim, BE_CHKERR, AST::children, clearConstraints(), Type::components, ctr, DEBUG, AST::decl, AST::defForm, AST::defn, AST::getID(), getNewName(), Type::getTheType(), Type::getUnionType(), Type::isConcrete(), AST::isDecl, AST::isUnionLeg(), lbs, AST::loc, markReached(), NAMKARAN, removeAndReRandT(), reRandT(), AST::s, sub(), substitute(), AST::symbolDef, AST::symType, top(), tvlist, Type::typeArgs, and uoc.
Referenced by polyinst().
Definition at line 138 of file Polyinst.cxx.
References Type::asAST(), assert(), AST::astType, at_ident, AST::children, AST::loc, and AST::symbolDef.
Referenced by addSubCst(), and Specialize().
Definition at line 160 of file Polyinst.cxx.
References AST::astType, at_ident, AST::children, NAMKARAN, AST::s, substitute(), and AST::symbolDef.
| static void unmarkReached | ( | std::ostream & | out, | |
| AST * | ast | |||
| ) | [inline, static] |
Definition at line 236 of file Polyinst.cxx.
Referenced by getTypesIntoMainStream(), and getValuesIntoMainStream().
1.4.7