src/compiler/HIR.h
author David Anderson <dvander@alliedmods.net>
Sun Jan 06 13:52:21 2013 -0800 (2013-01-06)
changeset 256 3c184218462d
parent 247 7721042bdb67
child 263 ba85a47ee414
permissions -rw-r--r--
Initial implementation of module imports.
[email protected]
     1
/*
[email protected]
     2
 * Copyright (C) 2012 David Anderson
[email protected]
     3
 *
[email protected]
     4
 * This file is part of SourcePawn.
[email protected]
     5
 *
[email protected]
     6
 * SourcePawn is free software: you can redistribute it and/or modify it under
[email protected]
     7
 * the terms of the GNU General Public License as published by the Free
[email protected]
     8
 * Software Foundation, either version 3 of the License, or (at your option)
[email protected]
     9
 * any later version.
[email protected]
    10
 * 
[email protected]
    11
 * SourcePawn is distributed in the hope that it will be useful, but WITHOUT ANY
[email protected]
    12
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
[email protected]
    13
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
[email protected]
    14
 *
[email protected]
    15
 * You should have received a copy of the GNU General Public License along with
[email protected]
    16
 * SourcePawn. If not, see http://www.gnu.org/licenses/.
[email protected]
    17
 */
[email protected]
    18
#ifndef _include_sp2_hir_h_
[email protected]
    19
#define _include_sp2_hir_h_
[email protected]
    20
[email protected]
    21
#include "../Types.h"
[email protected]
    22
#include "../PoolAllocator.h"
[email protected]
    23
#include "../Opcodes.h"
[email protected]
    24
#include "Symbols.h"
[email protected]
    25
[email protected]
    26
namespace ke {
[email protected]
    27
[email protected]
    28
#define HIR_OPS(_)                      \
[email protected]
    29
    _(Call)                             \
[email protected]
    30
    _(Boolean)                          \
[email protected]
    31
    _(Integer)                          \
[email protected]
    32
    _(Float)                            \
[email protected]
    33
    _(String)                           \
[email protected]
    34
    _(Import)                           \
[email protected]
    35
    _(Array)                            \
[email protected]
    36
    _(Store)                            \
[email protected]
    37
    _(ToRef)                            \
[email protected]
    38
    _(NewDependentArray)                \
[email protected]
    39
    /* Special LValue types */          \
[email protected]
    40
    _(Index)                            \
[email protected]
    41
    _(Local)                            \
[email protected]
    42
    _(Global)                           \
[email protected]
    43
    _(Field)                            \
[email protected]
    44
    /* End LValues */                   \
[email protected]
    45
    _(Unary)                            \
[email protected]
    46
    _(Binary)                           \
[email protected]
    47
    _(Convert)                          \
[email protected]
    48
    _(PostIncDec)
[email protected]
    49
[email protected]
    50
// Forward declarations.
[email protected]
    51
#define _(name)    class H##name;
[email protected]
    52
HIR_OPS(_)
[email protected]
    53
#undef _
[email protected]
    54
[email protected]
    55
class HIRVisitor;
[email protected]
    56
class AstNode;
[email protected]
    57
class HLValue;
[email protected]
    58
class Array;
[email protected]
    59
[email protected]
    60
class HIR : public PoolObject
[email protected]
    61
{
[email protected]
    62
  public:
[email protected]
    63
    enum HOp {
[email protected]
    64
#define _(name) k##name,
[email protected]
    65
        HIR_OPS(_)
[email protected]
    66
#undef _
[email protected]
    67
        kTotalOps
[email protected]
    68
    };
[email protected]
    69
[email protected]
    70
  public:
[email protected]
    71
    HIR(AstNode *node, Type *type)
[email protected]
    72
      : node_(node),
[email protected]
    73
        type_(type)
[email protected]
    74
    {
[email protected]
    75
    }
[email protected]
    76
[email protected]
    77
    Handle<Type> type() {
[email protected]
    78
        return type_;
[email protected]
    79
    }
[email protected]
    80
    AstNode *node() const {
[email protected]
    81
        return node_;
[email protected]
    82
    }
[email protected]
    83
[email protected]
    84
    virtual bool isLValue() const {
[email protected]
    85
        return false;
[email protected]
    86
    }
[email protected]195
    87
[email protected]
    88
    virtual HOp op() const = 0;
[email protected]
    89
    virtual void accept(HIRVisitor *visitor) = 0;
[email protected]
    90
[email protected]
    91
#define _(name)                                         \
[email protected]
    92
    bool is##name() const {                             \
[email protected]
    93
        return op() == k##name;                         \
[email protected]
    94
    }                                                   \
[email protected]
    95
    H##name *to##name() {                               \
[email protected]
    96
        assert(is##name());                             \
[email protected]
    97
        return reinterpret_cast<H##name *>(this);       \
[email protected]
    98
    }
[email protected]
    99
    HIR_OPS(_)
[email protected]
   100
#undef _
[email protected]
   101
[email protected]
   102
    HLValue *toLValue() {
[email protected]
   103
        assert(isLValue());
[email protected]
   104
        return reinterpret_cast<HLValue *>(this);
[email protected]
   105
    }
[email protected]
   106
[email protected]
   107
  private:
[email protected]
   108
    AstNode *node_;
[email protected]
   109
    ScopedRoot<Type> type_;
[email protected]
   110
};
[email protected]
   111
