brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.8 KiB · 94e2e36 Raw
83 lines · plain
1; RUN: opt -passes=verify -S < %s | FileCheck %s2 3; Tests the name mangling performed by the codepath following4; getMangledTypeStr(). Only tests that code with the various manglings5; run fine: doesn't actually test the mangling with the type of the6; arguments. Meant to serve as an example-document on how the user7; should do name manglings.8 9; Exercise the most general case, llvm_anyptr_type, using gc.relocate10; and gc.statepoint. Note that it has nothing to do with gc.*11; functions specifically: any function that accepts llvm_anyptr_type12; will serve the purpose.13 14; function and integer15define ptr addrspace(1) @test_iAny(ptr addrspace(1) %v) gc "statepoint-example" {16       %tok = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(i1 ()) @return_i1, i32 0, i32 0, i32 0, i32 0) ["gc-live"(ptr addrspace(1) %v)]17       %v-new = call ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %tok,  i32 0, i32 0)18       ret ptr addrspace(1) %v-new19}20 21; float22define ptr addrspace(1) @test_fAny(ptr addrspace(1) %v) gc "statepoint-example" {23       %tok = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(i1 ()) @return_i1, i32 0, i32 0, i32 0, i32 0) ["gc-live"(ptr addrspace(1) %v)]24       %v-new = call ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %tok,  i32 0, i32 0)25       ret ptr addrspace(1) %v-new26}27 28; array of integers29define ptr addrspace(1) @test_aAny(ptr addrspace(1) %v) gc "statepoint-example" {30       %tok = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(i1 ()) @return_i1, i32 0, i32 0, i32 0, i32 0) ["gc-live"(ptr addrspace(1) %v)]31       %v-new = call ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %tok,  i32 0, i32 0)32       ret ptr addrspace(1) %v-new33}34 35; vector of integers36define ptr addrspace(1) @test_vAny(ptr addrspace(1) %v) gc "statepoint-example" {37       %tok = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(i1 ()) @return_i1, i32 0, i32 0, i32 0, i32 0) ["gc-live"(ptr addrspace(1) %v)]38       %v-new = call ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %tok,  i32 0, i32 0)39       ret ptr addrspace(1) %v-new40}41 42%struct.test = type { i32, i1 }43 44; struct45define ptr addrspace(1) @test_struct(ptr addrspace(1) %v) gc "statepoint-example" {46       %tok = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(i1 ()) @return_i1, i32 0, i32 0, i32 0, i32 0) ["gc-live"(ptr addrspace(1) %v)]47       %v-new = call ptr addrspace(1) @llvm.experimental.gc.relocate.p1.tests(token %tok,  i32 0, i32 0)48       ret ptr addrspace(1) %v-new49}50 51; literal struct with nested literal struct52define ptr addrspace(1) @test_literal_struct(ptr addrspace(1) %v) gc "statepoint-example" {53       %tok = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(i1 ()) @return_i1, i32 0, i32 0, i32 0, i32 0) ["gc-live"(ptr addrspace(1) %v)]54       %v-new = call ptr addrspace(1) @llvm.experimental.gc.relocate.p1.test(token %tok,  i32 0, i32 0)55       ret ptr addrspace(1) %v-new56}57; struct with a horrible name, broken when structs were unprefixed58%i32 = type { i32 }59 60define ptr addrspace(1) @test_i32_struct(ptr addrspace(1) %v) gc "statepoint-example" {61entry:62      %tok = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(i1 ()) @return_i1, i32 0, i32 0, i32 0, i32 0) ["gc-live"(ptr addrspace(1) %v)]63      %v-new = call ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %tok,  i32 0, i32 0)64      ret ptr addrspace(1) %v-new65}66; completely broken intrinsic naming due to needing remangling. Just use random naming to test67 68define ptr addrspace(1) @test_broken_names(ptr addrspace(1) %v) gc "statepoint-example" {69entry:70      %tok = call fastcc token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.deadbeef(i64 0, i32 0, ptr elementtype(i1 ()) @return_i1, i32 0, i32 0, i32 0, i32 0) ["gc-live"(ptr addrspace(1) %v)]71; Make sure we do not destroy the calling convention when remangling72; CHECK: fastcc73      %v-new = call ptr addrspace(1) @llvm.experimental.gc.relocate.beefdead(token %tok,  i32 0, i32 0)74      ret ptr addrspace(1) %v-new75}76declare zeroext i1 @return_i1()77declare token @llvm.experimental.gc.statepoint.p0(i64, i32, ptr, i32, i32, ...)78declare ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token, i32, i32)79declare ptr addrspace(1) @llvm.experimental.gc.relocate.p1.tests(token, i32, i32)80declare ptr addrspace(1) @llvm.experimental.gc.relocate.p1.test(token, i32, i32)81declare ptr addrspace(1) @llvm.experimental.gc.relocate.beefdead(token, i32, i32)82declare token @llvm.experimental.gc.statepoint.deadbeef(i64, i32, ptr, i32, i32, ...)83