Commit 204b1da6 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Separate the CompilerType objects from the class definitions

Most code wants to have access to the basic types (INT, STR, etc)
but doesn't need to know anything about what methods they support.

Move the commonly-accessed parts of compvars.h into the always-included
core/types.h, and remove almost all of the includes of compvars.h
parent 68a74ef9
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "analysis/fpc.h" #include "analysis/fpc.h"
#include "analysis/scoping_analysis.h" #include "analysis/scoping_analysis.h"
#include "codegen/codegen.h" #include "codegen/codegen.h"
#include "codegen/compvars.h"
#include "codegen/type_recording.h" #include "codegen/type_recording.h"
#include "core/ast.h" #include "core/ast.h"
#include "core/cfg.h" #include "core/cfg.h"
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include "codegen/compvars.h"
#include "core/types.h" #include "core/types.h"
namespace pyston { namespace pyston {
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "Python.h" #include "Python.h"
#include "codegen/compvars.h"
#include "core/threading.h" #include "core/threading.h"
#include "core/types.h" #include "core/types.h"
#include "runtime/objmodel.h" #include "runtime/objmodel.h"
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "Python.h" #include "Python.h"
#include "capi/types.h" #include "capi/types.h"
#include "codegen/compvars.h"
#include "core/threading.h" #include "core/threading.h"
#include "core/types.h" #include "core/types.h"
#include "runtime/objmodel.h" #include "runtime/objmodel.h"
......
...@@ -28,10 +28,6 @@ class OpInfo; ...@@ -28,10 +28,6 @@ class OpInfo;
class CompilerType; class CompilerType;
class IREmitter; class IREmitter;
extern ConcreteCompilerType* INT, *BOXED_INT, *LONG, *FLOAT, *BOXED_FLOAT, *VOID, *UNKNOWN, *BOOL, *STR, *NONE, *LIST,
*SLICE, *MODULE, *DICT, *BOOL, *BOXED_BOOL, *BOXED_TUPLE, *SET, *FROZENSET, *CLOSURE, *GENERATOR, *BOXED_COMPLEX;
extern CompilerType* UNDEF;
class CompilerType { class CompilerType {
public: public:
virtual ~CompilerType() {} virtual ~CompilerType() {}
...@@ -348,7 +344,6 @@ CompilerVariable* makeFunction(IREmitter& emitter, CLFunction*, CompilerVariable ...@@ -348,7 +344,6 @@ CompilerVariable* makeFunction(IREmitter& emitter, CLFunction*, CompilerVariable
ConcreteCompilerVariable* undefVariable(); ConcreteCompilerVariable* undefVariable();
CompilerVariable* makeTuple(const std::vector<CompilerVariable*>& elts); CompilerVariable* makeTuple(const std::vector<CompilerVariable*>& elts);
ConcreteCompilerType* typeFromClass(BoxedClass*);
CompilerType* typeOfClassobj(BoxedClass*); CompilerType* typeOfClassobj(BoxedClass*);
CompilerType* makeTupleType(const std::vector<CompilerType*>& elt_types); CompilerType* makeTupleType(const std::vector<CompilerType*>& elt_types);
CompilerType* makeFuncType(ConcreteCompilerType* rtn_type, const std::vector<ConcreteCompilerType*>& arg_types); CompilerType* makeFuncType(ConcreteCompilerType* rtn_type, const std::vector<ConcreteCompilerType*>& arg_types);
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include "llvm/Transforms/Utils/Cloning.h" #include "llvm/Transforms/Utils/Cloning.h"
#include "codegen/codegen.h" #include "codegen/codegen.h"
#include "codegen/compvars.h"
#include "codegen/dis.h" #include "codegen/dis.h"
#include "codegen/memmgr.h" #include "codegen/memmgr.h"
#include "codegen/profiling/profiling.h" #include "codegen/profiling/profiling.h"
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "llvm/IR/Intrinsics.h" #include "llvm/IR/Intrinsics.h"
#include "llvm/IR/IRBuilder.h" #include "llvm/IR/IRBuilder.h"
#include "codegen/compvars.h"
#include "core/types.h" #include "core/types.h"
namespace pyston { namespace pyston {
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "llvm/IR/DebugInfo.h" #include "llvm/IR/DebugInfo.h"
#include "codegen/codegen.h" #include "codegen/codegen.h"
#include "codegen/compvars.h"
#include "codegen/irgen/hooks.h" #include "codegen/irgen/hooks.h"
#include "codegen/llvm_interpreter.h" #include "codegen/llvm_interpreter.h"
......
...@@ -92,8 +92,14 @@ enum EffortLevel { ...@@ -92,8 +92,14 @@ enum EffortLevel {
}; };
} }
class CompilerType;
template <class V> class ValuedCompilerType; template <class V> class ValuedCompilerType;
typedef ValuedCompilerType<llvm::Value*> ConcreteCompilerType; typedef ValuedCompilerType<llvm::Value*> ConcreteCompilerType;
ConcreteCompilerType* typeFromClass(BoxedClass*);
extern ConcreteCompilerType* INT, *BOXED_INT, *LONG, *FLOAT, *BOXED_FLOAT, *VOID, *UNKNOWN, *BOOL, *STR, *NONE, *LIST,
*SLICE, *MODULE, *DICT, *BOOL, *BOXED_BOOL, *BOXED_TUPLE, *SET, *FROZENSET, *CLOSURE, *GENERATOR, *BOXED_COMPLEX;
extern CompilerType* UNDEF;
class CompilerVariable; class CompilerVariable;
template <class V> class ValuedCompilerVariable; template <class V> class ValuedCompilerVariable;
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "codegen/compvars.h"
#include "core/common.h" #include "core/common.h"
#include "core/types.h" #include "core/types.h"
#include "gc/collector.h" #include "gc/collector.h"
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "llvm/Support/FileSystem.h" #include "llvm/Support/FileSystem.h"
#include "codegen/compvars.h"
#include "codegen/irgen/hooks.h" #include "codegen/irgen/hooks.h"
#include "codegen/parser.h" #include "codegen/parser.h"
#include "core/ast.h" #include "core/ast.h"
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include "codegen/compvars.h"
#include "core/types.h" #include "core/types.h"
#include "gc/collector.h" #include "gc/collector.h"
#include "runtime/inline/boxing.h" #include "runtime/inline/boxing.h"
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include "codegen/compvars.h"
#include "core/types.h" #include "core/types.h"
#include "gc/collector.h" #include "gc/collector.h"
#include "runtime/inline/boxing.h" #include "runtime/inline/boxing.h"
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include <stddef.h> #include <stddef.h>
#include "codegen/compvars.h"
#include "core/threading.h" #include "core/threading.h"
#include "core/types.h" #include "core/types.h"
#include "runtime/objmodel.h" #include "runtime/objmodel.h"
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include <err.h> #include <err.h>
#include <sys/time.h> #include <sys/time.h>
#include "codegen/compvars.h"
#include "core/threading.h" #include "core/threading.h"
#include "core/types.h" #include "core/types.h"
#include "runtime/objmodel.h" #include "runtime/objmodel.h"
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include "Python.h" #include "Python.h"
#include "capi/types.h" #include "capi/types.h"
#include "codegen/compvars.h"
#include "core/threading.h" #include "core/threading.h"
#include "core/types.h" #include "core/types.h"
#include "runtime/import.h" #include "runtime/import.h"
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include <sstream> #include <sstream>
#include "codegen/compvars.h"
#include "core/types.h" #include "core/types.h"
#include "gc/collector.h" #include "gc/collector.h"
#include "runtime/objmodel.h" #include "runtime/objmodel.h"
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "runtime/complex.h" #include "runtime/complex.h"
#include "codegen/compvars.h"
#include "core/types.h" #include "core/types.h"
#include "runtime/float.h" #include "runtime/float.h"
#include "runtime/inline/boxing.h" #include "runtime/inline/boxing.h"
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "runtime/dict.h" #include "runtime/dict.h"
#include "codegen/compvars.h"
#include "core/common.h" #include "core/common.h"
#include "core/stats.h" #include "core/stats.h"
#include "core/types.h" #include "core/types.h"
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include <cstring> #include <cstring>
#include <sstream> #include <sstream>
#include "codegen/compvars.h"
#include "core/common.h" #include "core/common.h"
#include "core/stats.h" #include "core/stats.h"
#include "core/types.h" #include "core/types.h"
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>
#include "codegen/compvars.h"
#include "core/types.h" #include "core/types.h"
#include "runtime/inline/boxing.h" #include "runtime/inline/boxing.h"
#include "runtime/objmodel.h" #include "runtime/objmodel.h"
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <cstring> #include <cstring>
#include <ucontext.h> #include <ucontext.h>
#include "codegen/compvars.h"
#include "codegen/llvm_interpreter.h" #include "codegen/llvm_interpreter.h"
#include "core/ast.h" #include "core/ast.h"
#include "core/common.h" #include "core/common.h"
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "codegen/compvars.h"
#include "core/types.h" #include "core/types.h"
#include "runtime/objmodel.h" #include "runtime/objmodel.h"
#include "runtime/types.h" #include "runtime/types.h"
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include <cmath> #include <cmath>
#include <sstream> #include <sstream>
#include "codegen/compvars.h"
#include "core/common.h" #include "core/common.h"
#include "core/options.h" #include "core/options.h"
#include "core/stats.h" #include "core/stats.h"
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include <cmath> #include <cmath>
#include <sstream> #include <sstream>
#include "codegen/compvars.h"
#include "core/common.h" #include "core/common.h"
#include "core/options.h" #include "core/options.h"
#include "core/stats.h" #include "core/stats.h"
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include <cstring> #include <cstring>
#include <sstream> #include <sstream>
#include "codegen/compvars.h"
#include "core/ast.h" #include "core/ast.h"
#include "core/common.h" #include "core/common.h"
#include "core/stats.h" #include "core/stats.h"
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include <gmp.h> #include <gmp.h>
#include <sstream> #include <sstream>
#include "codegen/compvars.h"
#include "core/common.h" #include "core/common.h"
#include "core/options.h" #include "core/options.h"
#include "core/stats.h" #include "core/stats.h"
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include <sstream> #include <sstream>
#include "codegen/compvars.h"
#include "gc/collector.h" #include "gc/collector.h"
#include "runtime/objmodel.h" #include "runtime/objmodel.h"
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringRef.h"
#include "codegen/compvars.h"
#include "core/common.h" #include "core/common.h"
#include "core/types.h" #include "core/types.h"
#include "core/util.h" #include "core/util.h"
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include <sstream> #include <sstream>
#include "codegen/compvars.h"
#include "core/types.h" #include "core/types.h"
#include "gc/collector.h" #include "gc/collector.h"
#include "runtime/objmodel.h" #include "runtime/objmodel.h"
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include <sstream> #include <sstream>
#include "codegen/compvars.h"
#include "core/ast.h" #include "core/ast.h"
#include "core/common.h" #include "core/common.h"
#include "core/stats.h" #include "core/stats.h"
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <sstream> #include <sstream>
#include <stdint.h> #include <stdint.h>
#include "codegen/compvars.h"
#include "core/options.h" #include "core/options.h"
#include "core/stats.h" #include "core/stats.h"
#include "core/types.h" #include "core/types.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment