LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
XCoreTargetTransformInfo.cpp
Go to the documentation of this file.
1 //===-- XCoreTargetTransformInfo.cpp - XCore specific TTI pass ----------------===//
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 /// \file
10 /// This file implements a TargetTransformInfo analysis pass specific to the
11 /// XCore target machine. It uses the target's detailed information to provide
12 /// more precise answers to certain TTI queries, while letting the target
13 /// independent and default TTI implementations handle the rest.
14 ///
15 //===----------------------------------------------------------------------===//
16 
17 #define DEBUG_TYPE "xcoretti"
18 #include "XCore.h"
20 #include "llvm/Support/Debug.h"
22 #include "llvm/Target/CostTable.h"
23 using namespace llvm;
24 
25 // Declare the pass initialization routine locally as target-specific passes
26 // don't havve a target-wide initialization entry point, and so we rely on the
27 // pass constructor initialization.
28 namespace llvm {
30 }
31 
32 namespace {
33 
34 class XCoreTTI : public ImmutablePass, public TargetTransformInfo {
35 public:
36  XCoreTTI() : ImmutablePass(ID) {
37  llvm_unreachable("This pass cannot be directly constructed");
38  }
39 
40  XCoreTTI(const XCoreTargetMachine *TM)
41  : ImmutablePass(ID) {
43  }
44 
45  virtual void initializePass() {
46  pushTTIStack(this);
47  }
48 
49  virtual void finalizePass() {
50  popTTIStack();
51  }
52 
53  virtual void getAnalysisUsage(AnalysisUsage &AU) const {
55  }
56 
57  static char ID;
58 
59  virtual void *getAdjustedAnalysisPointer(const void *ID) {
60  if (ID == &TargetTransformInfo::ID)
61  return (TargetTransformInfo*)this;
62  return this;
63  }
64 
65  unsigned getNumberOfRegisters(bool Vector) const {
66  if (Vector) {
67  return 0;
68  }
69  return 12;
70  }
71 };
72 
73 } // end anonymous namespace
74 
75 INITIALIZE_AG_PASS(XCoreTTI, TargetTransformInfo, "xcoretti",
76  "XCore Target Transform Info", true, true, false)
77 char XCoreTTI::ID = 0;
78 
79 
82  return new XCoreTTI(TM);
83 }
static PassRegistry * getPassRegistry()
Cost tables and simple lookup functions.
#define llvm_unreachable(msg)
ID
LLVM Calling Convention Representation.
Definition: CallingConv.h:26
void initializeXCoreTTIPass(PassRegistry &)
static char ID
Analysis group identification.
#define INITIALIZE_AG_PASS(passName, agName, arg, name, cfg, analysis, def)
Definition: PassSupport.h:268
ImmutablePass * createXCoreTargetTransformInfoPass(const XCoreTargetMachine *TM)
virtual void getAnalysisUsage(AnalysisUsage &AU) const
All pass subclasses must call TargetTransformInfo::getAnalysisUsage.