File: RuntimeLibcallEmitter-conflict-warning.td

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,245,028 kB
  • sloc: cpp: 7,619,726; ansic: 1,434,018; asm: 1,058,748; python: 252,740; f90: 94,671; objc: 70,685; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,675; awk: 3,523; javascript: 2,409; xml: 892; fortran: 770
file content (60 lines) | stat: -rw-r--r-- 2,449 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// RUN: llvm-tblgen -gen-runtime-libcalls -I %p/../../include %s 2> %t.err | FileCheck %s
// RUN: FileCheck -check-prefix=ERR %s < %t.err

// Check behavior of libcall emission when multiple RuntimeLibcallImpl
// implementations provide the same RuntimeLibcall

include "llvm/IR/RuntimeLibcallsImpl.td"

def SOME_FUNC : RuntimeLibcall;
def OTHER_FUNC : RuntimeLibcall;
def ANOTHER_DUP : RuntimeLibcall;

def isTargetArchA : RuntimeLibcallPredicate<[{isTargetArchA()}]>;
def isTargetArchB : RuntimeLibcallPredicate<[{isTargetArchB()}]>;
def isTargetArchC : RuntimeLibcallPredicate<[{isTargetArchC()}]>;

def func_a : RuntimeLibcallImpl<SOME_FUNC>;
def func_b : RuntimeLibcallImpl<SOME_FUNC>;
def func_c : RuntimeLibcallImpl<SOME_FUNC>;
def other_func : RuntimeLibcallImpl<OTHER_FUNC>;

def dup0 : RuntimeLibcallImpl<ANOTHER_DUP>;
def dup1 : RuntimeLibcallImpl<ANOTHER_DUP>;

// func_a and func_b both provide SOME_FUNC.

// CHECK: if (isTargetArchA()) {
// CHECK-NEXT: static const LibcallImplPair LibraryCalls[] = {
// CHECK-NEXT:   {RTLIB::SOME_FUNC, RTLIB::func_b}, // func_b
// CHECK-NEXT: };

// ERR: :[[@LINE+1]]:5: warning: conflicting implementations for libcall SOME_FUNC: func_b, func_a
def TheSystemLibraryA : SystemRuntimeLibrary<isTargetArchA,
  (add func_b, func_a)
>;

// CHECK: if (isTargetArchB()) {
// CHECK-NEXT: static const LibcallImplPair LibraryCalls[] = {
// CHECK-NEXT:   {RTLIB::OTHER_FUNC, RTLIB::other_func}, // other_func
// CHECK-NEXT:  {RTLIB::SOME_FUNC, RTLIB::func_a}, // func_a
// CHECK-NEXT: };

// ERR: :[[@LINE+1]]:5: warning: conflicting implementations for libcall SOME_FUNC: func_a, func_b
def TheSystemLibraryB : SystemRuntimeLibrary<isTargetArchB,
  (add func_a, other_func, func_b)
>;

// CHECK: if (isTargetArchC()) {
// CHECK-NEXT: static const LibcallImplPair LibraryCalls[] = {
// CHECK-NEXT:   {RTLIB::ANOTHER_DUP, RTLIB::dup1}, // dup1
// CHECK-NEXT:   {RTLIB::OTHER_FUNC, RTLIB::other_func}, // other_func
// CHECK-NEXT:   {RTLIB::SOME_FUNC, RTLIB::func_a}, // func_a
// CHECK-NEXT: };

// ERR: :[[@LINE+3]]:5: warning: conflicting implementations for libcall ANOTHER_DUP: dup1, dup0
// ERR: :[[@LINE+2]]:5: warning: conflicting implementations for libcall SOME_FUNC: func_a, func_b
// ERR: :[[@LINE+1]]:5: warning: conflicting implementations for libcall SOME_FUNC: func_a, func_c
def TheSystemLibraryC : SystemRuntimeLibrary<isTargetArchC,
  (add func_a, dup1, other_func, func_b, func_c, dup0)
>;