Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Enable to build reduce-array-dim pass
This pass reduces the dimension of an array. Each transformation iteration
reduces one dimension in the following way:
  int a[2][3][4];
  void foo(void) {... a[1][2][3] ... }
===>
  int a[2][3 * 4];
  void foo(void) {... a[1][3 * 2 + 3] ... }
The binary operations will be computed to constant during the
transformation if possible. Array fields are not handled right now.
Also, this pass only works with ConstantArrayType and IncompleteArrayType.
  • Loading branch information
chenyang78 committed Mar 4, 2012
1 parent fc36eca commit 18ce1a6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions clang_delta/Makefile
Expand Up @@ -35,23 +35,26 @@ TRANSFORM_HEADERS = ParamToLocal.h ParamToGlobal.h LocalToGlobal.h ReturnVoid.h
CombineLocalVarDecl.h ReplaceCallExpr.h SimpleInliner.h \
RemoveUnusedFunction.h ReducePointerLevel.h LiftAssignmentExpr.h \
CopyPropagation.h RemoveUnusedVar.h SimplifyCallExpr.h \
CallExprToValue.h UnionToStruct.h SimplifyIf.h
CallExprToValue.h UnionToStruct.h SimplifyIf.h \
ReduceArrayDim.h

TRANSFORM_SOURCES = ParamToLocal.cpp ParamToGlobal.cpp LocalToGlobal.cpp ReturnVoid.cpp \
RemoveNestedFunction.cpp BinOpSimplification.cpp AggregateToScalar.cpp \
RenameVar.cpp RenameFun.cpp RenameParam.cpp CombineGlobalVarDecl.cpp \
CombineLocalVarDecl.cpp ReplaceCallExpr.cpp SimpleInliner.cpp \
RemoveUnusedFunction.cpp ReducePointerLevel.cpp LiftAssignmentExpr.cpp \
CopyPropagation.cpp RemoveUnusedVar.cpp SimplifyCallExpr.cpp \
CallExprToValue.cpp UnionToStruct.cpp SimplifyIf.cpp
CallExprToValue.cpp UnionToStruct.cpp SimplifyIf.cpp \
ReduceArrayDim.cpp

TRANSFORM_OBJS = ParamToLocal.o ParamToGlobal.o LocalToGlobal.o ReturnVoid.o \
RemoveNestedFunction.o BinOpSimplification.o AggregateToScalar.o \
RenameVar.o RenameFun.o RenameParam.o CombineGlobalVarDecl.o \
CombineLocalVarDecl.o ReplaceCallExpr.o SimpleInliner.o \
RemoveUnusedFunction.o ReducePointerLevel.o LiftAssignmentExpr.o \
CopyPropagation.o RemoveUnusedVar.o SimplifyCallExpr.o \
CallExprToValue.o UnionToStruct.o SimplifyIf.o
CallExprToValue.o UnionToStruct.o SimplifyIf.o \
ReduceArrayDim.o

OBJS = ClangDelta.o \
TransformationManager.o \
Expand Down Expand Up @@ -122,6 +125,8 @@ UnionToStruct.o: UnionToStruct.cpp UnionToStruct.h ${SUB_TRANSFORMATION_DEPS}

SimplifyIf.o: SimplifyIf.cpp SimplifyIf.h ${SUB_TRANSFORMATION_DEPS}

ReduceArrayDim.o: ReduceArrayDim.cpp ReduceArrayDim.h ${SUB_TRANSFORMATION_DEPS}

clean:
rm -rf *.o

Expand Down

0 comments on commit 18ce1a6

Please sign in to comment.