Skip to content
Snippets Groups Projects
Commit 18ce1a66 authored by Yang Chen's avatar Yang Chen
Browse files

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.
parent fc36ecab
Branches
Tags before_merging_module_refactoring
No related merge requests found
......@@ -35,7 +35,8 @@ 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 \
......@@ -43,7 +44,8 @@ TRANSFORM_SOURCES = ParamToLocal.cpp ParamToGlobal.cpp LocalToGlobal.cpp ReturnV
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 \
......@@ -51,7 +53,8 @@ TRANSFORM_OBJS = ParamToLocal.o ParamToGlobal.o LocalToGlobal.o ReturnVoid.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 \
......@@ -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
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment