view gen/elem.h @ 73:b706170e24a9 trunk

[svn r77] Fixed foreach on slice. Fixed some nested function problems when accessing outer function parameters. Major changes to handling of structs. Initial support for unions. Probably more...
author lindquist
date Wed, 31 Oct 2007 03:11:32 +0100
parents 0c77619e803b
children 339422268de1
line wrap: on
line source

#ifndef LLVMDC_GEN_ELEM_H
#define LLVMDC_GEN_ELEM_H

#include "root.h"
#include "declaration.h"
#include "aggregate.h"

// represents a value. be it a constant literal, a variable etc.
// maintains all the information for doing load/store appropriately
struct elem : Object
{
    enum {
        NONE,
        VAR,
        VAL,
        FUNC,
        CONST,
        NUL,
        REF,
        SLICE,
        ARRAYLEN
    };

public:
    elem();

    llvm::Value* mem;
    llvm::Value* val;
    llvm::Value* arg;
    int type;
    bool inplace;
    bool field;
    unsigned callconv;
    bool isthis;
    bool istypeinfo;

    VarDeclaration* vardecl;
    FuncDeclaration* funcdecl;

    llvm::Value* getValue();
    //llvm::Value* getMemory();

    bool isNull()   {return !(mem || val);}
};

#endif // LLVMDC_GEN_ELEM_H