This machine mirrors various open-source projects.
20 Gbit/s uplink.
If there are any issues or you want another project mirrored, please contact
mirror-service -=AT=- netcologne DOT de !
#include <CodeGen.h>
Public Member Functions | |
~CodeGen () | |
CommaRT & | getRuntime () const |
Returns the interface to the runtime system. | |
llvm::Module * | getModule () |
Returns the module we are generating code for. | |
llvm::Constant * | getModuleName () |
Returns an i8* pointing the the name of this module. | |
const llvm::TargetData & | getTargetData () const |
Returns the llvm::TargetData used to generate code. | |
AstResource & | getAstResource () const |
Returns the AstResource used to generate new AST nodes. | |
llvm::LLVMContext & | getLLVMContext () const |
Returns the LLVMContext associated with this code generator. | |
bool | extendWorklist (DomainInstanceDecl *instace) |
Inserts the given instance into the work list. | |
InstanceInfo * | lookupInstanceInfo (const DomainInstanceDecl *instance) const |
InstanceInfo * | getInstanceInfo (const DomainInstanceDecl *instance) const |
SRInfo * | getSRInfo (DomainInstanceDecl *instance, SubroutineDecl *srDecl) |
Returns the SRInfo object associated with srDecl . | |
const DependencySet & | getDependencySet (const Domoid *domoid) |
FIXME: This method needs to be encapsulated in a seperate structure. | |
bool | insertGlobal (const std::string &linkName, llvm::GlobalValue *GV) |
Adds a mapping between the given link name and an LLVM GlobalValue into the global table. | |
llvm::GlobalValue * | lookupGlobal (const std::string &linkName) const |
Returns an llvm value for a previously declared decl with the given link (mangled) name, or null if no such declaration exists. | |
llvm::GlobalValue * | lookupCapsuleInfo (const Domoid *domoid) const |
Returns an llvm value representing the static compile time info representing a previously declared capsule, or null if no such information is present. | |
llvm::GlobalVariable * | emitInternString (const llvm::StringRef &elems, bool addNull=true, bool isConstant=true, const std::string &name="") |
Emits a string with internal linkage, returning the global variable for the associated data. If addNull is true, emit as a null terminated string. | |
llvm::BasicBlock * | makeBasicBlock (const std::string &name="", llvm::Function *parent=0, llvm::BasicBlock *insertBefore=0) const |
Returns an llvm basic block. | |
llvm::GlobalVariable * | makeExternGlobal (llvm::Constant *init, bool isConstant=false, const std::string &name="") |
Returns a global variable with external linkage embedded in the current module. | |
llvm::GlobalVariable * | makeInternGlobal (llvm::Constant *init, bool isConstant=false, const std::string &name="") |
Returns a global variable with internal linkage embedded in the current module. | |
llvm::Function * | makeFunction (const llvm::FunctionType *Ty, const std::string &name="") |
Creates a function with the given name and type. The linkage type is external. | |
llvm::Function * | makeFunction (const DomainInstanceDecl *instance, const SubroutineDecl *srDecl, CodeGenTypes &CGT) |
Creates a function corresponding to the given Comma subroutine declaration. | |
llvm::Function * | makeInternFunction (const llvm::FunctionType *Ty, const std::string &name="") |
Creates a function with the given name and type. The linkage type is internal. | |
llvm::Function * | getLLVMIntrinsic (llvm::Intrinsic::ID id) const |
llvm::Function * | getMemcpy64 () const |
Returns a function declaration for the llvm.memcpy.i64 intrinsic. | |
llvm::Function * | getMemcpy32 () const |
Returns a function declaration for the llvm.memcpy.i32 intrinsic. | |
llvm::Function * | getMemset32 () const |
Returns a function declaration for the llvm.memset.i32 intrinsic. | |
const llvm::OpaqueType * | getOpaqueTy () const |
Returns an llvm "opaque" type. | |
const llvm::PointerType * | getInt8PtrTy () const |
Returns the llvm type i8*. | |
const llvm::Type * | getVoidTy () const |
Returns the llvm type "void". | |
const llvm::IntegerType * | getInt1Ty () const |
Returns the llvm type "i1". | |
const llvm::IntegerType * | getInt8Ty () const |
Returns the llvm type "i8". | |
const llvm::IntegerType * | getInt16Ty () const |
Returns the llvm type "i16". | |
const llvm::IntegerType * | getInt32Ty () const |
Returns the llvm type "i32". | |
const llvm::IntegerType * | getInt64Ty () const |
Returns the llvm type "i64". | |
const llvm::IntegerType * | getIntPtrTy () const |
Returns a integer type capable of representing a pointer. | |
llvm::Constant * | getNullPointer (const llvm::PointerType *Ty) const |
Returns a null pointer constant of the specified type. | |
llvm::PointerType * | getPointerType (const llvm::Type *Ty) const |
Returns a pointer-to the given type. | |
llvm::ConstantInt * | getConstantInt (const llvm::IntegerType *type, uint64_t value) const |
Returns a constant integer. | |
llvm::ConstantInt * | getConstantInt (const llvm::IntegerType *type, const llvm::APInt &value) const |
llvm::Constant * | getConstantArray (const llvm::Type *elementType, std::vector< llvm::Constant * > &elems) const |
Returns a constant array consiting of the given elements, each of which must be of the supplied type. | |
llvm::Constant * | getPointerCast (llvm::Constant *constant, const llvm::PointerType *Ty) const |
Casts the given constant expression into the given pointer type. | |
llvm::StructType * | getStructTy (const std::vector< const llvm::Type * > &elts, bool isPacked=false) const |
Returns an llvm structure type. | |
llvm::ArrayType * | getVLArrayTy (const llvm::Type *componentTy) const |
Returns a variable length array type. | |
Accessors to the llvm exception intrinsics. | |
llvm::Function * | getEHExceptionIntrinsic () const |
llvm::Function * | getEHSelectorIntrinsic () const |
llvm::Function * | getEHTypeidIntrinsic () const |
Location helpers. | |
SourceLocation | getSourceLocation (Location loc) |
llvm::ConstantInt * | getSourceLine (Location loc) |
Returns the line of the given location as an i32. | |
llvm::ConstantInt * | getSourceColumn (Location loc) |
Returns the column of the given location is an i32. | |
Friends | |
class | Generator |
Definition at line 30 of file CodeGen.h.
CodeGen::~CodeGen | ( | ) |
Definition at line 34 of file CodeGen.cpp.
llvm::GlobalVariable * CodeGen::emitInternString | ( | const llvm::StringRef & | elems, | |
bool | addNull = true , |
|||
bool | isConstant = true , |
|||
const std::string & | name = "" | |||
) |
Emits a string with internal linkage, returning the global variable for the associated data. If addNull is true, emit as a null terminated string.
Definition at line 278 of file CodeGen.cpp.
bool CodeGen::extendWorklist | ( | DomainInstanceDecl * | instace | ) |
Inserts the given instance into the work list.
The given instance must not be dependent (meaning that DomainInstanceDecl::isDependent must return false).
When an instance is inserted into the worklist, a few actions take place. First, the instance is schedualed for codegen, meaning that specializations of that instances subroutines will be emmited into the current module. Second, forward declarations are created for each of the instances subroutines. These declarations are accessible thru the lookupGlobal method using the appropriately mangled name.
Definition at line 231 of file CodeGen.cpp.
AstResource& comma::CodeGen::getAstResource | ( | ) | const [inline] |
Returns the AstResource used to generate new AST nodes.
llvm::Constant* comma::CodeGen::getConstantArray | ( | const llvm::Type * | elementType, | |
std::vector< llvm::Constant * > & | elems | |||
) | const [inline] |
llvm::ConstantInt * CodeGen::getConstantInt | ( | const llvm::IntegerType * | type, | |
const llvm::APInt & | value | |||
) | const |
Returns a ConstantInt for the given value.
This method ensures that the given APInt is within the representational limits of the given type. If the bit width of the supplied APInt does not match that of the given type, then the active bits of the value (interpreted as a signed integer) are used, sign extended to the width of the type. An assertion will fire if the number of active bits exceeds the width of the supplied type.
Definition at line 351 of file CodeGen.cpp.
llvm::ConstantInt* comma::CodeGen::getConstantInt | ( | const llvm::IntegerType * | type, | |
uint64_t | value | |||
) | const [inline] |
const DependencySet & CodeGen::getDependencySet | ( | const Domoid * | domoid | ) |
FIXME: This method needs to be encapsulated in a seperate structure.
Definition at line 378 of file CodeGen.cpp.
llvm::Function * CodeGen::getEHExceptionIntrinsic | ( | ) | const |
Definition at line 177 of file CodeGen.cpp.
llvm::Function * CodeGen::getEHSelectorIntrinsic | ( | ) | const |
Definition at line 182 of file CodeGen.cpp.
llvm::Function * CodeGen::getEHTypeidIntrinsic | ( | ) | const |
Definition at line 190 of file CodeGen.cpp.
InstanceInfo* comma::CodeGen::getInstanceInfo | ( | const DomainInstanceDecl * | instance | ) | const [inline] |
const llvm::IntegerType* comma::CodeGen::getInt16Ty | ( | ) | const [inline] |
const llvm::IntegerType* comma::CodeGen::getInt1Ty | ( | ) | const [inline] |
const llvm::IntegerType* comma::CodeGen::getInt32Ty | ( | ) | const [inline] |
const llvm::IntegerType* comma::CodeGen::getInt64Ty | ( | ) | const [inline] |
const llvm::PointerType* comma::CodeGen::getInt8PtrTy | ( | ) | const [inline] |
const llvm::IntegerType* comma::CodeGen::getInt8Ty | ( | ) | const [inline] |
const llvm::IntegerType* comma::CodeGen::getIntPtrTy | ( | ) | const [inline] |
llvm::LLVMContext& comma::CodeGen::getLLVMContext | ( | ) | const [inline] |
llvm::Function* comma::CodeGen::getLLVMIntrinsic | ( | llvm::Intrinsic::ID | id | ) | const [inline] |
llvm::Function * CodeGen::getMemcpy32 | ( | ) | const |
Returns a function declaration for the llvm.memcpy.i32 intrinsic.
Definition at line 165 of file CodeGen.cpp.
llvm::Function * CodeGen::getMemcpy64 | ( | ) | const |
Returns a function declaration for the llvm.memcpy.i64 intrinsic.
Definition at line 159 of file CodeGen.cpp.
llvm::Function * CodeGen::getMemset32 | ( | ) | const |
Returns a function declaration for the llvm.memset.i32 intrinsic.
Definition at line 171 of file CodeGen.cpp.
llvm::Module* comma::CodeGen::getModule | ( | ) | [inline] |
llvm::Constant * CodeGen::getModuleName | ( | ) |
Returns an i8* pointing the the name of this module.
Definition at line 390 of file CodeGen.cpp.
llvm::Constant* comma::CodeGen::getNullPointer | ( | const llvm::PointerType * | Ty | ) | const [inline] |
const llvm::OpaqueType* comma::CodeGen::getOpaqueTy | ( | ) | const [inline] |
llvm::Constant* comma::CodeGen::getPointerCast | ( | llvm::Constant * | constant, | |
const llvm::PointerType * | Ty | |||
) | const [inline] |
llvm::PointerType* comma::CodeGen::getPointerType | ( | const llvm::Type * | Ty | ) | const [inline] |
CommaRT& comma::CodeGen::getRuntime | ( | ) | const [inline] |
llvm::ConstantInt* comma::CodeGen::getSourceColumn | ( | Location | loc | ) | [inline] |
llvm::ConstantInt* comma::CodeGen::getSourceLine | ( | Location | loc | ) | [inline] |
SourceLocation CodeGen::getSourceLocation | ( | Location | loc | ) |
Returns the detailed source location object corresponding to the given raw location.
Definition at line 401 of file CodeGen.cpp.
SRInfo * CodeGen::getSRInfo | ( | DomainInstanceDecl * | instance, | |
SubroutineDecl * | srDecl | |||
) |
Returns the SRInfo object associated with srDecl
.
The given instance must be a domain registered with the code generator. If the lookup of srDecl
fails an assertion will fire.
Definition at line 244 of file CodeGen.cpp.
llvm::StructType* comma::CodeGen::getStructTy | ( | const std::vector< const llvm::Type * > & | elts, | |
bool | isPacked = false | |||
) | const [inline] |
const llvm::TargetData& comma::CodeGen::getTargetData | ( | ) | const [inline] |
llvm::ArrayType* comma::CodeGen::getVLArrayTy | ( | const llvm::Type * | componentTy | ) | const [inline] |
const llvm::Type* comma::CodeGen::getVoidTy | ( | ) | const [inline] |
bool CodeGen::insertGlobal | ( | const std::string & | linkName, | |
llvm::GlobalValue * | GV | |||
) |
Adds a mapping between the given link name and an LLVM GlobalValue into the global table.
Returns true if the insertion succeeded and false if there was a conflict. In the latter case, the global table is not modified.
Definition at line 251 of file CodeGen.cpp.
llvm::GlobalValue * CodeGen::lookupCapsuleInfo | ( | const Domoid * | domoid | ) | const |
Returns an llvm value representing the static compile time info representing a previously declared capsule, or null if no such information is present.
Definition at line 267 of file CodeGen.cpp.
llvm::GlobalValue * CodeGen::lookupGlobal | ( | const std::string & | linkName | ) | const |
Returns an llvm value for a previously declared decl with the given link (mangled) name, or null if no such declaration exists.
Definition at line 262 of file CodeGen.cpp.
InstanceInfo* comma::CodeGen::lookupInstanceInfo | ( | const DomainInstanceDecl * | instance | ) | const [inline] |
llvm::BasicBlock * CodeGen::makeBasicBlock | ( | const std::string & | name = "" , |
|
llvm::Function * | parent = 0 , |
|||
llvm::BasicBlock * | insertBefore = 0 | |||
) | const |
Returns an llvm basic block.
Definition at line 290 of file CodeGen.cpp.
llvm::GlobalVariable * CodeGen::makeExternGlobal | ( | llvm::Constant * | init, | |
bool | isConstant = false , |
|||
const std::string & | name = "" | |||
) |
Returns a global variable with external linkage embedded in the current module.
init | A constant initializer for the global. | |
isConstant | If true, the global will be allocated in a read-only section, otherwise in a writeable section. | |
name | The name of the global to be linked into the module. |
Definition at line 298 of file CodeGen.cpp.
llvm::Function * CodeGen::makeFunction | ( | const DomainInstanceDecl * | instance, | |
const SubroutineDecl * | srDecl, | |||
CodeGenTypes & | CGT | |||
) |
Creates a function corresponding to the given Comma subroutine declaration.
Definition at line 325 of file CodeGen.cpp.
llvm::Function * CodeGen::makeFunction | ( | const llvm::FunctionType * | Ty, | |
const std::string & | name = "" | |||
) |
Creates a function with the given name and type. The linkage type is external.
Definition at line 317 of file CodeGen.cpp.
llvm::Function * CodeGen::makeInternFunction | ( | const llvm::FunctionType * | Ty, | |
const std::string & | name = "" | |||
) |
Creates a function with the given name and type. The linkage type is internal.
Definition at line 342 of file CodeGen.cpp.
llvm::GlobalVariable * CodeGen::makeInternGlobal | ( | llvm::Constant * | init, | |
bool | isConstant = false , |
|||
const std::string & | name = "" | |||
) |
Returns a global variable with internal linkage embedded in the current module.
init | A constant initializer for the global. | |
isConstant | If true, the global will be allocated in a read-only section, otherwise in a writeable section. | |
name | The name of the global to be linked into the module. |
Definition at line 308 of file CodeGen.cpp.