Skip to content

Commit 4f2a637

Browse files
authored
lcb: Set types for branch lowering (#522)
1 parent 5f80457 commit 4f2a637

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

vadl/main/resources/templates/lcb/llvm/lib/Target/ISelLowering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ void [(${namespace})]TargetLowering::anchor() {}
6060

6161
[#th:block th:if="${mergedCmpAndBranch}"]
6262
setOperationAction(ISD::BRCOND, MVT::Other, Expand);
63-
setOperationAction(ISD::BR_CC, MVT::[(${stackPointerType})], Custom);
64-
setOperationAction(ISD::SELECT_CC, MVT::[(${stackPointerType})], Custom);
63+
setOperationAction(ISD::BR_CC, { [(${branchTypes})] }, Custom);
64+
setOperationAction(ISD::SELECT_CC, { [(${branchTypes})] }, Custom);
6565
setOperationAction(ISD::SETCC, MVT::[(${stackPointerType})], Expand);
6666
[/th:block]
6767
[#th:block th:if="${!mergedCmpAndBranch}"]

vadl/main/vadl/lcb/template/lib/Target/EmitISelLoweringCppFilePass.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ protected Map<String, Object> createVariables(final PassResults passResults,
134134
map.put("conditionalValueRangeLowest", conditionalValueRange.lowest());
135135
map.put("conditionalValueRangeHighest", conditionalValueRange.highest());
136136
map.put("expandableDagNodes", coverageSummary.notCoveredSelectionDagNodes());
137+
map.put("branchTypes", branchTypes(stackPointerType));
137138
map.put("mergedCmpAndBranch",
138139
!database.run(
139140
new Query.Builder().machineInstructionLabels(List.of(
@@ -185,6 +186,14 @@ protected Map<String, Object> createVariables(final PassResults passResults,
185186
return map;
186187
}
187188

189+
private String branchTypes(ValueType stackPointerType) {
190+
if (stackPointerType == ValueType.I64) {
191+
return "MVT::i32, MVT::i64";
192+
} else {
193+
return "MVT::i32";
194+
}
195+
}
196+
188197
private String getFirstNameOrEmpty(QueryResult result) {
189198
return result.machineInstructions().stream().map(x -> x.identifier().simpleName()).findFirst()
190199
.orElse("");

0 commit comments

Comments
 (0)