Tim Northover | 33b07d6 | 2016-07-22 20:03:43 +0000 | [diff] [blame] | 1 | //===- AArch64MachineLegalizer.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 |
| 11 | /// AArch64. |
| 12 | /// \todo This should be generated by TableGen. |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #include "AArch64MachineLegalizer.h" |
| 16 | #include "llvm/CodeGen/ValueTypes.h" |
| 17 | #include "llvm/IR/Type.h" |
| 18 | #include "llvm/IR/DerivedTypes.h" |
| 19 | #include "llvm/Target/TargetOpcodes.h" |
| 20 | |
| 21 | using namespace llvm; |
| 22 | |
| 23 | #ifndef LLVM_BUILD_GLOBAL_ISEL |
| 24 | #error "You shouldn't build this" |
| 25 | #endif |
| 26 | |
| 27 | AArch64MachineLegalizer::AArch64MachineLegalizer() { |
Ahmed Bougacha | ad30db3 | 2016-08-02 15:10:28 +0000 | [diff] [blame] | 28 | using namespace TargetOpcode; |
Tim Northover | 9656f14 | 2016-08-04 20:54:13 +0000 | [diff] [blame] | 29 | const LLT s8 = LLT::scalar(8); |
| 30 | const LLT s16 = LLT::scalar(16); |
Ahmed Bougacha | ad30db3 | 2016-08-02 15:10:28 +0000 | [diff] [blame] | 31 | const LLT s32 = LLT::scalar(32); |
| 32 | const LLT s64 = LLT::scalar(64); |
| 33 | const LLT v2s32 = LLT::vector(2, 32); |
| 34 | const LLT v4s32 = LLT::vector(4, 32); |
| 35 | const LLT v2s64 = LLT::vector(2, 64); |
| 36 | |
Tim Northover | 61c1614 | 2016-08-04 21:39:49 +0000 | [diff] [blame] | 37 | for (auto BinOp : {G_ADD, G_SUB, G_MUL, G_AND, G_OR, G_XOR}) { |
Ahmed Bougacha | ad30db3 | 2016-08-02 15:10:28 +0000 | [diff] [blame] | 38 | for (auto Ty : {s32, s64, v2s32, v4s32, v2s64}) |
| 39 | setAction(BinOp, Ty, Legal); |
| 40 | |
Tim Northover | 9656f14 | 2016-08-04 20:54:13 +0000 | [diff] [blame] | 41 | for (auto Ty : {s8, s16}) |
| 42 | setAction(BinOp, Ty, WidenScalar); |
| 43 | } |
| 44 | |
Ahmed Bougacha | ad30db3 | 2016-08-02 15:10:28 +0000 | [diff] [blame] | 45 | for (auto MemOp : {G_LOAD, G_STORE}) |
| 46 | for (auto Ty : {s32, s64}) |
| 47 | setAction(MemOp, Ty, Legal); |
| 48 | |
Tim Northover | 9656f14 | 2016-08-04 20:54:13 +0000 | [diff] [blame] | 49 | |
Ahmed Bougacha | ad30db3 | 2016-08-02 15:10:28 +0000 | [diff] [blame] | 50 | setAction(G_BR, LLT::unsized(), Legal); |
| 51 | |
Tim Northover | 33b07d6 | 2016-07-22 20:03:43 +0000 | [diff] [blame] | 52 | computeTables(); |
| 53 | } |