Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Codegen{
- public:
- Codegen();
- void prepare(CompilerContext* cc, MemPool::Slice* mem, MemPool::Slice& tmp);
- void generate(MemPool::Slice* mem, MemPool::Slice& tmp);
- void generateNativeStubs(MemPool::Slice* mem, MemPool::Slice& tmp);
- private:
- void genHeader(FormattedWriter* writer);
- void genImpl(FormattedWriter* writer);
- void genNativeStubs(FormattedWriter* writer);
- bool writePackageNS(CUPackage* package);
- void writePackageInclPath(CUPackage* package);
- void preparePackage(CUPackage* package);
- void prepareScope(ir::FileScope* scope);
- void prepareType(ir::Type* type);
- void prepareDefinitionOwner(ir::Definition* def);
- void prepareSignature(ir::FileScope* scope, ir::Class* class_, ir::FunctionSignature* signature);
- void prepareImplVTable(ir::Class* class_);
- bool doesHaveNativeStubs();
- // codegen accesses stuff from cu, needs cu to be codegened
- void uses(ir::Definition* def);
- void uses(CompilationUnit* cu);
- void writeScopeHeader(ir::FileScope* scope);
- void writeScopeForwardDecl(ir::FileScope* scope);
- void writeScopeImpl(ir::FileScope* scope);
- void writeScopeNativeStubs(ir::FileScope* scope);
- void writeForwardDecl(ir::Definition* def);
- void visitScopeImpl(ir::FileScope* scope);
- void requireTypeImpl(ir::Type* type);
- void requireSignatureImpl(ir::FunctionSignature* signature);
- void visitClassMethodImpl(ir::ClassMethod* method);
- void visitClassFieldImpl(ir::ClassField* field);
- void requireDefinitionImpl(ir::Definition* definition);
- void writeInterfaceVTable(ir::Interface* iface);
- void writeClassVTableContents(ir::Class* owner, ir::Class* class_);
- void writeClassConstructor(ir::Class* class_);
- void writeClassVTable(ir::Class* class_);
- void writeClassInstanceFields(ir::Class* owner, ir::Class* class_);
- void writeClassStaticFields(ir::Class* class_);
- void writeClassField(ir::Class* owner, ir::ClassField* field);
- void writeClassStaticMethod(ir::ClassMethod* method);
- void writeClassInstanceMethod(ir::ClassMethod* method);
- void writeInterfaceMethod(ir::InterfaceMethod* method);
- void writeGenericProxy(ir::ClassMethod* method);
- void writeGenericProxyImpl(ir::ClassMethod* method);
- void writeTypeInfo(ir::Type* type);
- void writeInterfaceImplRef(ir::Class* class_, ir::Interface* iface);
- void writeSignature(ir::FunctionSignature* signature, bool first_arg, bool param_names);
- void writeProxyPass(ir::FunctionSignature* sginature, bool first_arg);
- void writeFrame(icode::FuncFrame* frame);
- void writeRef(ir::Definition* def);
- void writeRef(ir::ClassMethod* method);
- void writeRef(ir::ClassField* field);
- void writePrivateNS(CompilationUnit* cu);
- void writeNamespaceForScope(ir::FileScope* scope);
- void writeNamespaceForPackage(CUPackage* package);
- void writeClassConstructorImpl(ir::Class* class_);
- void writeClassNewImpl(ir::Class* class_);
- void writeClassMethodImpl(ir::ClassMethod* method);
- void writeClassStaticFieldImpl(ir::ClassField* field);
- void writeStaticInitImpl(ir::FileScope* scope);
- void writeFieldType(ir::Type* type);
- void writeParamType(ir::Type* type);
- void writeReturnType(ir::Type* type);
- void writeTypeDesignator(ir::Type* type);
- void uwrapClosurePayload(StringRef value, ir::Type* type);
- void codegenUnpackVec(ir::Type* type);
- void codegenPackVec(ir::Type* type);
- void requireStaticInitiailization(ir::Class* class_);
- void requireStaticInitiailization(ir::GlobalVar* class_);
- void codegenRunStaticInitialize(CompilationUnit* target_unit);
- void codegenPreVisitFrame(icode::FuncFrame* frame);
- void codegenDefaultValue(ir::Type* type);
- void codegenBasicBlock(icode::BasicBlock* bb, icode::BasicBlock* follower);
- void codegenPrologueBasicBlock(icode::BasicBlock* bb, icode::BasicBlock* follower);
- void codegenInstr(icode::Instr* instr, icode::BasicBlock* current_bb, icode::BasicBlock* follower);
- void codegenCmpOperator(icode::CmpOp op);
- void codegenNumOperator(icode::NumBinaryOp op);
- void codegenGoto(icode::BasicBlock* current_bb, icode::BasicBlock* bb, icode::BasicBlock* follower);
- void codegenValue(icode::Value* value);
- void codegenRegisterName(icode::Instr* instr);
- void codegenVectorEltType(ir::Type* type);
- void codegenCanonicalType(ir::Type* type);
- void codegenToAny(icode::Value* value);
- bool isAny(ir::Type* type);
- CodegenCall* codegenPrepareCall(ir::FunctionSignature* signature, ArrayRef<icode::Value*> args);
- void codegenCallParams(CodegenCall* call, ir::FunctionSignature* signature, ArrayRef<icode::Value*> args);
- StringRef mangleIdentifier(icode::LocalVar* var);
- StringRef mangleIdentifier(ir::FunctionParam* param);
- StringRef mangleIdentifier(ir::NamespaceDef* def, StringRef name);
- StringRef mangleIdentifier(ir::NamespaceDef* def, StringRef name, MangleKind kind);
- StringRef mangleIdentifier(ir::NamespaceDef* def, StringRef name, MangleKind kind, ir::Accessor accessor);
- StringRef mangleNamespace(StringRef name);
- void generateStringLiteral(icode::ConstantString* string);
- CompilerContext* cc;
- CompilationUnit* cu;
- CodegenCU* cu_codegen;
- FormattedWriter* writer;
- ir::File* IR;
- MemPool::Slice* mem;
- MemPool::Slice* tmp;
- CodegenFrame* frame;
- icode::ICodeCompiler icode_compiler;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement