Intel SPMD Program Compiler  1.9.1
Classes | Namespaces | Macros | Enumerations | Functions
cbackend.cpp File Reference
#include "ispc.h"
#include "module.h"
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <sstream>
#include <inttypes.h>
#include "llvmutil.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/Pass.h"
#include "llvm/PassManager.h"
#include "llvm/IR/TypeFinder.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/InstIterator.h"
#include "llvm/Analysis/FindUsedTypes.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/Verifier.h"
#include <llvm/Assembly/PrintModulePass.h>
#include "llvm/Support/CallSite.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/GetElementPtrTypeIterator.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/IntrinsicLowering.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/InstVisitor.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/Host.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Config/config.h"
#include <llvm/Transforms/IPO.h>
#include <llvm/Transforms/Utils/BasicBlockUtils.h>
#include <llvm/Support/ToolOutputFile.h>
#include <algorithm>
#include "llvm/IR/Intrinsics.gen"

Go to the source code of this file.

Classes

class  constant_scanner::constant_iterator
 
class  SmearCleanupPass
 
class  AndCmpCleanupPass
 
class  MaskOpsCleanupPass
 

Namespaces

 constant_scanner
 

Macros

#define HAVE_PRINTF_A   1
 
#define ENABLE_CBE_PRINTF_A   1
 
#define GET_GCC_BUILTIN_NAME
 
#define Intrinsic   llvm::Intrinsic
 
#define GET_GCC_BUILTIN_NAME
 
#define Intrinsic   llvm::Intrinsic
 

Enumerations

enum  SpecialGlobalClass { NotSpecial = 0, GlobalCtors, GlobalDtors, NotPrinted }
 

Functions

constant_iterator constant_scanner::constant_begin (const llvm::Function *F)
 
constant_iterator constant_scanner::constant_end (const llvm::Function *F)
 
static void findUsedArrayAndLongIntTypes (const llvm::Module *m, std::vector< llvm::ArrayType * > &t, std::vector< llvm::IntegerType * > &i, std::vector< bool > &IsVolatile, std::vector< int > &Alignment)
 
static bool is_vec16_i64_ty (llvm::Type *Ty)
 
static std::string CBEMangle (const std::string &S)
 
static std::string ftostr (const llvm::APFloat &V)
 
static bool isFPCSafeToPrint (const llvm::ConstantFP *CFP)
 
static const char * lGetTypedFunc (const char *base, llvm::Type *matchType, int width)
 
static void generateCompilerSpecificCode (llvm::formatted_raw_ostream &Out, const llvm::DataLayout *TD)
 
static void FindStaticTors (llvm::GlobalVariable *GV, std::set< llvm::Function * > &StaticTors)
 
static SpecialGlobalClass getGlobalVariableClass (const llvm::GlobalVariable *GV)
 
static void PrintEscapedString (const char *Str, unsigned Length, llvm::raw_ostream &Out)
 
static void PrintEscapedString (const std::string &Str, llvm::raw_ostream &Out)
 
static bool isFPIntBitCast (const llvm::Instruction &I)
 
static const char * lPredicateToString (llvm::CmpInst::Predicate p)
 
static const char * lTypeToSuffix (llvm::Type *t)
 
static const char * getFloatBitCastField (llvm::Type *Ty)
 
static void printLimitValue (llvm::IntegerType &Ty, bool isSigned, bool isMax, llvm::raw_ostream &Out)
 
static bool isSupportedIntegerSize (llvm::IntegerType &T)
 
static bool lIsAllTrue (llvm::Value *v)
 
bool WriteCXXFile (llvm::Module *module, const char *fn, int vectorWidth, const char *includeName)
 

Macro Definition Documentation

#define ENABLE_CBE_PRINTF_A   1

Definition at line 26 of file cbackend.cpp.

#define GET_GCC_BUILTIN_NAME
#define GET_GCC_BUILTIN_NAME
#define HAVE_PRINTF_A   1

Definition at line 25 of file cbackend.cpp.

#define Intrinsic   llvm::Intrinsic
#define Intrinsic   llvm::Intrinsic

Enumeration Type Documentation

Enumerator
NotSpecial 
GlobalCtors 
GlobalDtors 
NotPrinted 

Definition at line 2321 of file cbackend.cpp.

Function Documentation

static std::string CBEMangle ( const std::string &  S)
static

Definition at line 744 of file cbackend.cpp.

static void FindStaticTors ( llvm::GlobalVariable *  GV,
std::set< llvm::Function * > &  StaticTors 
)
static

FindStaticTors - Given a static ctor/dtor list, unpack its contents into the StaticTors set.

Definition at line 2302 of file cbackend.cpp.

static void findUsedArrayAndLongIntTypes ( const llvm::Module *  m,
std::vector< llvm::ArrayType * > &  t,
std::vector< llvm::IntegerType * > &  i,
std::vector< bool > &  IsVolatile,
std::vector< int > &  Alignment 
)
static

Definition at line 384 of file cbackend.cpp.

static std::string ftostr ( const llvm::APFloat &  V)
inlinestatic

Definition at line 1181 of file cbackend.cpp.

Referenced by isFPCSafeToPrint().

static void generateCompilerSpecificCode ( llvm::formatted_raw_ostream &  Out,
const llvm::DataLayout *  TD 
)
static

Definition at line 2183 of file cbackend.cpp.

static const char* getFloatBitCastField ( llvm::Type *  Ty)
static

Definition at line 3877 of file cbackend.cpp.

static SpecialGlobalClass getGlobalVariableClass ( const llvm::GlobalVariable *  GV)
static

getGlobalVariableClass - If this is a global that is specially recognized by LLVM, return a code that indicates how we should handle it.

Definition at line 2329 of file cbackend.cpp.

References GlobalCtors, GlobalDtors, NotPrinted, and NotSpecial.

static bool is_vec16_i64_ty ( llvm::Type *  Ty)
static

Definition at line 391 of file cbackend.cpp.

static bool isFPCSafeToPrint ( const llvm::ConstantFP *  CFP)
static

Definition at line 1201 of file cbackend.cpp.

References ftostr().

static bool isFPIntBitCast ( const llvm::Instruction &  I)
inlinestatic

Definition at line 3274 of file cbackend.cpp.

static bool isSupportedIntegerSize ( llvm::IntegerType &  T)
static

Definition at line 3984 of file cbackend.cpp.

static const char* lGetTypedFunc ( const char *  base,
llvm::Type *  matchType,
int  width 
)
static

Construct the name of a function with the given base and returning a vector of a given type, of the specified idth. For example, if base is "foo" and matchType is i32 and width is 16, this will return the string "__foo_i32<__vec16_i32>".

Definition at line 1351 of file cbackend.cpp.

static bool lIsAllTrue ( llvm::Value *  v)
static

Returns true if the given value is a compile-time constant vector of i1s with all elements 'true'.

Definition at line 5272 of file cbackend.cpp.

static const char* lPredicateToString ( llvm::CmpInst::Predicate  p)
static

Definition at line 3716 of file cbackend.cpp.

static const char* lTypeToSuffix ( llvm::Type *  t)
static

Definition at line 3750 of file cbackend.cpp.

References Assert.

static void PrintEscapedString ( const char *  Str,
unsigned  Length,
llvm::raw_ostream &  Out 
)
static

Definition at line 2354 of file cbackend.cpp.

Referenced by PrintEscapedString().

static void PrintEscapedString ( const std::string &  Str,
llvm::raw_ostream &  Out 
)
static

Definition at line 2373 of file cbackend.cpp.

References PrintEscapedString().

static void printLimitValue ( llvm::IntegerType &  Ty,
bool  isSigned,
bool  isMax,
llvm::raw_ostream &  Out 
)
static

Definition at line 3958 of file cbackend.cpp.

bool WriteCXXFile ( llvm::Module *  module,
const char *  fn,
int  vectorWidth,
const char *  includeName 
)

Definition at line 5373 of file cbackend.cpp.

Referenced by Module::writeOutput().