LLVM 19.0.0git
M68kLegalizerInfo.cpp
Go to the documentation of this file.
1//===-- M68kLegalizerInfo.cpp -----------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8/// \file
9/// This file implements the targeting of the Machinelegalizer class for M68k.
10//===----------------------------------------------------------------------===//
11
12#include "M68kLegalizerInfo.h"
18#include "llvm/IR/Type.h"
19
20using namespace llvm;
21
23 using namespace TargetOpcode;
24 const LLT s8 = LLT::scalar(8);
25 const LLT s16 = LLT::scalar(16);
26 const LLT s32 = LLT::scalar(32);
27 const LLT p0 = LLT::pointer(0, 32);
28
29 getActionDefinitionsBuilder({G_ADD, G_SUB, G_MUL, G_UDIV, G_AND})
30 .legalFor({s8, s16, s32})
31 .clampScalar(0, s8, s32)
33
35 .legalFor({s32, p0})
36 .clampScalar(0, s32, s32);
37
38 getActionDefinitionsBuilder({G_FRAME_INDEX, G_GLOBAL_VALUE}).legalFor({p0});
39
40 getActionDefinitionsBuilder({G_STORE, G_LOAD})
41 .legalForTypesWithMemDesc({{s32, p0, s32, 4},
42 {s32, p0, s16, 4},
43 {s32, p0, s8, 4},
44 {s16, p0, s16, 2},
45 {s8, p0, s8, 1},
46 {p0, p0, s32, 4}})
47 .clampScalar(0, s8, s32);
48
49 getActionDefinitionsBuilder(G_PTR_ADD).legalFor({{p0, s32}});
50
52}
Interface for Targets to specify which operations they can successfully select and how the others sho...
This file declares the targeting of the MachineLegalizer class for M68k.
static constexpr LLT scalar(unsigned SizeInBits)
Get a low-level scalar or aggregate "bag of bits".
Definition: LowLevelType.h:42
static constexpr LLT pointer(unsigned AddressSpace, unsigned SizeInBits)
Get a low-level pointer in the given address space.
Definition: LowLevelType.h:49
void computeTables()
Compute any ancillary tables needed to quickly decide how an operation should be handled.
LegalizeRuleSet & legalFor(std::initializer_list< LLT > Types)
The instruction is legal when type index 0 is any type in the given list.
LegalizeRuleSet & widenScalarToNextPow2(unsigned TypeIdx, unsigned MinSize=0)
Widen the scalar to the next power of two that is at least MinSize.
LegalizeRuleSet & getActionDefinitionsBuilder(unsigned Opcode)
Get the action definition builder for the given opcode.
const LegacyLegalizerInfo & getLegacyLegalizerInfo() const
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
M68kLegalizerInfo(const M68kSubtarget &ST)