mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-29 07:46:08 +00:00

Currently TableGen does not directly detect duplicate synthesized registers as can happen in this example: def GPR128 : RegisterTuples<[sub0, sub1, sub2, sub3], [(decimate (shl GPR32, 0), 1), (decimate (shl GPR32, 1), 1), (decimate (shl GPR32, 2), 1), (decimate (shl GPR32, 3), 1)]>; def GPR128_Aligned : RegisterTuples<[sub0, sub1, sub2, sub3], [(decimate (shl GPR32, 0), 4), (decimate (shl GPR32, 1), 4), (decimate (shl GPR32, 2), 4), (decimate (shl GPR32, 3), 4)]>; TableGen does fail, but with an unrelated and difficult to understand error that happens downstream of tuple expansion: "error: No SubRegIndex for R0_R1_R2_R3 in R0_R1_R2_R3". This patch detects the problem directly during expansion and emits an error pointing the user to the actual issue: "error: Register tuple redefines register 'R0_R1_R2_R3'".
11 lines
535 B
TableGen
11 lines
535 B
TableGen
// RUN: not llvm-tblgen -gen-register-info -I %p/../../include -I %p/Common %s 2>&1 | FileCheck %s
|
|
|
|
include "reg-with-subregs-common.td"
|
|
|
|
// CHECK: error: Register tuple redefines register 'R0_R1_R2_R3'
|
|
def GPR128_Aligned : RegisterTuples<[sub0, sub1, sub2, sub3],
|
|
[(decimate (shl GPR32, 0), 4),
|
|
(decimate (shl GPR32, 1), 4),
|
|
(decimate (shl GPR32, 2), 4),
|
|
(decimate (shl GPR32, 3), 4)]>;
|