Path: blob/main/contrib/llvm-project/llvm/lib/Target/M68k/GISel/M68kLegalizerInfo.cpp
35294 views
//===-- M68kLegalizerInfo.cpp -----------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7/// \file8/// This file implements the targeting of the Machinelegalizer class for M68k.9//===----------------------------------------------------------------------===//1011#include "M68kLegalizerInfo.h"12#include "llvm/CodeGen/GlobalISel/LegalizerHelper.h"13#include "llvm/CodeGen/GlobalISel/LegalizerInfo.h"14#include "llvm/CodeGen/TargetOpcodes.h"15#include "llvm/CodeGen/ValueTypes.h"16#include "llvm/IR/DerivedTypes.h"17#include "llvm/IR/Type.h"1819using namespace llvm;2021M68kLegalizerInfo::M68kLegalizerInfo(const M68kSubtarget &ST) {22using namespace TargetOpcode;23const LLT s8 = LLT::scalar(8);24const LLT s16 = LLT::scalar(16);25const LLT s32 = LLT::scalar(32);26const LLT p0 = LLT::pointer(0, 32);2728getActionDefinitionsBuilder({G_ADD, G_SUB, G_MUL, G_UDIV, G_AND})29.legalFor({s8, s16, s32})30.clampScalar(0, s8, s32)31.widenScalarToNextPow2(0, 8);3233getActionDefinitionsBuilder(G_CONSTANT)34.legalFor({s32, p0})35.clampScalar(0, s32, s32);3637getActionDefinitionsBuilder({G_FRAME_INDEX, G_GLOBAL_VALUE}).legalFor({p0});3839getActionDefinitionsBuilder({G_STORE, G_LOAD})40.legalForTypesWithMemDesc({{s32, p0, s32, 4},41{s32, p0, s16, 4},42{s32, p0, s8, 4},43{s16, p0, s16, 2},44{s8, p0, s8, 1},45{p0, p0, s32, 4}})46.clampScalar(0, s8, s32);4748getActionDefinitionsBuilder(G_PTR_ADD).legalFor({{p0, s32}});4950getLegacyLegalizerInfo().computeTables();51}525354