blob: 27b94f0092a6acc6563b23db553b90dd8483d858 [file] [log] [blame]
Shih-wei Liaoe4454322010-04-07 12:21:42 -07001###########################################################
2## Commands for running tblgen to compile a td file
3##########################################################
4define transform-td-to-out
5$(if $(LOCAL_IS_HOST_MODULE), \
6 $(call transform-host-td-to-out,$(1)), \
7 $(call transform-device-td-to-out,$(1)))
8endef
9
10###########################################################
11## TableGen: Compile .td files to .inc.
12###########################################################
13ifeq ($(LOCAL_MODULE_CLASS),)
14 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
15endif
16
17ifneq ($(strip $(TBLGEN_TABLES)),)
18
19intermediates := $(call local-intermediates-dir)
20tblgen_gen_tables := $(addprefix $(intermediates)/,$(TBLGEN_TABLES))
21LOCAL_GENERATED_SOURCES += $(tblgen_gen_tables)
22
23tblgen_source_dir := $(LOCAL_PATH)
24ifneq ($(TBLGEN_TD_DIR),)
25tblgen_source_dir := $(TBLGEN_TD_DIR)
26endif
27
28ifneq ($(filter %GenRegisterNames.inc,$(tblgen_gen_tables)),)
29$(intermediates)/%GenRegisterNames.inc: $(tblgen_source_dir)/%.td $(TBLGEN)
30 $(call transform-td-to-out,register-enums)
31endif
32
33ifneq ($(filter %GenRegisterInfo.h.inc,$(tblgen_gen_tables)),)
34$(intermediates)/%GenRegisterInfo.h.inc: $(tblgen_source_dir)/%.td $(TBLGEN)
35 $(call transform-td-to-out,register-desc-header)
36endif
37
38ifneq ($(filter %GenRegisterInfo.inc,$(tblgen_gen_tables)),)
39$(intermediates)/%GenRegisterInfo.inc: $(tblgen_source_dir)/%.td $(TBLGEN)
40 $(call transform-td-to-out,register-desc)
41endif
42
43ifneq ($(filter %GenInstrNames.inc,$(tblgen_gen_tables)),)
44$(intermediates)/%GenInstrNames.inc: $(tblgen_source_dir)/%.td $(TBLGEN)
45 $(call transform-td-to-out,instr-enums)
46endif
47
48ifneq ($(filter %GenInstrInfo.inc,$(tblgen_gen_tables)),)
49$(intermediates)/%GenInstrInfo.inc: $(tblgen_source_dir)/%.td $(TBLGEN)
50 $(call transform-td-to-out,instr-desc)
51endif
52
53ifneq ($(filter %GenAsmWriter.inc,$(tblgen_gen_tables)),)
54$(intermediates)/%GenAsmWriter.inc: $(tblgen_source_dir)/%.td $(TBLGEN)
55 $(call transform-td-to-out,asm-writer)
56endif
57
58ifneq ($(filter %GenAsmWriter1.inc,$(tblgen_gen_tables)),)
59$(intermediates)/%GenAsmWriter1.inc: $(tblgen_source_dir)/%.td $(TBLGEN)
60 $(call transform-td-to-out,asm-writer -asmwriternum=1)
61endif
62
63ifneq ($(filter %GenAsmMatcher.inc,$(tblgen_gen_tables)),)
64$(intermediates)/%GenAsmMatcher.inc: $(tblgen_source_dir)/%.td $(TBLGEN)
65 $(call transform-td-to-out,asm-matcher)
66endif
67
68ifneq ($(filter %GenCodeEmitter.inc,$(tblgen_gen_tables)),)
69$(intermediates)/%GenCodeEmitter.inc: $(tblgen_source_dir)/%.td $(TBLGEN)
70 $(call transform-td-to-out,emitter)
71endif
72
Logan Chien2e5a5ee2011-10-21 14:45:53 +080073ifneq ($(filter %GenMCCodeEmitter.inc,$(tblgen_gen_tables)),)
74$(intermediates)/%GenMCCodeEmitter.inc: $(tblgen_source_dir)/%.td $(TBLGEN)
75 $(call transform-td-to-out,emitter -mc-emitter)
76endif
77
78ifneq ($(filter %GenMCPseudoLowering.inc,$(tblgen_gen_tables)),)
79$(intermediates)/%GenMCPseudoLowering.inc: $(tblgen_source_dir)/%.td $(TBLGEN)
80 $(call transform-td-to-out,pseudo-lowering)
81endif
82
Shih-wei Liaoe4454322010-04-07 12:21:42 -070083ifneq ($(filter %GenDAGISel.inc,$(tblgen_gen_tables)),)
84$(intermediates)/%GenDAGISel.inc: $(tblgen_source_dir)/%.td $(TBLGEN)
85 $(call transform-td-to-out,dag-isel)
86endif
87
88ifneq ($(filter %GenDisassemblerTables.inc,$(tblgen_gen_tables)),)
89$(intermediates)/%GenDisassemblerTables.inc: $(tblgen_source_dir)/%.td $(TBLGEN)
90 $(call transform-td-to-out,disassembler)
91endif
92
93ifneq ($(filter %GenEDInfo.inc,$(tblgen_gen_tables)),)
94$(intermediates)/%GenEDInfo.inc: $(tblgen_source_dir)/%.td $(TBLGEN)
95 $(call transform-td-to-out,enhanced-disassembly-info)
96endif
97
98ifneq ($(filter %GenFastISel.inc,$(tblgen_gen_tables)),)
99$(intermediates)/%GenFastISel.inc: $(tblgen_source_dir)/%.td $(TBLGEN)
100 $(call transform-td-to-out,fast-isel)
101endif
102
Logan Chien2e5a5ee2011-10-21 14:45:53 +0800103ifneq ($(filter %GenSubtargetInfo.inc,$(tblgen_gen_tables)),)
104$(intermediates)/%GenSubtargetInfo.inc: $(tblgen_source_dir)/%.td $(TBLGEN)
Shih-wei Liaoe4454322010-04-07 12:21:42 -0700105 $(call transform-td-to-out,subtarget)
106endif
107
108ifneq ($(filter %GenCallingConv.inc,$(tblgen_gen_tables)),)
109$(intermediates)/%GenCallingConv.inc: $(tblgen_source_dir)/%.td $(TBLGEN)
110 $(call transform-td-to-out,callingconv)
111endif
112
113ifneq ($(filter %GenIntrinsics.inc,$(tblgen_gen_tables)),)
114$(intermediates)/%GenIntrinsics.inc: $(tblgen_source_dir)/%.td $(TBLGEN)
115 $(call transform-td-to-out,tgt_intrinsics)
116endif
117
Shih-wei Liaoa59a85f2010-04-29 00:24:07 -0700118ifneq ($(findstring ARMGenDecoderTables.inc,$(tblgen_gen_tables)),)
119$(intermediates)/ARMGenDecoderTables.inc: $(tblgen_source_dir)/ARM.td $(TBLGEN)
120 $(call transform-td-to-out,arm-decoder)
121endif
122
Shih-wei Liaoe4454322010-04-07 12:21:42 -0700123endif