1 //===------------------------------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "GISelMITest.h"
13 operator<<(std::ostream
&OS
, const LLT Ty
) {
15 raw_string_ostream SS
{Repr
};
22 operator<<(std::ostream
&OS
, const MachineFunction
&MF
) {
24 raw_string_ostream SS
{Repr
};
32 std::unique_ptr
<LLVMTargetMachine
>
33 AArch64GISelMITest::createTargetMachine() const {
34 Triple
TargetTriple("aarch64--");
36 const Target
*T
= TargetRegistry::lookupTarget("", TargetTriple
, Error
);
40 TargetOptions Options
;
41 return std::unique_ptr
<LLVMTargetMachine
>(
42 static_cast<LLVMTargetMachine
*>(T
->createTargetMachine(
43 "AArch64", "", "", Options
, None
, None
, CodeGenOpt::Aggressive
)));
46 void AArch64GISelMITest::getTargetTestModuleString(SmallString
<512> &S
,
47 StringRef MIRFunc
) const {
52 tracksRegLiveness: true
60 liveins: $x0, $x1, $x2, $x4
66 Twine(MIRFunc
) + Twine("...\n"))
67 .toNullTerminatedStringRef(S
);
70 std::unique_ptr
<LLVMTargetMachine
>
71 AMDGPUGISelMITest::createTargetMachine() const {
72 Triple
TargetTriple("amdgcn-amd-amdhsa");
74 const Target
*T
= TargetRegistry::lookupTarget("", TargetTriple
, Error
);
78 TargetOptions Options
;
79 return std::unique_ptr
<LLVMTargetMachine
>(
80 static_cast<LLVMTargetMachine
*>(T
->createTargetMachine(
81 "amdgcn-amd-amdhsa", "gfx900", "", Options
, None
, None
,
82 CodeGenOpt::Aggressive
)));
85 void AMDGPUGISelMITest::getTargetTestModuleString(
86 SmallString
<512> &S
, StringRef MIRFunc
) const {
91 tracksRegLiveness: true
99 liveins: $vgpr0, $vgpr1, $vgpr2
101 %0(s32) = COPY $vgpr0
102 %1(s32) = COPY $vgpr1
103 %2(s32) = COPY $vgpr2
104 )MIR") + Twine(MIRFunc
) + Twine("...\n"))
105 .toNullTerminatedStringRef(S
);