[email protected]
   112
class BytecodeEmitter;
[email protected]
   113
[email protected]
   114
class HIRVisitor
[email protected]
   115
{
[email protected]
   116
  public:
[email protected]
   117
#define _(name)                                 \
[email protected]
   118
    virtual void visit##name(H##name *hir) {    \
[email protected]
   119
        assert(false);                          \
[email protected]
   120
    }
[email protected]
   121
    HIR_OPS(_)
[email protected]
   122
#undef _
[email protected]
   123
};
[email protected]
   124
[email protected]
   125
typedef PoolList<HIR *> HIRList;
[email protected]
   126
[email protected]
   127
#define DEFINE_HIR(name)                        \
[email protected]
   128
    virtual HOp op() const {                    \
[email protected]
   129
        return k##name;                         \
[email protected]
   130
    }                                           \
[email protected]
   131
    virtual void accept(HIRVisitor *visitor) {  \
[email protected]
   132
        visitor->visit##name(this);             \
[email protected]
   133
    }
[email protected]
   134
[email protected]
   135
class HBoolean : public HIR
[email protected]
   136
{
[email protected]
   137
  public:
[email protected]
   138
    HBoolean(AstNode *node, Type *type, bool value)
[email protected]
   139
      : HIR(node, type),
[email protected]
   140
        value_(value)
[email protected]
   141
    {
[email protected]
   142
    }
[email protected]
   143
[email protected]
   144
    DEFINE_HIR(Boolean);
[email protected]
   145
    bool value() const {
[email protected]
   146
        return value_;
[email protected]
   147
    }
[email protected]
   148
[email protected]
   149
  private:
[email protected]
   150
    bool value_;
[email protected]
   151
};
[email protected]
   152
[email protected]
   153
class HInteger : public HIR
[email protected]
   154
{
[email protected]
   155
  public:
[email protected]
   156
    HInteger(AstNode *node, Type *type, int value)
[email protected]
   157
      : HIR(node, type),
[email protected]
   158
        value_(value)
[email protected]
   159
    {
[email protected]
   160
    }
[email protected]
   161
[email protected]
   162
    DEFINE_HIR(Integer);
[email protected]
   163
    int value() const {
[email protected]
   164
        return value_;
[email protected]
   165
    }
[email protected]
   166
[email protected]
   167
  private:
[email protected]
   168
    int value_;
[email protected]
   169
};
[email protected]
   170
[email protected]
   171
class HString : public HIR
[email protected]
   172
{
[email protected]
   173
  public:
[email protected]
   174
    HString(AstNode *node, Type *type, String *string)
[email protected]
   175
      : HIR(node, type),
[email protected]
   176
        string_(string)
[email protected]
   177
    {
[email protected]
   178
    }
[email protected]
   179
[email protected]
   180
    DEFINE_HIR(String);
[email protected]
   181
    Handle<String> string() const {
[email protected]
   182
        return string_;
[email protected]
   183
    }
[email protected]
   184
[email protected]
   185
  private:
[email protected]
   186
    ScopedRoot<String> string_;
[email protected]
   187
};
[email protected]
   188
[email protected]
   189
class HImport : public HIR
[email protected]
   190
{
[email protected]
   191
  public:
[email protected]
   192
    HImport(AstNode *node, Type *type, unsigned index)
[email protected]
   193
      : HIR(node, type),
[email protected]
   194
        index_(index)
[email protected]
   195
    {
[email protected]
   196
    }
[email protected]
   197
[email protected]
   198
    DEFINE_HIR(Import);
[email protected]
   199
    unsigned index() const {
[email protected]
   200
        return index_;
[email protected]
   201
    }
[email protected]
   202
[email protected]
   203
  private:
[email protected]
   204
    unsigned index_;
[email protected]
   205
};
[email protected]
   206
