Actually copy the AST.
Type replacement works except for function parameters.
This commit is contained in:
54
expr.h
54
expr.h
@@ -96,6 +96,7 @@ public:
|
||||
encountered, NULL should be returned. */
|
||||
virtual Expr *TypeCheck() = 0;
|
||||
|
||||
Expr *Copy();
|
||||
|
||||
/** This method replaces a polymorphic type with a specific atomic type */
|
||||
Expr *ReplacePolyType(const PolyType *polyType, const Type *replacement);
|
||||
@@ -334,7 +335,6 @@ public:
|
||||
Expr *baseExpr, *index;
|
||||
|
||||
private:
|
||||
IndexExpr(IndexExpr *base);
|
||||
mutable const Type *type;
|
||||
mutable const PointerType *lvalueType;
|
||||
};
|
||||
@@ -386,6 +386,51 @@ protected:
|
||||
mutable const Type *type, *lvalueType;
|
||||
};
|
||||
|
||||
class StructMemberExpr : public MemberExpr
|
||||
{
|
||||
public:
|
||||
StructMemberExpr(Expr *e, const char *id, SourcePos p,
|
||||
SourcePos idpos, bool derefLValue);
|
||||
|
||||
static inline bool classof(StructMemberExpr const*) { return true; }
|
||||
static inline bool classof(ASTNode const* N) {
|
||||
return N->getValueID() == StructMemberExprID;
|
||||
}
|
||||
|
||||
const Type *GetType() const;
|
||||
const Type *GetLValueType() const;
|
||||
int getElementNumber() const;
|
||||
const Type *getElementType() const;
|
||||
|
||||
private:
|
||||
const StructType *getStructType() const;
|
||||
};
|
||||
|
||||
|
||||
class VectorMemberExpr : public MemberExpr
|
||||
{
|
||||
public:
|
||||
VectorMemberExpr(Expr *e, const char *id, SourcePos p,
|
||||
SourcePos idpos, bool derefLValue);
|
||||
|
||||
static inline bool classof(VectorMemberExpr const*) { return true; }
|
||||
static inline bool classof(ASTNode const* N) {
|
||||
return N->getValueID() == VectorMemberExprID;
|
||||
}
|
||||
|
||||
llvm::Value *GetValue(FunctionEmitContext* ctx) const;
|
||||
llvm::Value *GetLValue(FunctionEmitContext* ctx) const;
|
||||
const Type *GetType() const;
|
||||
const Type *GetLValueType() const;
|
||||
|
||||
int getElementNumber() const;
|
||||
const Type *getElementType() const;
|
||||
|
||||
private:
|
||||
const VectorType *exprVectorType;
|
||||
const VectorType *memberType;
|
||||
};
|
||||
|
||||
|
||||
/** @brief Expression representing a compile-time constant value.
|
||||
|
||||
@@ -536,8 +581,6 @@ public:
|
||||
|
||||
const Type *type;
|
||||
Expr *expr;
|
||||
private:
|
||||
TypeCastExpr(TypeCastExpr *base);
|
||||
};
|
||||
|
||||
|
||||
@@ -691,12 +734,11 @@ public:
|
||||
Symbol *GetBaseSymbol() const;
|
||||
Expr *TypeCheck();
|
||||
Expr *Optimize();
|
||||
//Expr *ReplacePolyType(const PolyType *from, const Type *to);
|
||||
Expr *ReplacePolyType(const PolyType *from, const Type *to);
|
||||
void Print() const;
|
||||
int EstimateCost() const;
|
||||
|
||||
private:
|
||||
SymbolExpr(SymbolExpr *base);
|
||||
Symbol *symbol;
|
||||
};
|
||||
|
||||
@@ -839,8 +881,6 @@ public:
|
||||
instance, or whether a single allocation is performed for the
|
||||
entire gang of program instances.) */
|
||||
bool isVarying;
|
||||
private:
|
||||
NewExpr(NewExpr *base);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user