2016-11-11 08:27:37 +00:00
|
|
|
//===- ARMLegalizerInfo.cpp --------------------------------------*- C++ -*-==//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
/// \file
|
|
|
|
/// This file implements the targeting of the Machinelegalizer class for ARM.
|
|
|
|
/// \todo This should be generated by TableGen.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "ARMLegalizerInfo.h"
|
2017-02-17 11:25:17 +00:00
|
|
|
#include "ARMSubtarget.h"
|
2016-11-11 08:27:37 +00:00
|
|
|
#include "llvm/CodeGen/ValueTypes.h"
|
|
|
|
#include "llvm/IR/DerivedTypes.h"
|
|
|
|
#include "llvm/IR/Type.h"
|
|
|
|
#include "llvm/Target/TargetOpcodes.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
#ifndef LLVM_BUILD_GLOBAL_ISEL
|
|
|
|
#error "You shouldn't build this"
|
|
|
|
#endif
|
|
|
|
|
2017-02-17 11:25:17 +00:00
|
|
|
ARMLegalizerInfo::ARMLegalizerInfo(const ARMSubtarget &ST) {
|
2016-12-16 12:54:46 +00:00
|
|
|
using namespace TargetOpcode;
|
2016-12-19 14:07:56 +00:00
|
|
|
|
2016-12-19 11:26:31 +00:00
|
|
|
const LLT p0 = LLT::pointer(0, 32);
|
2016-12-19 14:07:56 +00:00
|
|
|
|
2017-01-25 08:47:40 +00:00
|
|
|
const LLT s1 = LLT::scalar(1);
|
2016-12-19 14:07:56 +00:00
|
|
|
const LLT s8 = LLT::scalar(8);
|
|
|
|
const LLT s16 = LLT::scalar(16);
|
2016-12-16 12:54:46 +00:00
|
|
|
const LLT s32 = LLT::scalar(32);
|
2017-02-16 09:09:49 +00:00
|
|
|
const LLT s64 = LLT::scalar(64);
|
2016-12-16 12:54:46 +00:00
|
|
|
|
2016-12-19 11:26:31 +00:00
|
|
|
setAction({G_FRAME_INDEX, p0}, Legal);
|
|
|
|
|
2017-02-24 11:28:24 +00:00
|
|
|
for (unsigned Op : {G_LOAD, G_STORE}) {
|
|
|
|
for (auto Ty : {s1, s8, s16, s32, p0})
|
|
|
|
setAction({Op, Ty}, Legal);
|
|
|
|
setAction({Op, 1, p0}, Legal);
|
|
|
|
}
|
2016-12-19 11:26:31 +00:00
|
|
|
|
2017-01-25 08:47:40 +00:00
|
|
|
for (auto Ty : {s1, s8, s16, s32})
|
2016-12-19 14:07:56 +00:00
|
|
|
setAction({G_ADD, Ty}, Legal);
|
2016-12-16 12:54:46 +00:00
|
|
|
|
2017-01-27 01:30:46 +00:00
|
|
|
for (unsigned Op : {G_SEXT, G_ZEXT}) {
|
2017-01-25 08:10:40 +00:00
|
|
|
setAction({Op, s32}, Legal);
|
2017-01-25 08:47:40 +00:00
|
|
|
for (auto Ty : {s1, s8, s16})
|
2017-01-25 08:10:40 +00:00
|
|
|
setAction({Op, 1, Ty}, Legal);
|
|
|
|
}
|
|
|
|
|
2017-02-28 09:02:42 +00:00
|
|
|
setAction({G_GEP, p0}, Legal);
|
|
|
|
setAction({G_GEP, 1, s32}, Legal);
|
|
|
|
|
2017-02-17 11:25:17 +00:00
|
|
|
if (ST.hasVFP2()) {
|
|
|
|
setAction({G_FADD, s32}, Legal);
|
|
|
|
setAction({G_FADD, s64}, Legal);
|
|
|
|
|
|
|
|
setAction({G_LOAD, s64}, Legal);
|
2017-02-24 11:28:24 +00:00
|
|
|
setAction({G_STORE, s64}, Legal);
|
2017-02-17 11:25:17 +00:00
|
|
|
}
|
2017-02-08 13:23:04 +00:00
|
|
|
|
2016-11-11 08:27:37 +00:00
|
|
|
computeTables();
|
|
|
|
}
|