[email protected]
   207
class HArray : public HIR
[email protected]
   208
{
[email protected]
   209
  public:
[email protected]
   210
    HArray(AstNode *node, Type *type, Array *array, bool duplicate)
[email protected]
   211
      : HIR(node, type),
[email protected]
   212
        array_(array),
[email protected]
   213
        duplicate_(duplicate)
[email protected]
   214
    {
[email protected]
   215
    }
[email protected]
   216
[email protected]
   217
    DEFINE_HIR(Array);
[email protected]
   218
    Handle<Array> array() const {
[email protected]
   219
        return array_;
[email protected]
   220
    }
[email protected]
   221
    bool duplicate() const {
[email protected]
   222
        return duplicate_;
[email protected]
   223
    }
[email protected]
   224
[email protected]
   225
  private:
[email protected]
   226
    ScopedRoot<Array> array_;
[email protected]
   227
    bool duplicate_;
[email protected]
   228
};
[email protected]
   229
[email protected]
   230
class HConvert : public HIR
[email protected]
   231
{
[email protected]
   232
  public:
[email protected]
   233
    HConvert(AstNode *node, Type *type, Opcode op, HIR *in)
[email protected]
   234
      : HIR(node, type),
[email protected]
   235
        op_(op),
[email protected]
   236
        in_(in)
[email protected]
   237
    {
[email protected]
   238
    }
[email protected]
   239
[email protected]
   240
    DEFINE_HIR(Convert);
[email protected]
   241
    Opcode opcode() const {
[email protected]
   242
        return op_;
[email protected]
   243
    }
[email protected]
   244
    HIR *in() const {
[email protected]
   245
        return in_;
[email protected]
   246
    }
[email protected]
   247
[email protected]
   248
  private:
[email protected]
   249
    Opcode op_;
[email protected]
   250
    HIR *in_;
[email protected]
   251
};
[email protected]
   252
[email protected]
   253
class HLValue : public HIR
[email protected]
   254
{
[email protected]
   255
  public:
[email protected]
   256
    HLValue(AstNode *node, Type *type)
[email protected]
   257
      : HIR(node, type)
[email protected]
   258
    {
[email protected]
   259
    }
[email protected]
   260
[email protected]
   261
    // Pushes a reference to the LValue on the stack.
[email protected]
   262
    virtual void bind(HIRVisitor *visitor, BytecodeEmitter &emitter_) = 0;
[email protected]
   263
    
[email protected]
   264
    // Duplicates a stack reference.
[email protected]
   265
    virtual void hold(BytecodeEmitter &emitter_) = 0;
[email protected]
   266
[email protected]
   267
    // Reorders the stack for a post-increment operation:
[email protected]
   268
    //   REF VAL -> VAL REF VAL
[email protected]
   269
    virtual void swapAndPick(BytecodeEmitter &emitter_) = 0;
[email protected]
   270
[email protected]
   271
    // Given a stack layout of the form:
[email protected]
   272
    //  [-1]    value
[email protected]
   273
    //  [-2..n] ref
[email protected]
   274
    //
[email protected]
   275
    // Emits a store to the reference.
[email protected]
   276
    virtual void store(BytecodeEmitter &emitter_) = 0;
[email protected]
   277
    virtual void load(BytecodeEmitter &emitter_) = 0;
[email protected]
   278
[email protected]
   279
    // Try to make a direct reference, if semantics allow it. False if the
[email protected]
   280
    // caller must allocate a reference to the stack.
[email protected]
   281
    virtual bool ref(BytecodeEmitter &emitter_) = 0;
[email protected]
   282
[email protected]
   283
    bool isLValue() const {
[email protected]
   284
        return true;
[email protected]
   285
    }
[email protected]
   286
};
[email protected]
   287
[email protected]
   288
