blob: 7e7094061ecf1e095f45901718bd952d787c49e9 [file] [log] [blame]
Petar Jovanovicfac93e22018-02-23 11:06:40 +00001//===- MipsLegalizerInfo.cpp ------------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9/// \file
10/// This file implements the targeting of the Machinelegalizer class for Mips.
11/// \todo This should be generated by TableGen.
12//===----------------------------------------------------------------------===//
13
14#include "MipsLegalizerInfo.h"
Roman Tereshinf34d7ec2018-05-31 16:16:49 +000015#include "MipsTargetMachine.h"
Petar Jovanovicfac93e22018-02-23 11:06:40 +000016
17using namespace llvm;
18
19MipsLegalizerInfo::MipsLegalizerInfo(const MipsSubtarget &ST) {
Petar Jovanovic366857a2018-04-11 15:12:32 +000020 using namespace TargetOpcode;
21
22 const LLT s32 = LLT::scalar(32);
Petar Jovanovic021e4c82018-07-16 13:29:32 +000023 const LLT p0 = LLT::pointer(0, 32);
Petar Jovanovic366857a2018-04-11 15:12:32 +000024
Petar Jovanovic1fa50512018-08-26 07:25:33 +000025 getActionDefinitionsBuilder(G_ADD)
26 .legalFor({s32})
27 .minScalar(0, s32);
Petar Jovanovic366857a2018-04-11 15:12:32 +000028
Petar Jovanovic021e4c82018-07-16 13:29:32 +000029 getActionDefinitionsBuilder({G_LOAD, G_STORE})
Petar Jovanovic58c02102018-07-25 12:35:01 +000030 .legalForCartesianProduct({p0, s32}, {p0});
Petar Jovanovic021e4c82018-07-16 13:29:32 +000031
Petar Jovanovic3b953c32018-08-21 08:15:56 +000032 getActionDefinitionsBuilder({G_AND, G_OR, G_XOR, G_SHL, G_ASHR, G_LSHR})
33 .legalFor({s32});
34
Petar Jovanovic021e4c82018-07-16 13:29:32 +000035 getActionDefinitionsBuilder(G_CONSTANT)
36 .legalFor({s32});
37
38 getActionDefinitionsBuilder(G_GEP)
39 .legalFor({{p0, s32}});
40
41 getActionDefinitionsBuilder(G_FRAME_INDEX)
42 .legalFor({p0});
43
Petar Jovanovic64c10ba2018-08-01 09:03:23 +000044 getActionDefinitionsBuilder(G_GLOBAL_VALUE)
45 .legalFor({p0});
46
Petar Jovanovicfac93e22018-02-23 11:06:40 +000047 computeTables();
Roman Tereshinf34d7ec2018-05-31 16:16:49 +000048 verify(*ST.getInstrInfo());
Petar Jovanovicfac93e22018-02-23 11:06:40 +000049}