Skip to content

Commit

Permalink
[DPWBS-1211] Adding legalization and test case for G_VASTART.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidferencszabo authored and konstantinschwarz committed Feb 25, 2020
1 parent 0d030cf commit b49e9e3
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
5 changes: 5 additions & 0 deletions llvm/lib/Target/TriCore/TriCoreLegalizerInfo.cpp
Expand Up @@ -422,6 +422,11 @@ TriCoreLegalizerInfo::TriCoreLegalizerInfo(const TriCoreSubtarget &ST) {
// G_BRINDIRECT is valid for p0 types.
getActionDefinitionsBuilder(G_BRINDIRECT).legalFor({p0});

// Variadic Arguments

// G_VASTART is legal for pointer type
getActionDefinitionsBuilder(G_VASTART).legalFor({p0});

computeTables();
verify(*ST.getInstrInfo());
}
Expand Down
33 changes: 33 additions & 0 deletions llvm/test/CodeGen/TriCore/GlobalIsel/legalize-vastart.mir
@@ -0,0 +1,33 @@
# RUN: llc -O0 -mtriple=tricore -global-isel -run-pass=legalizer \
# RUN: -verify-machineinstrs %s -o - | FileCheck %s

--- |
define dso_local void @vastart_test(i32 %n, ...) {
entry:
%vl = alloca i8*, align 4
%vl1 = bitcast i8** %vl to i8*
call void @llvm.va_start(i8* %vl1)
ret void
}

declare void @llvm.va_start(i8*)
...
---
name: vastart_test
legalized: false
stack:
- { id: 0, name: vl, type: default, offset: 0, size: 4, alignment: 4 }
body: |
bb.0:
liveins: $d4
; CHECK-LABEL: name: vastart_test
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $d4
; CHECK: [[FI:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.0.vl
; CHECK: G_VASTART [[FI]](p0) :: (store 4 into %ir.vl1, align 1)
; CHECK: RET implicit $a11
%0:_(s32) = COPY $d4
%1:_(p0) = G_FRAME_INDEX %stack.0.vl
G_VASTART %1(p0) :: (store 4 into %ir.vl1, align 1)
RET implicit $a11
...

0 comments on commit b49e9e3

Please sign in to comment.