LLVM  14.0.0git
InlineAsmLowering.h
Go to the documentation of this file.
1 //===- llvm/CodeGen/GlobalISel/InlineAsmLowering.h --------------*- 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 /// \file
10 /// This file describes how to lower LLVM inline asm to machine code INLINEASM.
11 ///
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CODEGEN_GLOBALISEL_INLINEASMLOWERING_H
15 #define LLVM_CODEGEN_GLOBALISEL_INLINEASMLOWERING_H
16 
17 #include "llvm/ADT/ArrayRef.h"
18 #include <functional>
19 
20 namespace llvm {
21 class CallBase;
22 class MachineIRBuilder;
23 class MachineOperand;
24 class Register;
25 class TargetLowering;
26 class Value;
27 
29  const TargetLowering *TLI;
30 
31  virtual void anchor();
32 
33 public:
34  /// Lower the given inline asm call instruction
35  /// \p GetOrCreateVRegs is a callback to materialize a register for the
36  /// input and output operands of the inline asm
37  /// \return True if the lowering succeeds, false otherwise.
38  bool lowerInlineAsm(MachineIRBuilder &MIRBuilder, const CallBase &CB,
40  GetOrCreateVRegs) const;
41 
42  /// Lower the specified operand into the Ops vector.
43  /// \p Val is the IR input value to be lowered
44  /// \p Constraint is the user supplied constraint string
45  /// \p Ops is the vector to be filled with the lowered operands
46  /// \return True if the lowering succeeds, false otherwise.
47  virtual bool lowerAsmOperandForConstraint(Value *Val, StringRef Constraint,
48  std::vector<MachineOperand> &Ops,
49  MachineIRBuilder &MIRBuilder) const;
50 
51 protected:
52  /// Getter for generic TargetLowering class.
53  const TargetLowering *getTLI() const { return TLI; }
54 
55  /// Getter for target specific TargetLowering class.
56  template <class XXXTargetLowering> const XXXTargetLowering *getTLI() const {
57  return static_cast<const XXXTargetLowering *>(TLI);
58  }
59 
60 public:
61  InlineAsmLowering(const TargetLowering *TLI) : TLI(TLI) {}
62  virtual ~InlineAsmLowering() = default;
63 };
64 
65 } // end namespace llvm
66 
67 #endif // LLVM_CODEGEN_GLOBALISEL_INLINEASMLOWERING_H
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::InlineAsmLowering::getTLI
const TargetLowering * getTLI() const
Getter for generic TargetLowering class.
Definition: InlineAsmLowering.h:53
llvm::InlineAsmLowering
Definition: InlineAsmLowering.h:28
llvm::InlineAsmLowering::lowerInlineAsm
bool lowerInlineAsm(MachineIRBuilder &MIRBuilder, const CallBase &CB, std::function< ArrayRef< Register >(const Value &Val)> GetOrCreateVRegs) const
Lower the given inline asm call instruction GetOrCreateVRegs is a callback to materialize a register ...
Definition: InlineAsmLowering.cpp:273
llvm::InlineAsmLowering::getTLI
const XXXTargetLowering * getTLI() const
Getter for target specific TargetLowering class.
Definition: InlineAsmLowering.h:56
llvm::TargetLowering
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
Definition: TargetLowering.h:3189
Register
Promote Memory to Register
Definition: Mem2Reg.cpp:110
llvm::InlineAsmLowering::InlineAsmLowering
InlineAsmLowering(const TargetLowering *TLI)
Definition: InlineAsmLowering.h:61
llvm::MachineIRBuilder
Helper class to build MachineInstr.
Definition: MachineIRBuilder.h:212
ArrayRef.h
function
print Print MemDeps of function
Definition: MemDepPrinter.cpp:83
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::CallBase
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition: InstrTypes.h:1161
llvm::InlineAsmLowering::~InlineAsmLowering
virtual ~InlineAsmLowering()=default
llvm::InlineAsmLowering::lowerAsmOperandForConstraint
virtual bool lowerAsmOperandForConstraint(Value *Val, StringRef Constraint, std::vector< MachineOperand > &Ops, MachineIRBuilder &MIRBuilder) const
Lower the specified operand into the Ops vector.
Definition: InlineAsmLowering.cpp:659
llvm::Value
LLVM Value Representation.
Definition: Value.h:75