LLVM  9.0.0svn
IntrinsicLowering.h
Go to the documentation of this file.
1 //===-- IntrinsicLowering.h - Intrinsic Function 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 defines the IntrinsicLowering interface. This interface allows
10 // addition of domain-specific or front-end specific intrinsics to LLVM without
11 // having to modify all of the C backend or interpreter.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_CODEGEN_INTRINSICLOWERING_H
16 #define LLVM_CODEGEN_INTRINSICLOWERING_H
17 
18 #include "llvm/IR/Intrinsics.h"
19 
20 namespace llvm {
21 class CallInst;
22 class Module;
23 class DataLayout;
24 
26  const DataLayout &DL;
27 
28  bool Warned;
29 
30 public:
31  explicit IntrinsicLowering(const DataLayout &DL) : DL(DL), Warned(false) {}
32 
33  /// Replace a call to the specified intrinsic function.
34  /// If an intrinsic function must be implemented by the code generator
35  /// (such as va_start), this function should print a message and abort.
36  ///
37  /// Otherwise, if an intrinsic function call can be lowered, the code to
38  /// implement it (often a call to a non-intrinsic function) is inserted
39  /// _after_ the call instruction and the call is deleted. The caller must
40  /// be capable of handling this kind of change.
41  void LowerIntrinsicCall(CallInst *CI);
42 
43  /// Try to replace a call instruction with a call to a bswap intrinsic. Return
44  /// false if the call is not a simple integer bswap.
45  static bool LowerToByteSwap(CallInst *CI);
46 };
47 }
48 
49 #endif
A parsed version of the target data layout string in and methods for querying it. ...
Definition: DataLayout.h:110
This class represents lattice values for constants.
Definition: AllocatorList.h:23
This class represents a function call, abstracting a target machine's calling convention.
static bool LowerToByteSwap(CallInst *CI)
Try to replace a call instruction with a call to a bswap intrinsic.
void LowerIntrinsicCall(CallInst *CI)
Replace a call to the specified intrinsic function.
IntrinsicLowering(const DataLayout &DL)