Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
SPIRVInlineAsmLowering.cpp
Go to the documentation of this file.
1//===--- SPIRVInlineAsmLowering.cpp - Inline Asm lowering -------*- 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//
9// This file implements the lowering of LLVM inline asm calls to machine code
10// calls for GlobalISel.
11//
12//===----------------------------------------------------------------------===//
13
15#include "SPIRVSubtarget.h"
17#include "llvm/IR/IntrinsicsSPIRV.h"
18
19using namespace llvm;
20
23
25 Value *Val, StringRef Constraint, std::vector<MachineOperand> &Ops,
26 MachineIRBuilder &MIRBuilder) const {
27 Value *ValOp = nullptr;
28 if (isa<ConstantInt>(Val)) {
29 ValOp = Val;
30 } else if (ConstantFP *CFP = dyn_cast<ConstantFP>(Val)) {
31 Ops.push_back(MachineOperand::CreateFPImm(CFP));
32 return true;
33 } else if (auto *II = dyn_cast<IntrinsicInst>(Val)) {
34 if (II->getIntrinsicID() == Intrinsic::spv_track_constant) {
35 if (isa<ConstantInt>(II->getOperand(0))) {
36 ValOp = II->getOperand(0);
37 } else if (ConstantFP *CFP = dyn_cast<ConstantFP>(II->getOperand(0))) {
38 Ops.push_back(MachineOperand::CreateFPImm(CFP));
39 return true;
40 }
41 }
42 }
44 ValOp, Constraint, Ops, MIRBuilder)
45 : false;
46}
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
uint64_t IntrinsicInst * II
ConstantFP - Floating Point Values [float, double].
Definition Constants.h:277
InlineAsmLowering(const TargetLowering *TLI)
virtual bool lowerAsmOperandForConstraint(Value *Val, StringRef Constraint, std::vector< MachineOperand > &Ops, MachineIRBuilder &MIRBuilder) const
Lower the specified operand into the Ops vector.
Helper class to build MachineInstr.
static MachineOperand CreateFPImm(const ConstantFP *CFP)
SPIRVInlineAsmLowering(const SPIRVTargetLowering &TLI)
bool lowerAsmOperandForConstraint(Value *Val, StringRef Constraint, std::vector< MachineOperand > &Ops, MachineIRBuilder &MIRBuilder) const override
Lower the specified operand into the Ops vector.
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
LLVM Value Representation.
Definition Value.h:75
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:649
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Definition Casting.h:548