view ir/irtype.h @ 1607:207a8a438dea

Merge DMD r253: refactor: Argument => Parameter --- dmd/arrayop.c | 30 ++++---- dmd/arraytypes.h | 2 +- dmd/class.c | 8 +- dmd/declaration.c | 10 ++-- dmd/declaration.h | 16 ++-- dmd/doc.c | 12 ++-- dmd/dsymbol.c | 4 +- dmd/expression.c | 48 +++++++------- dmd/expression.h | 32 +++++----- dmd/func.c | 78 +++++++++++----------- dmd/init.c | 2 +- dmd/interpret.c | 8 +- dmd/mtype.c | 190 ++++++++++++++++++++++++++-------------------------- dmd/mtype.h | 32 +++++----- dmd/opover.c | 34 +++++----- dmd/parse.c | 40 ++++++------ dmd/parse.h | 2 +- dmd/statement.c | 90 +++++++++++++------------- dmd/statement.h | 14 ++-- dmd/struct.c | 8 +- dmd/template.c | 30 ++++---- gen/functions.cpp | 10 ++-- gen/functions.h | 2 +- gen/tocall.cpp | 10 ++-- gen/typinf.cpp | 6 +- 25 files changed, 359 insertions(+), 359 deletions(-)
author Leandro Lucarella <llucax@gmail.com>
date Wed, 06 Jan 2010 15:18:20 -0300
parents 81121ac19f61
children
line wrap: on
line source

#ifndef __LDC_IR_IRTYPE_H__
#define __LDC_IR_IRTYPE_H__

#include "llvm/Type.h"

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

// forward declarations

struct Type;

class IrTypeAggr;
class IrTypeArray;
class IrTypeBasic;
class IrTypeClass;
class IrTypeDelegate;
class IrTypeFunction;
class IrTypePointer;
class IrTypeSArray;
class IrTypeStruct;

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

/// Base class for IrTypeS.
class IrType
{
public:
    ///
    IrType(Type* dt, const llvm::Type* lt);

    ///
    virtual IrTypeAggr* isAggr()        { return NULL; }
    ///
    virtual IrTypeArray* isArray()      { return NULL; }
    ///
    virtual IrTypeBasic* isBasic()      { return NULL; }
    ///
    virtual IrTypeClass* isClass()      { return NULL; }
    ///
    virtual IrTypeDelegate* isDelegate(){ return NULL; }
    ///
    virtual IrTypeFunction* isFunction(){ return NULL; }
    ///
    virtual IrTypePointer* isPointer()  { return NULL; }
    ///
    virtual IrTypeSArray* isSArray()    { return NULL; }
    ///
    virtual IrTypeStruct* isStruct()    { return NULL; }

    ///
    Type* getD()                        { return dtype; }
    ///
    virtual const llvm::Type* get()     { return pa.get(); }
    ///
    llvm::PATypeHolder& getPA()         { return pa; }

    ///
    virtual const llvm::Type* buildType() = 0;

protected:
    ///
    Type* dtype;

    /// LLVM type holder.
    llvm::PATypeHolder pa;
};

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

/// IrType for basic D types.
class IrTypeBasic : public IrType
{
public:
    ///
    IrTypeBasic(Type* dt);

    ///
    IrTypeBasic* isBasic()          { return this; }

    ///
    const llvm::Type* buildType();

protected:
    ///
    const llvm::Type* basic2llvm(Type* t);
};

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

/// IrType from pointers.
class IrTypePointer : public IrType
{
public:
    ///
    IrTypePointer(Type* dt);

    ///
    IrTypePointer* isPointer()      { return this; }

    ///
    const llvm::Type* buildType();

protected:
    ///
    const llvm::Type* pointer2llvm(Type* t);
};

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

/// IrType for static arrays
class IrTypeSArray : public IrType
{
public:
    ///
    IrTypeSArray(Type* dt);

    ///
    IrTypeSArray* isSArray()  { return this; }

    ///
    const llvm::Type* buildType();

protected:
    ///
    const llvm::Type* sarray2llvm(Type* t);

    /// Dimension.
    uint64_t dim;
};

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

/// IrType for dynamic arrays
class IrTypeArray : public IrType
{
public:
    ///
    IrTypeArray(Type* dt);

    ///
    IrTypeArray* isArray()  { return this; }

    ///
    const llvm::Type* buildType();

protected:
    ///
    const llvm::Type* array2llvm(Type* t);
};

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

#endif