Silence -Wunused-variable in release builds.
[llvm/stm8.git] / utils / TableGen / PseudoLoweringEmitter.h
blob2749280e6a9d34dbb61ecb39f3d08049f667dea4
1 //===- PseudoLoweringEmitter.h - PseudoLowering Generator -------*- 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 //===----------------------------------------------------------------------===//
10 #ifndef PSEUDOLOWERINGEMITTER_H
11 #define PSEUDOLOWERINGEMITTER_H
13 #include "CodeGenInstruction.h"
14 #include "CodeGenTarget.h"
15 #include "TableGenBackend.h"
16 #include "llvm/ADT/IndexedMap.h"
17 #include "llvm/ADT/SmallVector.h"
19 namespace llvm {
21 class PseudoLoweringEmitter : public TableGenBackend {
22 struct OpData {
23 enum MapKind { Operand, Imm, Reg };
24 MapKind Kind;
25 union {
26 unsigned Operand; // Operand number mapped to.
27 uint64_t Imm; // Integer immedate value.
28 Record *Reg; // Physical register.
29 } Data;
31 struct PseudoExpansion {
32 CodeGenInstruction Source; // The source pseudo instruction definition.
33 CodeGenInstruction Dest; // The destination instruction to lower to.
34 IndexedMap<OpData> OperandMap;
36 PseudoExpansion(CodeGenInstruction &s, CodeGenInstruction &d,
37 IndexedMap<OpData> &m) :
38 Source(s), Dest(d), OperandMap(m) {}
41 RecordKeeper &Records;
43 // It's overkill to have an instance of the full CodeGenTarget object,
44 // but it loads everything on demand, not in the constructor, so it's
45 // lightweight in performance, so it works out OK.
46 CodeGenTarget Target;
48 SmallVector<PseudoExpansion, 64> Expansions;
50 unsigned addDagOperandMapping(Record *Rec, DagInit *Dag,
51 CodeGenInstruction &Insn,
52 IndexedMap<OpData> &OperandMap,
53 unsigned BaseIdx);
54 void evaluateExpansion(Record *Pseudo);
55 void emitLoweringEmitter(raw_ostream &o);
56 public:
57 PseudoLoweringEmitter(RecordKeeper &R) : Records(R), Target(R) {}
59 /// run - Output the pseudo-lowerings.
60 void run(raw_ostream &o);
63 } // end llvm namespace
65 #endif