view gen/elem.h @ 32:a86fe7496b58 trunk

[svn r36] * Fixed a bug where passing a regular argument to a ref argument did not allocate storage
author lindquist
date Thu, 04 Oct 2007 18:24:05 +0200
parents 37a4fdab33fc
children 4648206ca213
line wrap: on
line source

#ifndef LLVMDC_GEN_ELEM_H
#define LLVMDC_GEN_ELEM_H

#include "llvm/Value.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
    };

public:
    elem();

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

    VarDeclaration* vardecl;
    FuncDeclaration* funcdecl;

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

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

#endif // LLVMDC_GEN_ELEM_H