summaryrefslogtreecommitdiffstats
path: root/lld/include/lld/ReaderWriter/CoreTargetInfo.h
blob: 907456bc54d804dc65ddf3dfc3804786d88ae539 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//===- lld/ReaderWriter/CoreTargetInfo.h ---------------------------------===//
//
//                             The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLD_READER_WRITER_CORE_TARGET_INFO_H
#define LLD_READER_WRITER_CORE_TARGET_INFO_H

#include "lld/Core/TargetInfo.h"
#include "lld/ReaderWriter/Reader.h"
#include "lld/ReaderWriter/Writer.h"

#include "llvm/Support/ErrorHandling.h"

namespace lld {

class CoreTargetInfo : public TargetInfo {
public:
  CoreTargetInfo(); 

  virtual bool validate(raw_ostream &diagnostics) {
    return false;
  }
   
  virtual void addPasses(PassManager &pm) const;
  virtual ErrorOr<Reference::Kind>    relocKindFromString(StringRef str) const;
  virtual ErrorOr<std::string> stringFromRelocKind(Reference::Kind kind) const;

  virtual error_code
  parseFile(std::unique_ptr<MemoryBuffer> mb,
            std::vector<std::unique_ptr<File>> &result) const;

  void addPassNamed(StringRef name) {
    _passNames.push_back(name);
  }

protected:
  virtual Writer &writer() const;

private:
  mutable std::unique_ptr<Reader>   _reader;
  mutable std::unique_ptr<Writer>   _writer;
  std::vector<StringRef>            _passNames;
};

} // end namespace lld

#endif
OpenPOWER on IntegriCloud