|
11 | 11 | @computed_goto.dispatch = external global [5 x ptr]
|
12 | 12 | define void @computed_goto() { ret void }
|
13 | 13 | define void @jump_table() { ret void }
|
| 14 | + define void @jump_table_pic() { ret void } |
14 | 15 | ...
|
15 | 16 | ---
|
16 | 17 | name: computed_goto
|
@@ -253,3 +254,166 @@ body: |
|
253 | 254 | bb.7:
|
254 | 255 |
|
255 | 256 | ...
|
| 257 | +--- |
| 258 | +name: jump_table_pic |
| 259 | +tracksRegLiveness: true |
| 260 | +jumpTable: |
| 261 | + kind: block-address |
| 262 | + entries: |
| 263 | + - id: 0 |
| 264 | + blocks: [ '%bb.2', '%bb.3', '%bb.4', '%bb.5', '%bb.6' ] |
| 265 | +body: | |
| 266 | + ; CHECK-LABEL: name: jump_table_pic |
| 267 | + ; CHECK: bb.0: |
| 268 | + ; CHECK-NEXT: successors: %bb.3(0x1999999a), %bb.4(0x1999999a), %bb.5(0x1999999a), %bb.6(0x1999999a), %bb.7(0x1999999a) |
| 269 | + ; CHECK-NEXT: {{ $}} |
| 270 | + ; CHECK-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp |
| 271 | + ; CHECK-NEXT: CALL64pcrel32 target-flags(x86-plt) @f0, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax |
| 272 | + ; CHECK-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp |
| 273 | + ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr64 = COPY $rax |
| 274 | + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gr64 = COPY [[COPY]] |
| 275 | + ; CHECK-NEXT: [[DEC64r:%[0-9]+]]:gr64_nosp = DEC64r [[COPY1]], implicit-def dead $eflags |
| 276 | + ; CHECK-NEXT: [[LEA64r:%[0-9]+]]:gr64 = LEA64r $rip, 1, $noreg, %jump-table.0, $noreg |
| 277 | + ; CHECK-NEXT: [[MOVSX64rm32_:%[0-9]+]]:gr64 = MOVSX64rm32 [[DEC64r]], 4, [[DEC64r]], 0, $noreg :: (load (s32) from jump-table) |
| 278 | + ; CHECK-NEXT: [[ADD64rr:%[0-9]+]]:gr64 = ADD64rr [[LEA64r]], [[MOVSX64rm32_]], implicit-def dead $eflags |
| 279 | + ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gr64 = COPY [[COPY1]] |
| 280 | + ; CHECK-NEXT: JMP64r [[ADD64rr]] |
| 281 | + ; CHECK-NEXT: {{ $}} |
| 282 | + ; CHECK-NEXT: bb.3: |
| 283 | + ; CHECK-NEXT: successors: %bb.3(0x1999999a), %bb.4(0x1999999a), %bb.5(0x1999999a), %bb.6(0x1999999a), %bb.7(0x1999999a) |
| 284 | + ; CHECK-NEXT: {{ $}} |
| 285 | + ; CHECK-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp |
| 286 | + ; CHECK-NEXT: CALL64pcrel32 target-flags(x86-plt) @f1, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax |
| 287 | + ; CHECK-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp |
| 288 | + ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gr64 = COPY $rax |
| 289 | + ; CHECK-NEXT: [[COPY4:%[0-9]+]]:gr64 = COPY [[COPY3]] |
| 290 | + ; CHECK-NEXT: [[DEC64r1:%[0-9]+]]:gr64_nosp = DEC64r [[COPY4]], implicit-def dead $eflags |
| 291 | + ; CHECK-NEXT: [[LEA64r1:%[0-9]+]]:gr64 = LEA64r $rip, 1, $noreg, %jump-table.0, $noreg |
| 292 | + ; CHECK-NEXT: [[MOVSX64rm32_1:%[0-9]+]]:gr64 = MOVSX64rm32 [[DEC64r1]], 4, [[DEC64r1]], 0, $noreg :: (load (s32) from jump-table) |
| 293 | + ; CHECK-NEXT: [[ADD64rr1:%[0-9]+]]:gr64 = ADD64rr [[LEA64r1]], [[MOVSX64rm32_1]], implicit-def dead $eflags |
| 294 | + ; CHECK-NEXT: [[COPY5:%[0-9]+]]:gr64 = COPY [[COPY4]] |
| 295 | + ; CHECK-NEXT: JMP64r [[ADD64rr1]] |
| 296 | + ; CHECK-NEXT: {{ $}} |
| 297 | + ; CHECK-NEXT: bb.4: |
| 298 | + ; CHECK-NEXT: successors: %bb.3(0x1999999a), %bb.4(0x1999999a), %bb.5(0x1999999a), %bb.6(0x1999999a), %bb.7(0x1999999a) |
| 299 | + ; CHECK-NEXT: {{ $}} |
| 300 | + ; CHECK-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp |
| 301 | + ; CHECK-NEXT: CALL64pcrel32 target-flags(x86-plt) @f2, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax |
| 302 | + ; CHECK-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp |
| 303 | + ; CHECK-NEXT: [[COPY6:%[0-9]+]]:gr64 = COPY $rax |
| 304 | + ; CHECK-NEXT: [[COPY7:%[0-9]+]]:gr64 = COPY [[COPY6]] |
| 305 | + ; CHECK-NEXT: [[DEC64r2:%[0-9]+]]:gr64_nosp = DEC64r [[COPY7]], implicit-def dead $eflags |
| 306 | + ; CHECK-NEXT: [[LEA64r2:%[0-9]+]]:gr64 = LEA64r $rip, 1, $noreg, %jump-table.0, $noreg |
| 307 | + ; CHECK-NEXT: [[MOVSX64rm32_2:%[0-9]+]]:gr64 = MOVSX64rm32 [[DEC64r2]], 4, [[DEC64r2]], 0, $noreg :: (load (s32) from jump-table) |
| 308 | + ; CHECK-NEXT: [[ADD64rr2:%[0-9]+]]:gr64 = ADD64rr [[LEA64r2]], [[MOVSX64rm32_2]], implicit-def dead $eflags |
| 309 | + ; CHECK-NEXT: [[COPY8:%[0-9]+]]:gr64 = COPY [[COPY7]] |
| 310 | + ; CHECK-NEXT: JMP64r [[ADD64rr2]] |
| 311 | + ; CHECK-NEXT: {{ $}} |
| 312 | + ; CHECK-NEXT: bb.5: |
| 313 | + ; CHECK-NEXT: successors: %bb.3(0x1999999a), %bb.4(0x1999999a), %bb.5(0x1999999a), %bb.6(0x1999999a), %bb.7(0x1999999a) |
| 314 | + ; CHECK-NEXT: {{ $}} |
| 315 | + ; CHECK-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp |
| 316 | + ; CHECK-NEXT: CALL64pcrel32 target-flags(x86-plt) @f3, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax |
| 317 | + ; CHECK-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp |
| 318 | + ; CHECK-NEXT: [[COPY9:%[0-9]+]]:gr64 = COPY $rax |
| 319 | + ; CHECK-NEXT: [[COPY10:%[0-9]+]]:gr64 = COPY [[COPY9]] |
| 320 | + ; CHECK-NEXT: [[DEC64r3:%[0-9]+]]:gr64_nosp = DEC64r [[COPY10]], implicit-def dead $eflags |
| 321 | + ; CHECK-NEXT: [[LEA64r3:%[0-9]+]]:gr64 = LEA64r $rip, 1, $noreg, %jump-table.0, $noreg |
| 322 | + ; CHECK-NEXT: [[MOVSX64rm32_3:%[0-9]+]]:gr64 = MOVSX64rm32 [[DEC64r3]], 4, [[DEC64r3]], 0, $noreg :: (load (s32) from jump-table) |
| 323 | + ; CHECK-NEXT: [[ADD64rr3:%[0-9]+]]:gr64 = ADD64rr [[LEA64r3]], [[MOVSX64rm32_3]], implicit-def dead $eflags |
| 324 | + ; CHECK-NEXT: [[COPY11:%[0-9]+]]:gr64 = COPY [[COPY10]] |
| 325 | + ; CHECK-NEXT: JMP64r [[ADD64rr3]] |
| 326 | + ; CHECK-NEXT: {{ $}} |
| 327 | + ; CHECK-NEXT: bb.6: |
| 328 | + ; CHECK-NEXT: successors: %bb.3(0x1999999a), %bb.4(0x1999999a), %bb.5(0x1999999a), %bb.6(0x1999999a), %bb.7(0x1999999a) |
| 329 | + ; CHECK-NEXT: {{ $}} |
| 330 | + ; CHECK-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp |
| 331 | + ; CHECK-NEXT: CALL64pcrel32 target-flags(x86-plt) @f4, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax |
| 332 | + ; CHECK-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp |
| 333 | + ; CHECK-NEXT: [[COPY12:%[0-9]+]]:gr64 = COPY $rax |
| 334 | + ; CHECK-NEXT: [[COPY13:%[0-9]+]]:gr64 = COPY [[COPY12]] |
| 335 | + ; CHECK-NEXT: [[DEC64r4:%[0-9]+]]:gr64_nosp = DEC64r [[COPY13]], implicit-def dead $eflags |
| 336 | + ; CHECK-NEXT: [[LEA64r4:%[0-9]+]]:gr64 = LEA64r $rip, 1, $noreg, %jump-table.0, $noreg |
| 337 | + ; CHECK-NEXT: [[MOVSX64rm32_4:%[0-9]+]]:gr64 = MOVSX64rm32 [[DEC64r4]], 4, [[DEC64r4]], 0, $noreg :: (load (s32) from jump-table) |
| 338 | + ; CHECK-NEXT: [[ADD64rr4:%[0-9]+]]:gr64 = ADD64rr [[LEA64r4]], [[MOVSX64rm32_4]], implicit-def dead $eflags |
| 339 | + ; CHECK-NEXT: [[COPY14:%[0-9]+]]:gr64 = COPY [[COPY13]] |
| 340 | + ; CHECK-NEXT: JMP64r [[ADD64rr4]] |
| 341 | + ; CHECK-NEXT: {{ $}} |
| 342 | + ; CHECK-NEXT: bb.7: |
| 343 | + ; CHECK-NEXT: successors: %bb.3(0x1999999a), %bb.4(0x1999999a), %bb.5(0x1999999a), %bb.6(0x1999999a), %bb.7(0x1999999a) |
| 344 | + ; CHECK-NEXT: {{ $}} |
| 345 | + ; CHECK-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp |
| 346 | + ; CHECK-NEXT: CALL64pcrel32 target-flags(x86-plt) @f5, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax |
| 347 | + ; CHECK-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp |
| 348 | + ; CHECK-NEXT: [[COPY15:%[0-9]+]]:gr64 = COPY $rax |
| 349 | + ; CHECK-NEXT: [[COPY16:%[0-9]+]]:gr64 = COPY [[COPY15]] |
| 350 | + ; CHECK-NEXT: [[DEC64r5:%[0-9]+]]:gr64_nosp = DEC64r [[COPY16]], implicit-def dead $eflags |
| 351 | + ; CHECK-NEXT: [[LEA64r5:%[0-9]+]]:gr64 = LEA64r $rip, 1, $noreg, %jump-table.0, $noreg |
| 352 | + ; CHECK-NEXT: [[MOVSX64rm32_5:%[0-9]+]]:gr64 = MOVSX64rm32 [[DEC64r5]], 4, [[DEC64r5]], 0, $noreg :: (load (s32) from jump-table) |
| 353 | + ; CHECK-NEXT: [[ADD64rr5:%[0-9]+]]:gr64 = ADD64rr [[LEA64r5]], [[MOVSX64rm32_5]], implicit-def dead $eflags |
| 354 | + ; CHECK-NEXT: [[COPY17:%[0-9]+]]:gr64 = COPY [[COPY16]] |
| 355 | + ; CHECK-NEXT: JMP64r [[ADD64rr5]] |
| 356 | + ; CHECK-NEXT: {{ $}} |
| 357 | + ; CHECK-NEXT: bb.8: |
| 358 | + bb.0: |
| 359 | + ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp |
| 360 | + CALL64pcrel32 target-flags(x86-plt) @f0, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax |
| 361 | + ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp |
| 362 | + %7:gr64 = COPY $rax |
| 363 | + %0:gr64 = COPY %7 |
| 364 | +
|
| 365 | + bb.1: |
| 366 | + %1:gr64 = PHI %0, %bb.0, %6, %bb.6, %5, %bb.5, %4, %bb.4, %3, %bb.3, %2, %bb.2 |
| 367 | + %8:gr64_nosp = DEC64r %1, implicit-def dead $eflags |
| 368 | +
|
| 369 | + bb.8: |
| 370 | + successors: %bb.2(0x1999999a), %bb.3(0x1999999a), %bb.4(0x1999999a), %bb.5(0x1999999a), %bb.6(0x1999999a) |
| 371 | +
|
| 372 | + %14:gr64 = LEA64r $rip, 1, $noreg, %jump-table.0, $noreg |
| 373 | + %15:gr64 = MOVSX64rm32 %8, 4, %8, 0, $noreg :: (load (s32) from jump-table) |
| 374 | + %16:gr64 = ADD64rr %14, killed %15, implicit-def dead $eflags |
| 375 | + JMP64r killed %16 |
| 376 | +
|
| 377 | + bb.2: |
| 378 | + ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp |
| 379 | + CALL64pcrel32 target-flags(x86-plt) @f1, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax |
| 380 | + ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp |
| 381 | + %13:gr64 = COPY $rax |
| 382 | + %2:gr64 = COPY %13 |
| 383 | + JMP_1 %bb.1 |
| 384 | +
|
| 385 | + bb.3: |
| 386 | + ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp |
| 387 | + CALL64pcrel32 target-flags(x86-plt) @f2, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax |
| 388 | + ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp |
| 389 | + %12:gr64 = COPY $rax |
| 390 | + %3:gr64 = COPY %12 |
| 391 | + JMP_1 %bb.1 |
| 392 | +
|
| 393 | + bb.4: |
| 394 | + ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp |
| 395 | + CALL64pcrel32 target-flags(x86-plt) @f3, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax |
| 396 | + ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp |
| 397 | + %11:gr64 = COPY $rax |
| 398 | + %4:gr64 = COPY %11 |
| 399 | + JMP_1 %bb.1 |
| 400 | +
|
| 401 | + bb.5: |
| 402 | + ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp |
| 403 | + CALL64pcrel32 target-flags(x86-plt) @f4, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax |
| 404 | + ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp |
| 405 | + %10:gr64 = COPY $rax |
| 406 | + %5:gr64 = COPY %10 |
| 407 | + JMP_1 %bb.1 |
| 408 | +
|
| 409 | + bb.6: |
| 410 | + ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp |
| 411 | + CALL64pcrel32 target-flags(x86-plt) @f5, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax |
| 412 | + ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp |
| 413 | + %9:gr64 = COPY $rax |
| 414 | + %6:gr64 = COPY %9 |
| 415 | + JMP_1 %bb.1 |
| 416 | +
|
| 417 | + bb.7: |
| 418 | +
|
| 419 | +... |
0 commit comments