class HLocal : public HLValue
[email protected]
   289
{
[email protected]
   290
  public:
[email protected]
   291
    HLocal(AstNode *node, VariableSymbol *sym);
[email protected]
   292
[email protected]
   293
    DEFINE_HIR(Local);
[email protected]
   294
[email protected]
   295
    // Pushes a reference to the LValue on the stack.
[email protected]
   296
    void bind(HIRVisitor *visitor, BytecodeEmitter &emitter_);
[email protected]
   297
    void hold(BytecodeEmitter &emitter_);
[email protected]
   298
    void swapAndPick(BytecodeEmitter &emitter_);
[email protected]
   299
    void store(BytecodeEmitter &emitter_);
[email protected]
   300
    void load(BytecodeEmitter &emitter_);
[email protected]
   301
    bool ref(BytecodeEmitter &emitter_);
[email protected]
   302
[email protected]
   303
    VariableSymbol *sym() const {
[email protected]
   304
        return sym_;
[email protected]
   305
    }
[email protected]
   306
[email protected]
   307
  private:
[email protected]
   308
    VariableSymbol *sym_;
[email protected]
   309
};
[email protected]
   310
[email protected]
   311
class HIndex : public HLValue
[email protected]
   312
{
[email protected]
   313
  public:
[email protected]
   314
    HIndex(AstNode *node, Type *type, HIR *left, HIR *right)
[email protected]
   315
      : HLValue(node, type),
[email protected]
   316
        left_(left),
[email protected]
   317
        right_(right)
[email protected]
   318
    {
[email protected]
   319
    }
[email protected]
   320
[email protected]
   321
    DEFINE_HIR(Index);
[email protected]
   322
[email protected]
   323
    void bind(HIRVisitor *visitor, BytecodeEmitter &emitter_);
[email protected]
   324
    void hold(BytecodeEmitter &emitter_);
[email protected]
   325
    void swapAndPick(BytecodeEmitter &emitter_);
[email protected]
   326
    void store(BytecodeEmitter &emitter_);
[email protected]
   327
    void load(BytecodeEmitter &emitter_);
[email protected]
   328
    bool ref(BytecodeEmitter &emitter_);
[email protected]
   329
[email protected]
   330
    HIR *base() const {
[email protected]
   331
        return left_;
[email protected]
   332
    }
[email protected]
   333
    HIR *index() const {
[email protected]
   334
        return right_;
[email protected]
   335
    }
[email protected]
   336
[email protected]
   337
  private:
[email protected]
   338
    HIR *left_;
[email protected]
   339
    HIR *right_;
[email protected]
   340
};
[email protected]
   341
[email protected]
   342
class HField : public HLValue
[email protected]
   343
{
[email protected]
   344
  public:
[email protected]
   345
    HField(AstNode *node, HIR *left, Type *type, unsigned index)
[email protected]
   346
      : HLValue(node, type),
[email protected]
   347
        base_(left),
[email protected]
   348
        index_(index)
[email protected]
   349
    {
[email protected]
   350
    }
[email protected]
   351
[email protected]
   352
    DEFINE_HIR(Field);
[email protected]
   353
[email protected]
   354
    void bind(HIRVisitor *visitor, BytecodeEmitter &emitter_);
[email protected]
   355
    void hold(BytecodeEmitter &emitter_);
[email protected]
   356
    void swapAndPick(BytecodeEmitter &emitter_);
[email protected]
   357
    void store(BytecodeEmitter &emitter_);
[email protected]
   358
    void load(BytecodeEmitter &emitter_);
[email protected]
   359
    bool ref(BytecodeEmitter &emitter_);
[email protected]
   360
[email protected]
   361
    HIR *base() const {
[email protected]
   362
        return base_;
[email protected]
   363
    }
[email protected]
   364
    unsigned index() const {
[email protected]
   365
        return index_;
[email protected]
   366
    }
[email protected]
   367
[email protected]
   368
  private:
[email protected]
   369
    HIR *base_;
[email protected]
   370
    unsigned index_;
[email protected]
   371
};
[email protected]
   372
[email protected]
   373
class HGlobal : public HLValue
[email protected]
   374
{
[email protected]
   375
  public:
[email protected]
   376
    HGlobal(AstNode *node, Symbol *sym)
[email protected]
   377
      : HLValue(node, sym->type()),
[email protected]
   378
        sym_(sym)
[email protected]
   379
    {
[email protected]
   380
    }
[email protected]
   381
[email protected]
   382
    DEFINE_HIR(Global);
[email protected]
   383
[email protected]
   384
    void bind(HIRVisitor *visitor, BytecodeEmitter &emitter_);
[email protected]
   385
    void hold(BytecodeEmitter &emitter_);
[email protected]
   386
    void swapAndPick(BytecodeEmitter &emitter_);
[email protected]
   387
    void store(BytecodeEmitter &emitter_);
[email protected]
   388
    void load(BytecodeEmitter &emitter_);
[email protected]
   389
    bool ref(BytecodeEmitter &emitter_);
[email protected]
   390
[email protected]
   391
    Symbol *sym() const {
[email protected]
   392
        return sym_;
[email protected]
   393
    }
[email protected]
   394
[email protected]
   395
  private:
[email protected]
   396
    Symbol *sym_;
[email protected]
   397
};
[email protected]
   398
