view ir/irstruct.h @ 270:d9d5d59873d8 trunk

[svn r291] Fixed a bunch of the old Phobos tests to work with Tango. Branch statements now emit a new block after it. Fixed the _adSort runtime function had a bad signature. Added a missing dot prefix on compiler generated string tables for string switch. Fixed, PTRSIZE seems like it was wrong on 64bit, now it definitely gets set properly.
author lindquist
date Mon, 16 Jun 2008 16:01:19 +0200
parents e3355ce5444b
children 7ade5e035beb
line wrap: on
line source

#ifndef LLVMDC_IR_IRSTRUCT_H
#define LLVMDC_IR_IRSTRUCT_H

#include "ir/ir.h"

#include <vector>
#include <map>

struct IrInterface : IrBase
{
    BaseClass* base;
    ClassDeclaration* decl;

#if OPAQUE_VTBLS
    const LLArrayType* vtblTy;
    LLConstantArray* vtblInit;
#else
    const LLStructType* vtblTy;
    LLConstantStruct* vtblInit;
#endif
    LLGlobalVariable* vtbl;

    const LLStructType* infoTy;
    LLConstantStruct* infoInit;
    LLConstant* info;

    int index;

#if OPAQUE_VTBLS
    IrInterface(BaseClass* b, const LLArrayType* vt);
#else
    IrInterface(BaseClass* b, const LLStructType* vt);
#endif
    ~IrInterface();
};

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

// represents a struct or class
struct IrStruct : IrBase
{
    struct Offset
    {
        VarDeclaration* var;
        const LLType* type;
        LLConstant* init;

        Offset(VarDeclaration* v, const LLType* ty)
        : var(v), type(ty), init(NULL) {}
    };

    typedef std::multimap<unsigned, Offset> OffsetMap;
    typedef std::vector<VarDeclaration*> VarDeclVector;
    typedef std::map<ClassDeclaration*, IrInterface*> InterfaceMap;
    typedef InterfaceMap::iterator InterfaceMapIter;
    typedef std::vector<IrInterface*> InterfaceVector;
    typedef InterfaceVector::iterator InterfaceVectorIter;

public:
    IrStruct(Type*);
    virtual ~IrStruct();

    Type* type;
    llvm::PATypeHolder recty;
    OffsetMap offsets;
    VarDeclVector defaultFields;

    InterfaceMap interfaceMap;
    InterfaceVector interfaceVec;
    const llvm::ArrayType* interfaceInfosTy;
    LLGlobalVariable* interfaceInfos;

    bool defined;
    bool constinited;

    LLGlobalVariable* vtbl;
#if OPAQUE_VTBLS
    LLConstant* constVtbl;
#else
    LLConstantStruct* constVtbl;
#endif
    LLGlobalVariable* init;
    LLConstant* constInit;
    LLGlobalVariable* classInfo;
    LLConstant* constClassInfo;
    bool hasUnions;
    DUnion* dunion;
    bool classDeclared;
    bool classDefined;

    LLGlobalVariable* dwarfComposite;
};

#endif