annotate ir/irfunction.h @ 883:b52d5de7783f

GC defines and linkage changes.
author Christian Kamm <kamm incasoftware de>
date Thu, 08 Jan 2009 18:20:02 +0100
parents eef8ac26c66c
children 2ebac4750adb
rev   line source
kamm@664 1 #ifndef LDC_IR_IRFUNCTION_H
kamm@664 2 #define LDC_IR_IRFUNCTION_H
lindquist@136 3
lindquist@136 4 #include "ir/ir.h"
ChristianK@319 5 #include "ir/irlandingpad.h"
lindquist@136 6
lindquist@136 7 #include <vector>
ChristianK@355 8 #include <stack>
ChristianK@355 9 #include <map>
lindquist@136 10
lindquist@136 11 // represents a function
lindquist@136 12 struct IrFunction : IrBase
lindquist@136 13 {
lindquist@136 14 llvm::Function* func;
lindquist@136 15 llvm::Instruction* allocapoint;
lindquist@136 16 FuncDeclaration* decl;
lindquist@136 17 TypeFunction* type;
lindquist@136 18
lindquist@136 19 bool queued;
lindquist@136 20 bool defined;
tomas@486 21
tomas@486 22 llvm::Value* retArg; // return in ptr arg
tomas@486 23 llvm::Value* thisArg; // class/struct 'this' arg
tomas@486 24 llvm::Value* nestArg; // nested function 'this' arg
tomas@486 25
tomas@486 26 llvm::Value* nestedVar; // nested var alloca
tomas@486 27
lindquist@136 28 llvm::Value* _arguments;
lindquist@136 29 llvm::Value* _argptr;
tomas@486 30
lindquist@136 31 llvm::Constant* dwarfSubProg;
lindquist@136 32
lindquist@203 33 llvm::AllocaInst* srcfileArg;
lindquist@207 34 llvm::AllocaInst* msgArg;
lindquist@203 35
ChristianK@355 36 // pushes a unique label scope of the given name
ChristianK@355 37 void pushUniqueLabelScope(const char* name);
ChristianK@355 38 // pops a label scope
ChristianK@355 39 void popLabelScope();
ChristianK@355 40
ChristianK@355 41 // gets the string under which the label's BB
ChristianK@355 42 // is stored in the labelToBB map.
ChristianK@355 43 // essentially prefixes ident by the strings in labelScopes
ChristianK@355 44 std::string getScopedLabelName(const char* ident);
ChristianK@355 45
ChristianK@353 46 // label to basic block lookup
ChristianK@353 47 typedef std::map<std::string, llvm::BasicBlock*> LabelToBBMap;
ChristianK@353 48 LabelToBBMap labelToBB;
ChristianK@353 49
ChristianK@319 50 // landing pads for try statements
ChristianK@319 51 IRLandingPad landingPad;
ChristianK@319 52
lindquist@136 53 IrFunction(FuncDeclaration* fd);
ChristianK@355 54
kamm@584 55 // annotations
kamm@584 56 void setNeverInline();
kamm@584 57 void setAlwaysInline();
kamm@584 58
ChristianK@355 59 private:
ChristianK@355 60 // prefix for labels and gotos
ChristianK@355 61 // used for allowing labels to be emitted twice
ChristianK@355 62 std::vector<std::string> labelScopes;
ChristianK@355 63
ChristianK@355 64 // next unique id stack
ChristianK@355 65 std::stack<int> nextUnique;
lindquist@136 66 };
lindquist@136 67
lindquist@136 68 #endif