LLVM  8.0.1
IntrinsicLowering.h
Go to the documentation of this file.
1 //===-- IntrinsicLowering.h - Intrinsic Function Lowering -------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the IntrinsicLowering interface. This interface allows
11 // addition of domain-specific or front-end specific intrinsics to LLVM without
12 // having to modify all of the C backend or interpreter.
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_CODEGEN_INTRINSICLOWERING_H
17 #define LLVM_CODEGEN_INTRINSICLOWERING_H
18 
19 #include "llvm/IR/Intrinsics.h"
20 
21 namespace llvm {
22 class CallInst;
23 class Module;
24 class DataLayout;
25 
27  const DataLayout &DL;
28 
29  bool Warned;
30 
31 public:
32  explicit IntrinsicLowering(const DataLayout &DL) : DL(DL), Warned(false) {}
33 
34  /// Add all of the prototypes that might be needed by an intrinsic lowering
35  /// implementation to be inserted into the module specified.
36  void AddPrototypes(Module &M);
37 
38  /// Replace a call to the specified intrinsic function.
39  /// If an intrinsic function must be implemented by the code generator
40  /// (such as va_start), this function should print a message and abort.
41  ///
42  /// Otherwise, if an intrinsic function call can be lowered, the code to
43  /// implement it (often a call to a non-intrinsic function) is inserted
44  /// _after_ the call instruction and the call is deleted. The caller must
45  /// be capable of handling this kind of change.
46  void LowerIntrinsicCall(CallInst *CI);
47 
48  /// Try to replace a call instruction with a call to a bswap intrinsic. Return
49  /// false if the call is not a simple integer bswap.
50  static bool LowerToByteSwap(CallInst *CI);
51 };
52 }
53 
54 #endif
A parsed version of the target data layout string in and methods for querying it. ...
Definition: DataLayout.h:111
This class represents lattice values for constants.
Definition: AllocatorList.h:24
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:65
This class represents a function call, abstracting a target machine's calling convention.
void AddPrototypes(Module &M)
Add all of the prototypes that might be needed by an intrinsic lowering implementation to be inserted...
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)