source: CLRX/CLRadeonExtender/trunk/tests/amdasm/AsmRegAlloc.h @ 3887

Last change on this file since 3887 was 3887, checked in by matszpk, 16 months ago

CLRadeonExtender: Divide AsmRegAlloc? testsuite to two parts.

File size: 2.7 KB
Line 
1/*
2 *  CLRadeonExtender - Unofficial OpenCL Radeon Extensions Library
3 *  Copyright (C) 2014-2018 Mateusz Szpakowski
4 *
5 *  This library is free software; you can redistribute it and/or
6 *  modify it under the terms of the GNU Lesser General Public
7 *  License as published by the Free Software Foundation; either
8 *  version 2.1 of the License, or (at your option) any later version.
9 *
10 *  This library is distributed in the hope that it will be useful,
11 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 *  Lesser General Public License for more details.
14 *
15 *  You should have received a copy of the GNU Lesser General Public
16 *  License along with this library; if not, write to the Free Software
17 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
18 */
19
20#ifndef __CLRXTEST_ASMREGALLOC_H__
21#define __CLRXTEST_ASMREGALLOC_H__
22
23#include <CLRX/Config.h>
24#include <algorithm>
25#include <iostream>
26#include <string>
27#include <cstring>
28#include <CLRX/utils/Utilities.h>
29#include <CLRX/amdasm/Assembler.h>
30#include <CLRX/utils/Containers.h>
31#include "../TestUtils.h"
32
33using namespace CLRX;
34
35typedef AsmRegAllocator::CodeBlock CodeBlock;
36typedef AsmRegAllocator::NextBlock NextBlock;
37
38struct CCodeBlock
39{
40    size_t start, end; // place in code
41    Array<NextBlock> nexts; ///< nexts blocks
42    bool haveCalls;
43    bool haveReturn;
44    bool haveEnd;
45};
46
47struct AsmCodeStructCase
48{
49    const char* input;
50    Array<CCodeBlock> codeBlocks;
51    bool good;
52    const char* errorMessages;
53};
54
55typedef AsmRegAllocator::SSAInfo SSAInfo;
56typedef AsmRegAllocator::SSAReplace SSAReplace;
57typedef AsmRegAllocator::SSAReplacesMap SSAReplacesMap;
58
59struct TestSingleVReg
60{
61    CString name;
62    uint16_t index;
63   
64    bool operator==(const TestSingleVReg& b) const
65    { return name==b.name && index==b.index; }
66    bool operator!=(const TestSingleVReg& b) const
67    { return name!=b.name || index!=b.index; }
68    bool operator<(const TestSingleVReg& b) const
69    { return name<b.name || (name==b.name && index<b.index); }
70};
71
72struct TestSingleVReg2
73{
74    const char* name;
75    uint16_t index;
76};
77
78struct CCodeBlock2
79{
80    size_t start, end; // place in code
81    Array<NextBlock> nexts; ///< nexts blocks
82    Array<std::pair<TestSingleVReg2, SSAInfo> > ssaInfos;
83    bool haveCalls;
84    bool haveReturn;
85    bool haveEnd;
86};
87
88struct AsmSSADataCase
89{
90    const char* input;
91    Array<CCodeBlock2> codeBlocks;
92    Array<std::pair<TestSingleVReg2, Array<SSAReplace> > > ssaReplaces;
93    bool good;
94    const char* errorMessages;
95};
96
97extern const AsmCodeStructCase codeStructTestCases1Tbl[];
98extern const AsmSSADataCase ssaDataTestCases1Tbl[];
99extern const AsmSSADataCase ssaDataTestCases2Tbl[];
100
101#endif
Note: See TracBrowser for help on using the repository browser.