It turns out most of the thumb2 instructions are not allowed to touch SP. The semanti...
[llvm/avr.git] / lib / CodeGen / MachOCodeEmitter.h
blob96ba68f1dbf2747904f6b436f7416683d2f447c6
1 //===-- MachOEmitter.h - Target-independent Mach-O Emitter class ----------===//
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 //===----------------------------------------------------------------------===//
10 #ifndef MACHOCODEEMITTER_H
11 #define MACHOCODEEMITTER_H
13 #include "llvm/CodeGen/ObjectCodeEmitter.h"
14 #include <map>
16 namespace llvm {
18 class MachOWriter;
20 /// MachOCodeEmitter - This class is used by the MachOWriter to emit the code
21 /// for functions to the Mach-O file.
23 class MachOCodeEmitter : public ObjectCodeEmitter {
24 MachOWriter &MOW;
26 /// Target machine description.
27 TargetMachine &TM;
29 /// is64Bit/isLittleEndian - This information is inferred from the target
30 /// machine directly, indicating what header values and flags to set.
31 bool is64Bit, isLittleEndian;
33 const TargetAsmInfo *TAI;
35 /// Relocations - These are the relocations that the function needs, as
36 /// emitted.
37 std::vector<MachineRelocation> Relocations;
39 std::map<uint64_t, uintptr_t> Labels;
41 public:
42 MachOCodeEmitter(MachOWriter &mow, MachOSection &mos);
44 virtual void startFunction(MachineFunction &MF);
45 virtual bool finishFunction(MachineFunction &MF);
47 virtual void addRelocation(const MachineRelocation &MR) {
48 Relocations.push_back(MR);
51 void emitConstantPool(MachineConstantPool *MCP);
52 void emitJumpTables(MachineJumpTableInfo *MJTI);
54 virtual void emitLabel(uint64_t LabelID) {
55 Labels[LabelID] = getCurrentPCOffset();
58 virtual uintptr_t getLabelAddress(uint64_t Label) const {
59 return Labels.find(Label)->second;
62 virtual void setModuleInfo(llvm::MachineModuleInfo* MMI) { }
64 }; // end class MachOCodeEmitter
66 } // end namespace llvm
68 #endif