LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AArch64TargetMachine.cpp
Go to the documentation of this file.
1 //===-- AArch64TargetMachine.cpp - Define TargetMachine for AArch64 -------===//
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 contains the implementation of the AArch64TargetMachine
11 // methods. Principally just setting up the passes needed to generate correct
12 // code on this architecture.
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #include "AArch64.h"
17 #include "AArch64TargetMachine.h"
19 #include "llvm/PassManager.h"
20 #include "llvm/CodeGen/Passes.h"
22 
23 using namespace llvm;
24 
25 extern "C" void LLVMInitializeAArch64Target() {
27 }
28 
30  StringRef CPU, StringRef FS,
31  const TargetOptions &Options,
34  : LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL),
35  Subtarget(TT, CPU, FS),
36  InstrInfo(Subtarget),
37  DL("e-p:64:64-i64:64:64-i128:128:128-s0:32:32-f128:128:128-n32:64-S128"),
38  TLInfo(*this),
39  TSInfo(*this),
40  FrameLowering(Subtarget) {
41  initAsmInfo();
42 }
43 
44 namespace {
45 /// AArch64 Code Generator Pass Configuration Options.
46 class AArch64PassConfig : public TargetPassConfig {
47 public:
48  AArch64PassConfig(AArch64TargetMachine *TM, PassManagerBase &PM)
49  : TargetPassConfig(TM, PM) {}
50 
51  AArch64TargetMachine &getAArch64TargetMachine() const {
52  return getTM<AArch64TargetMachine>();
53  }
54 
55  const AArch64Subtarget &getAArch64Subtarget() const {
56  return *getAArch64TargetMachine().getSubtargetImpl();
57  }
58 
59  virtual bool addInstSelector();
60  virtual bool addPreEmitPass();
61 };
62 } // namespace
63 
65  return new AArch64PassConfig(this, PM);
66 }
67 
68 bool AArch64PassConfig::addPreEmitPass() {
69  addPass(&UnpackMachineBundlesID);
71  return true;
72 }
73 
74 bool AArch64PassConfig::addInstSelector() {
75  addPass(createAArch64ISelDAG(getAArch64TargetMachine(), getOptLevel()));
76 
77  // For ELF, cleanup any local-dynamic TLS accesses.
78  if (getAArch64Subtarget().isTargetELF() && getOptLevel() != CodeGenOpt::None)
80 
81  return false;
82 }
FunctionPass * createAArch64BranchFixupPass()
Returns an instance of the branch fixup pass.
void LLVMInitializeAArch64Target()
char & UnpackMachineBundlesID
UnpackMachineBundles - This pass unpack machine instruction bundles.
AArch64TargetMachine(const Target &T, StringRef TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL)
FunctionPass * createAArch64ISelDAG(AArch64TargetMachine &TM, CodeGenOpt::Level OptLevel)
Target TheAArch64Target
TargetPassConfig * createPassConfig(PassManagerBase &PM)
static RegisterPass< NVPTXAllocaHoisting > X("alloca-hoisting","Hoisting alloca instructions in non-entry ""blocks to the entry block")
FunctionPass * createAArch64CleanupLocalDynamicTLSPass()