Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
14 pmbaty 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
 
28
class InlineAsmLowering {
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,
39
                      std::function<ArrayRef<Register>(const Value &Val)>
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