2004-06-20 07:40:46 +00:00
|
|
|
//===-- IntrinsicLowering.h - Intrinsic Function Lowering -------*- C++ -*-===//
|
2005-04-21 20:39:54 +00:00
|
|
|
//
|
2003-12-28 08:19:13 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 19:59:42 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-21 20:39:54 +00:00
|
|
|
//
|
2003-12-28 08:19:13 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2005-04-21 20:39:54 +00:00
|
|
|
//
|
2003-12-28 08:19:13 +00:00
|
|
|
// This file defines the IntrinsicLowering interface. This interface allows
|
|
|
|
// addition of domain-specific or front-end specific intrinsics to LLVM without
|
2006-11-15 18:00:10 +00:00
|
|
|
// having to modify all of the C backend or interpreter.
|
2003-12-28 08:19:13 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2004-06-20 07:40:46 +00:00
|
|
|
#ifndef LLVM_CODEGEN_INTRINSICLOWERING_H
|
|
|
|
#define LLVM_CODEGEN_INTRINSICLOWERING_H
|
2003-12-28 08:19:13 +00:00
|
|
|
|
2003-12-28 21:23:38 +00:00
|
|
|
#include "llvm/Intrinsics.h"
|
|
|
|
|
2003-12-28 08:19:13 +00:00
|
|
|
namespace llvm {
|
|
|
|
class CallInst;
|
2004-05-09 04:29:49 +00:00
|
|
|
class Module;
|
2012-10-08 16:38:25 +00:00
|
|
|
class DataLayout;
|
2005-04-21 20:39:54 +00:00
|
|
|
|
2004-09-28 01:59:17 +00:00
|
|
|
class IntrinsicLowering {
|
2012-10-08 16:38:25 +00:00
|
|
|
const DataLayout& TD;
|
2009-06-26 20:33:47 +00:00
|
|
|
|
2009-06-25 00:04:15 +00:00
|
|
|
|
|
|
|
bool Warned;
|
2004-09-28 01:59:17 +00:00
|
|
|
public:
|
2012-10-08 16:38:25 +00:00
|
|
|
explicit IntrinsicLowering(const DataLayout &td) :
|
2009-06-26 20:33:47 +00:00
|
|
|
TD(td), Warned(false) {}
|
2003-12-28 08:19:13 +00:00
|
|
|
|
2004-05-09 04:29:49 +00:00
|
|
|
/// AddPrototypes - This method, if called, causes all of the prototypes
|
|
|
|
/// that might be needed by an intrinsic lowering implementation to be
|
|
|
|
/// inserted into the module specified.
|
2006-11-15 18:00:10 +00:00
|
|
|
void AddPrototypes(Module &M);
|
2004-05-09 04:29:49 +00:00
|
|
|
|
2007-01-28 22:26:42 +00:00
|
|
|
/// LowerIntrinsicCall - This method replaces a call with the LLVM function
|
|
|
|
/// which should be used to implement the specified intrinsic function call.
|
|
|
|
/// If an intrinsic function must be implemented by the code generator
|
|
|
|
/// (such as va_start), this function should print a message and abort.
|
2003-12-28 08:19:13 +00:00
|
|
|
///
|
|
|
|
/// Otherwise, if an intrinsic function call can be lowered, the code to
|
|
|
|
/// implement it (often a call to a non-intrinsic function) is inserted
|
|
|
|
/// _after_ the call instruction and the call is deleted. The caller must
|
|
|
|
/// be capable of handling this kind of change.
|
|
|
|
///
|
2006-11-15 18:00:10 +00:00
|
|
|
void LowerIntrinsicCall(CallInst *CI);
|
2011-01-08 01:24:27 +00:00
|
|
|
|
|
|
|
/// LowerToByteSwap - Replace a call instruction into a call to bswap
|
|
|
|
/// intrinsic. Return false if it has determined the call is not a
|
|
|
|
/// simple integer bswap.
|
|
|
|
static bool LowerToByteSwap(CallInst *CI);
|
2003-12-28 08:19:13 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|