1 //===-- AMDILUtilityFunctions.h - AMDIL Utility Functions Header --------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //==-----------------------------------------------------------------------===//
10 // This file provides helper macros for expanding case statements.
12 //===----------------------------------------------------------------------===//
13 #ifndef AMDILUTILITYFUNCTIONS_H_
14 #define AMDILUTILITYFUNCTIONS_H_
16 // Macros that are used to help with switch statements for various data types
17 // However, these macro's do not return anything unlike the second set below.
18 #define ExpandCaseTo32bitIntTypes(Instr) \
21 #define ExpandCaseTo32bitIntTruncTypes(Instr) \
25 #define ExpandCaseToIntTypes(Instr) \
26 ExpandCaseTo32bitIntTypes(Instr)
28 #define ExpandCaseToIntTruncTypes(Instr) \
29 ExpandCaseTo32bitIntTruncTypes(Instr)
31 #define ExpandCaseToFloatTypes(Instr) \
34 #define ExpandCaseTo32bitScalarTypes(Instr) \
35 ExpandCaseTo32bitIntTypes(Instr) \
38 #define ExpandCaseToAllScalarTypes(Instr) \
39 ExpandCaseToFloatTypes(Instr) \
40 ExpandCaseToIntTypes(Instr)
42 #define ExpandCaseToAllScalarTruncTypes(Instr) \
43 ExpandCaseToFloatTruncTypes(Instr) \
44 ExpandCaseToIntTruncTypes(Instr)
46 #define ExpandCaseToAllTypes(Instr) \
47 ExpandCaseToAllScalarTypes(Instr)
49 #define ExpandCaseToAllTruncTypes(Instr) \
50 ExpandCaseToAllScalarTruncTypes(Instr)
52 // Macros that expand into statements with return values
53 #define ExpandCaseTo32bitIntReturn(Instr, Return) \
54 case Instr##_i32: return Return##_i32;
56 #define ExpandCaseToIntReturn(Instr, Return) \
57 ExpandCaseTo32bitIntReturn(Instr, Return)
59 #define ExpandCaseToFloatReturn(Instr, Return) \
60 case Instr##_f32: return Return##_f32;\
62 #define ExpandCaseToAllScalarReturn(Instr, Return) \
63 ExpandCaseToFloatReturn(Instr, Return) \
64 ExpandCaseToIntReturn(Instr, Return)
66 // These macros expand to common groupings of RegClass ID's
67 #define ExpandCaseTo1CompRegID \
68 case AMDGPU::GPRI32RegClassID: \
69 case AMDGPU::GPRF32RegClassID:
71 #define ExpandCaseTo32BitType(Instr) \
75 #endif // AMDILUTILITYFUNCTIONS_H_