blob: 7157af1ec16d244cbdb1843d3fd3d70e6bf1ef4d [file] [log] [blame]
Diana Picus22274932016-11-11 08:27:37 +00001//===- ARMLegalizerInfo.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 ARM.
11/// \todo This should be generated by TableGen.
12//===----------------------------------------------------------------------===//
13
14#include "ARMLegalizerInfo.h"
15#include "llvm/CodeGen/ValueTypes.h"
16#include "llvm/IR/DerivedTypes.h"
17#include "llvm/IR/Type.h"
18#include "llvm/Target/TargetOpcodes.h"
19
20using namespace llvm;
21
22#ifndef LLVM_BUILD_GLOBAL_ISEL
23#error "You shouldn't build this"
24#endif
25
26ARMLegalizerInfo::ARMLegalizerInfo() {
Diana Picus812caee2016-12-16 12:54:46 +000027 using namespace TargetOpcode;
Diana Picus5a724452016-12-19 14:07:56 +000028
Diana Picus519807f2016-12-19 11:26:31 +000029 const LLT p0 = LLT::pointer(0, 32);
Diana Picus5a724452016-12-19 14:07:56 +000030
Diana Picusd83df5d2017-01-25 08:47:40 +000031 const LLT s1 = LLT::scalar(1);
Diana Picus5a724452016-12-19 14:07:56 +000032 const LLT s8 = LLT::scalar(8);
33 const LLT s16 = LLT::scalar(16);
Diana Picus812caee2016-12-16 12:54:46 +000034 const LLT s32 = LLT::scalar(32);
35
Diana Picus519807f2016-12-19 11:26:31 +000036 setAction({G_FRAME_INDEX, p0}, Legal);
37
38 setAction({G_LOAD, s32}, Legal);
39 setAction({G_LOAD, 1, p0}, Legal);
40
Diana Picusd83df5d2017-01-25 08:47:40 +000041 for (auto Ty : {s1, s8, s16, s32})
Diana Picus5a724452016-12-19 14:07:56 +000042 setAction({G_ADD, Ty}, Legal);
Diana Picus812caee2016-12-16 12:54:46 +000043
Diana Picus8b6c6be2017-01-25 08:10:40 +000044 for (auto Op : {G_SEXT, G_ZEXT}) {
45 setAction({Op, s32}, Legal);
Diana Picusd83df5d2017-01-25 08:47:40 +000046 for (auto Ty : {s1, s8, s16})
Diana Picus8b6c6be2017-01-25 08:10:40 +000047 setAction({Op, 1, Ty}, Legal);
48 }
49
Diana Picus22274932016-11-11 08:27:37 +000050 computeTables();
51}