Home | History | Annotate | Download | only in AArch64
      1 //==-- AArch64TargetMachine.h - Define TargetMachine for AArch64 -*- 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 declares the AArch64 specific subclass of TargetMachine.
     11 //
     12 //===----------------------------------------------------------------------===//
     13 
     14 #ifndef LLVM_LIB_TARGET_AARCH64_AARCH64TARGETMACHINE_H
     15 #define LLVM_LIB_TARGET_AARCH64_AARCH64TARGETMACHINE_H
     16 
     17 #include "AArch64InstrInfo.h"
     18 #include "AArch64Subtarget.h"
     19 #include "llvm/IR/DataLayout.h"
     20 #include "llvm/Target/TargetMachine.h"
     21 
     22 namespace llvm {
     23 
     24 class AArch64TargetMachine : public LLVMTargetMachine {
     25 protected:
     26   std::unique_ptr<TargetLoweringObjectFile> TLOF;
     27   mutable StringMap<std::unique_ptr<AArch64Subtarget>> SubtargetMap;
     28 
     29 public:
     30   AArch64TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
     31                        StringRef FS, const TargetOptions &Options,
     32                        Optional<Reloc::Model> RM, CodeModel::Model CM,
     33                        CodeGenOpt::Level OL, bool IsLittleEndian);
     34 
     35   ~AArch64TargetMachine() override;
     36   const AArch64Subtarget *getSubtargetImpl(const Function &F) const override;
     37 
     38   // Pass Pipeline Configuration
     39   TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
     40 
     41   /// \brief Get the TargetIRAnalysis for this target.
     42   TargetIRAnalysis getTargetIRAnalysis() override;
     43 
     44   TargetLoweringObjectFile* getObjFileLowering() const override {
     45     return TLOF.get();
     46   }
     47 
     48 private:
     49   AArch64Subtarget Subtarget;
     50 };
     51 
     52 // AArch64 little endian target machine.
     53 //
     54 class AArch64leTargetMachine : public AArch64TargetMachine {
     55   virtual void anchor();
     56 public:
     57   AArch64leTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
     58                          StringRef FS, const TargetOptions &Options,
     59                          Optional<Reloc::Model> RM, CodeModel::Model CM,
     60                          CodeGenOpt::Level OL);
     61 };
     62 
     63 // AArch64 big endian target machine.
     64 //
     65 class AArch64beTargetMachine : public AArch64TargetMachine {
     66   virtual void anchor();
     67 public:
     68   AArch64beTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
     69                          StringRef FS, const TargetOptions &Options,
     70                          Optional<Reloc::Model> RM, CodeModel::Model CM,
     71                          CodeGenOpt::Level OL);
     72 };
     73 
     74 } // end namespace llvm
     75 
     76 #endif
     77