A compound represented by formula or a pharmaceutically acceptable salt thereof, wherein is selected from a double bond and a single bond; ring A is selected from 5-membered heterocycloalkenyl, 5-membered heteroaryl and 5-membered heterocycloalkyl, wherein each the 5-membered heterocycloalkenyl, 5-membered heteroaryl and 5-membered heterocycloalkyl independently comprises 1 or 2 heteroatoms or heteroatomic groups independently selected from N, -NH-, -O-, - S-, -C(=O)-, -C(=S)-, -C(=O)O-, -S(=O)- and -S(=O) 2 -; provided that when ring A is selected from 5-membered heteroaryl, then the heteroatoms of the ring A do not simultaneously contain N and -O-; ring B is selected from 6-membered aryl and 6-membered heteroaryl; X 1 is selected from C, CH, C(R 5) and N; X 2 is selected from C, CH, C(R 9) and N; X 3 is selected from C, CH, C(R 10) and N; X 4 is selected from C, CH, C(R 11) and N; X 5 is selected from C, CH, C(R 12) and N; R 1 is selected from H, C 1 - 3 alkyl and C 1 - 3 heteroalkyl, wherein the C 1-3 alkyl and C 1-3 heteroalkyl are each independently and optionally substituted with 1, 2 or 3 R a; R 2 is selected from phenyl and 5-6 membered heteroaryl, wherein the phenyl and 5-6-membered heteroaryl are each independently and optionally substituted with 1, 2 or 3 R b; R 3 and R 4 are each independently selected from H, halogen, OH, CN, NH 2 and C 1 - 3 heteroalkyl, wherein the C 1 - 3 heteroalkyl is independently and optionally substituted with 1, 2 or 3 R c; R 5, R 9, R 10, R 11 and R 12 are each independently selected from halogen, OH, CN, NH 2, C 1 - 3 alkyl and C 1-3 heteroalkyl, wherein the C 1-3 alkyl and C 1 - 3 heteroalkyl are each independently and optionally substituted with 1, 2 or 3 R d; R 6 is selected from C 1-6 alkyl, C 1-6 heteroalkyl, C 3-6 cycloalkyl and 3-6 membered heterocycloalkyl, wherein the C 1-6 alkyl, C 1-6 heteroalkyl, C 3-6 cycloalkyl and 3-6 membered heterocycloalkyl are each independently and optionally substituted with 1, 2 or 3 R e; R 7 and R 8 are each independently selected from C 1 - 3 alkyl-O-, wherein the C 1-3 alkyl-O- is optionally substituted with 1, 2 or 3 halogens; R a, R b, R c, R d and R e are each independently selected from halogen, OH, CN, NH 2, C 1 - 3 alkyl, C 3-5 cycloalkyl and C 1 - 3 heteroalkyl, wherein the C 1-3 alkyl, C 3-5 cycloalkyl and C 1 - 3 heteroalkyl are each independently and optionally substituted with 1, 2 or 3 R; R is selected from F, Cl, Br, I, OH, CN, NH 2, NO 2, CH 3, CH 3 CH 2, CH 3 CH 2 CH 2, (CH 3) 2 CH, CF 3, CHF 2, CH 2 F and CH 3 O; each the 6-membered heteroaryl, C 1 - 3 heteroalkyl, C 1 - 6 heteroalkyl, 5-6 membered heteroaryl and 3-6 membered heterocycloalkyl independently comprises 1, 2 or 3 heteroatoms or heteroatomic groups independently selected from N, -NH-, -O-, -S-, - C(=O)-, -C(=S)-, -C(=O)O-, -S(=O)- and -S(=O) 2 -. is selected from a double bond and a single bond; ring A is selected from 5-membered heterocycloalkenyl, 5-membered heteroaryl and 5-membered heterocycloalkyl, wherein each the 5-membered heterocycloalkenyl, 5-membered heteroaryl and 5-membered heterocycloalkyl independently comprises 1 or 2 heteroatoms or heteroatomic groups independently selected from N, -NH-, -O-, - S-, -C(=O)-, -C(=S)-, -C(=O)O-, -S(=O)- and -S(=O) 2 -; provided that when ring A is selected from 5-membered heteroaryl, then the heteroatoms of the ring A do not simultaneously contain N and -O-; ring B is selected from 6-membered aryl and 6-membered heteroaryl; X 1 is selected from C, CH, C(R 5) and N; X 2 is selected from C, CH, C(R 9) and N; X 3 is selected from C, CH, C(R 10) and N; X 4 is selected from C, CH, C(R 11) and N; X 5 is selected from C, CH, C(R 12) and N; R 1 is selected from H, C 1 - 3 alkyl and C 1 - 3 heteroalkyl, wherein the C 1-3 alkyl and C 1-3 heteroalkyl are each independently and optionally substituted with 1, 2 or 3 R a; R 2 is selected from phenyl and 5-6 membered heteroaryl, wherein the phenyl and 5-6-membered heteroaryl are each independently and optionally substituted with 1, 2 or 3 R b; R 3 and R 4 are each independently selected from H, halogen, OH, CN, NH 2 and C 1 - 3 heteroalkyl, wherein the C 1 - 3 heteroalkyl is independently and optionally substituted with 1, 2 or 3 R c; R 5, R 9, R 10, R 11 and R 12 are each independently selected from halogen, OH, CN, NH 2, C 1 - 3 alkyl and C 1-3 heteroalkyl, wherein the C 1-3 alkyl and C 1 - 3 heteroalkyl are each independently and optionally substituted with 1, 2 or 3 R d; R 6 is selected from C 1-6 alkyl, C 1-6 heteroalkyl, C 3-6 cycloalkyl and 3-6 membered heterocycloalkyl, wherein the C 1-6 alkyl, C 1-6 heteroalkyl, C 3-6 cycloalkyl and 3-6 membered heterocycloalkyl are each independently and optionally substituted with 1, 2 or 3 R e; R 7 and R 8 are each independently selected from C 1 - 3 alkyl-O-, wherein the C 1-3 alkyl-O- is optionally substituted with 1, 2 or 3 halogens; R a, R b, R c, R d and R e are each independently selected from halogen, OH, CN, NH 2, C 1 - 3 alkyl, C 3-5 cycloalkyl and C 1 - 3 heteroalkyl, wherein the C 1-3 alkyl, C 3-5 cycloalkyl and C 1 - 3 heteroalkyl are each independently and optionally substituted with 1, 2 or 3 R; R is selected from F, Cl, Br, I, OH, CN, NH 2, NO 2, CH 3, CH 3 CH 2, CH 3 CH 2 CH 2, (CH 3) 2 CH, CF 3, CHF 2, CH 2 F and CH 3 O; each the 6-membered heteroaryl, C 1 - 3 heteroalkyl, C 1 - 6 heteroalkyl, 5-6 membered heteroaryl and 3-6 membered heterocycloalkyl independently comprises 1, 2 or 3 heteroatoms or heteroatomic groups independently selected from N, -NH-, -O-, -S-, - C(=O)-, -C(=S)-, -C(=O)O-, -S(=O)- and -S(=O) 2 -.