[email protected]
   399
class HBinary : public HIR
[email protected]
   400
{
[email protected]
   401
  public:
[email protected]
   402
    HBinary(AstNode *node, Type *type, TokenKind token, HIR *left, HIR *right)
[email protected]
   403
      : HIR(node, type),
[email protected]
   404
        token_(token),
[email protected]
   405
        left_(left),
[email protected]
   406
        right_(right)
[email protected]
   407
    {
[email protected]
   408
    }
[email protected]195
   409
[email protected]
   410
    DEFINE_HIR(Binary);
[email protected]
   411
    TokenKind token() const {
[email protected]
   412
        return token_;
[email protected]
   413
    }
[email protected]
   414
    HIR *left() const {
[email protected]
   415
        return left_;
[email protected]
   416
    }
[email protected]
   417
    HIR *right() const {
[email protected]
   418
        return right_;
[email protected]
   419
    }
[email protected]
   420
[email protected]
   421
  private:
[email protected]
   422
    TokenKind token_;
[email protected]
   423
    HIR *left_;
[email protected]
   424
    HIR *right_;
[email protected]
   425
};
[email protected]
   426
[email protected]
   427
class HFloat : public HIR
[email protected]
   428
{
[email protected]
   429
  public:
[email protected]
   430
    HFloat(AstNode *node, Type *type, float value)
[email protected]
   431
      : HIR(node, type),
[email protected]
   432
        value_(value)
[email protected]
   433
    {
[email protected]
   434
    }
[email protected]
   435
[email protected]
   436
    DEFINE_HIR(Float);
[email protected]
   437
    float value() const {
[email protected]
   438
        return value_;
[email protected]
   439
    }
[email protected]
   440
[email protected]
   441
  private:
[email protected]
   442
    float value_;
[email protected]
   443
};
[email protected]
   444
[email protected]
   445
class HUnary : public HIR
[email protected]
   446
{
[email protected]
   447
  public:
[email protected]
   448
    HUnary(AstNode *node, Type *type, TokenKind tok, HIR *in)
[email protected]
   449
      : HIR(node, type),
[email protected]
   450
        in_(in),
[email protected]
   451
        token_(tok)
[email protected]
   452
    {
[email protected]
   453
    }
[email protected]
   454
[email protected]
   455
    DEFINE_HIR(Unary);
[email protected]
   456
    HIR *in() const {
[email protected]
   457
        return in_;
[email protected]
   458
    }
[email protected]
   459
    TokenKind token() const {
[email protected]
   460
        return token_;
[email protected]
   461
    }
[email protected]
   462
[email protected]
   463
  private:
[email protected]
   464
    HIR *in_;
[email protected]
   465
    TokenKind token_;
[email protected]
   466
};
[email protected]
   467
[email protected]
   468
class HStore : public HIR
[email protected]
   469
{
[email protected]
   470
  public:
[email protected]
   471
    HStore(AstNode *node, HLValue *lval, HIR *rval)
[email protected]
   472
      : HIR(node, lval->type()),
[email protected]
   473
        kind_(TOK_ASSIGN),
[email protected]
   474
        lval_(lval),
[email protected]
   475
        rval_(rval)
[email protected]
   476
    {
[email protected]
   477
    }
[email protected]
   478
[email protected]
   479
    HStore(AstNode *node, TokenKind kind, HLValue *lval, HIR *rval)
[email protected]
   480
      : HIR(node, lval->type()),
[email protected]
   481
        kind_(kind),
[email protected]
   482
        lval_(lval),
[email protected]
   483
        rval_(rval)
[email protected]
   484
    {
[email protected]
   485
    }
[email protected]
   486
[email protected]
   487
    DEFINE_HIR(Store);
[email protected]
   488
[email protected]
   489
    HLValue *lval() const {
[email protected]
   490
        return lval_;
[email protected]
   491
    }
[email protected]
   492
    HIR *rval() const {
[email protected]
   493
        return rval_;
[email protected]
   494
    }
[email protected]
   495
    TokenKind kind() const {
[email protected]
   496
        return kind_;
[email protected]
   497
    }
[email protected]
   498
[email protected]
   499
  private:
[email protected]
   500
    TokenKind kind_;
[email protected]
   501
    HLValue *lval_;
[email protected]
   502
    HIR *rval_;
[email protected]
   503
};
[email protected]
   504
[email protected]
   505
class HPostIncDec : public HIR
[email protected]
   506
{
[email protected]
   507
  public:
[email protected]
   508
    HPostIncDec(AstNode *node, TokenKind kind, HLValue *lval, HIR *rval)
[email protected]
   509
      : HIR(node, lval->type()),
[email protected]
   510
        kind_(kind),
[email protected]
   511
        lval_(lval),
[email protected]
   512
        rval_(rval)
[email protected]
   513
    {
[email protected]
   514
    }
[email protected]
   515
[email protected]
   516
    DEFINE_HIR(PostIncDec);
[email protected]
   517
[email protected]
   518
    HLValue *lval() const {
[email protected]
   519
        return lval_;
[email protected]
   520
    }
[email protected]
   521
    HIR *rval() const {
[email protected]
   522
        return rval_;
[email protected]
   523
    }
[email protected]
   524
    TokenKind kind() const {
[email protected]
   525
        return kind_;
[email protected]
   526
    }
[email protected]
   527
[email protected]
   528
  private:
[email protected]
   529
    TokenKind kind_;
[email protected]
   530
    HLValue *lval_;
[email protected]
   531
    HIR *rval_;
[email protected]
   532
};
[email protected]
   533
[email protected]
   534
class HCall : public HIR
[email protected]
   535
{
[email protected]
   536
  public:
[email protected]
   537
    HCall(AstNode *node, Type *type, HIR *callee, HIRList *args)
[email protected]
   538
      : HIR(node, type),
[email protected]
   539
        callee_(callee),
[email protected]
   540
        args_(args)
[email protected]
   541
    {
[email protected]
   542
    }
[email protected]
   543
[email protected]
   544
    DEFINE_HIR(Call);
[email protected]
   545
[email protected]
   546
    HIR *callee() const {
[email protected]
   547
        return callee_;
[email protected]
   548
    }
[email protected]
   549
    HIRList *args() const {
[email protected]
   550
        return args_;
[email protected]
   551
    }
[email protected]
   552
[email protected]
   553
  private:
[email protected]
   554
    HIR *callee_;
[email protected]
   555
    HIRList *args_;
[email protected]
   556
};
[email protected]
   557
[email protected]
   558
class HToRef : public HIR
[email protected]
   559
{
[email protected]
   560
  public:
[email protected]
   561
    HToRef(AstNode *node, Type *type, HIR *in)
[email protected]
   562
      : HIR(node, type),
[email protected]
   563
        in_(in)
[email protected]
   564
    {
[email protected]
   565
    }
[email protected]
   566
[email protected]
   567
    DEFINE_HIR(ToRef);
[email protected]
   568
[email protected]
   569
    HIR *in() const {
[email protected]
   570
        return in_;
[email protected]
   571
    }
[email protected]
   572
[email protected]
   573
  private:
[email protected]
   574
    HIR *in_;
[email protected]
   575
};
[email protected]
   576
[email protected]
   577
class HNewDependentArray : public HIR
[email protected]
   578
{
[email protected]
   579
  public:
[email protected]
   580
    HNewDependentArray(AstNode *node, Type *type, HIR *base, HIR *index)
[email protected]
   581
      : HIR(node, type),
[email protected]
   582
        base_(base),
[email protected]
   583
        index_(index)
[email protected]
   584
    {
[email protected]
   585
    }
[email protected]
   586
[email protected]
   587
    DEFINE_HIR(NewDependentArray);
[email protected]
   588
[email protected]
   589
    HIR *base() const {
[email protected]
   590
        return base_;
[email protected]
   591
    }
[email protected]
   592
    HIR *index() const {
[email protected]
   593
        return index_;
[email protected]
   594
    }
[email protected]
   595
[email protected]
   596
  private:
[email protected]
   597
    HIR *base_;
[email protected]
   598
    HIR *index_;
[email protected]
   599
};
[email protected]
   600
[email protected]
   601
#undef DEFINE_HIR
[email protected]
   602
[email protected]
   603
void EmitHIR(Zone *zone, BytecodeEmitter &emitter, HIR *hir);
[email protected]
   604
[email protected]
   605
}
[email protected]
   606
[email protected]
   607
#endif // _include_sp2_hir_h_