Skip to content

Commit 7f8b05c

Browse files
committed
[CHERIoT] Remove dead tiny code model.
1 parent 545c1ae commit 7f8b05c

File tree

2 files changed

+57
-68
lines changed

2 files changed

+57
-68
lines changed

llvm/lib/Target/RISCV/RISCVTargetMachine.cpp

+1-11
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,6 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
126126
return RM.value_or(Reloc::Static);
127127
}
128128

129-
static CodeModel::Model getEffectiveCodeModel(std::optional<CodeModel::Model> CM,
130-
CodeModel::Model Default,
131-
const TargetOptions &Options) {
132-
if ((Options.MCOptions.ABIName == "cheriot") && CM.has_value() &&
133-
(*CM == CodeModel::Tiny))
134-
return *CM;
135-
return getEffectiveCodeModel(CM, Default);
136-
}
137-
138129
RISCVTargetMachine::RISCVTargetMachine(const Target &T, const Triple &TT,
139130
StringRef CPU, StringRef FS,
140131
const TargetOptions &Options,
@@ -143,8 +134,7 @@ RISCVTargetMachine::RISCVTargetMachine(const Target &T, const Triple &TT,
143134
CodeGenOpt::Level OL, bool JIT)
144135
: LLVMTargetMachine(T, computeDataLayout(TT, FS, Options), TT, CPU, FS,
145136
Options, getEffectiveRelocModel(TT, RM),
146-
::getEffectiveCodeModel(CM, CodeModel::Small, Options),
147-
OL),
137+
getEffectiveCodeModel(CM, CodeModel::Small), OL),
148138
TLOF(std::make_unique<RISCVELFTargetObjectFile>()) {
149139
initAsmInfo();
150140

llvm/test/CodeGen/RISCV/cheri/cheri-mcu-ccall.ll

+56-57
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2-
; RUN: llc --filetype=asm --code-model=tiny --mcpu=cheriot --mtriple=riscv32-unknown-unknown -target-abi cheriot %s -mattr=+xcheri,+cap-mode -o - | FileCheck %s -check-prefixes BOTH
3-
; RUN: llc --filetype=asm --code-model=small --mcpu=cheriot --mtriple=riscv32-unknown-unknown -target-abi cheriot %s -mattr=+xcheri,+cap-mode -o - | FileCheck %s -check-prefixes BOTH
2+
; RUN: llc --filetype=asm --code-model=small --mcpu=cheriot --mtriple=riscv32-unknown-unknown -target-abi cheriot %s -mattr=+xcheri,+cap-mode -o - | FileCheck %s
43
; ModuleID = 'ccall.c'
54
source_filename = "ccall.c"
65
target datalayout = "e-m:e-pf200:64:64:64:32-p:32:32-i64:64-n32-S128-A200-P200-G200"
@@ -12,10 +11,10 @@ target triple = "riscv32-unknown-unknown"
1211
; Function Attrs: minsize mustprogress nofree norecurse nosync nounwind optsize readnone willreturn
1312
define dso_local chericcallcce i32 @test2(i32 %a0, i32 %a1) local_unnamed_addr addrspace(200) #0 {
1413
; Check that we have the first two arguments in the right registers.
15-
; BOTH-LABEL: test2:
16-
; BOTH: # %bb.0: # %entry
17-
; BOTH: add a0, a0, a1
18-
; BOTH: cret
14+
; CHECK-LABEL: test2:
15+
; CHECK: # %bb.0: # %entry
16+
; CHECK: add a0, a0, a1
17+
; CHECK: cret
1918
entry:
2019
%add = add nsw i32 %a1, %a0
2120
ret i32 %add
@@ -24,8 +23,8 @@ entry:
2423
; Function Attrs: minsize mustprogress nofree norecurse nosync nounwind optsize readonly willreturn
2524
define dso_local chericcallcce i32 @test6(i32 addrspace(200)* nocapture readonly %a0, i32 addrspace(200)* nocapture readonly %a1, i32 addrspace(200)* nocapture readonly %a2, i32 addrspace(200)* nocapture readonly %a3, i32 addrspace(200)* nocapture readonly %a4, i32 addrspace(200)* nocapture readonly %a5) local_unnamed_addr addrspace(200) #1 {
2625
; Check that we are loading the last register argument
27-
; BOTH-LABEL: test6:
28-
; BOTH: clw a5, 0(ca5)
26+
; CHECK-LABEL: test6:
27+
; CHECK: clw a5, 0(ca5)
2928
entry:
3029
%0 = load i32, i32 addrspace(200)* %a0, align 4, !tbaa !5
3130
%1 = load i32, i32 addrspace(200)* %a1, align 4, !tbaa !5
@@ -45,11 +44,11 @@ entry:
4544
define dso_local chericcallcce i32 @test8(i32 addrspace(200)* nocapture readonly %a0, i32 addrspace(200)* nocapture readonly %a1, i32 addrspace(200)* nocapture readonly %a2, i32 addrspace(200)* nocapture readonly %a3, i32 addrspace(200)* nocapture readonly %a4, i32 addrspace(200)* nocapture readonly %a5, i32 addrspace(200)* nocapture readonly %a6, i32 addrspace(200)* nocapture readonly %a7) local_unnamed_addr addrspace(200) #1 {
4645
; Check that the last argument (used in the multiply) is loaded from offset 8
4746
; in the stack-argument capability.
48-
; BOTH-LABEL: test8:
49-
; BOTH: clc [[CREG:[a-z]+[0-9]+]], 8(ct0)
50-
; BOTH: clw [[IREG:[a-z]+[0-9]+]], 0([[CREG]])
51-
; BOTH: mul
52-
; BOTH-SAME: [[IREG]]
47+
; CHECK-LABEL: test8:
48+
; CHECK: clc [[CREG:[a-z]+[0-9]+]], 8(ct0)
49+
; CHECK: clw [[IREG:[a-z]+[0-9]+]], 0([[CREG]])
50+
; CHECK: mul
51+
; CHECK-SAME: [[IREG]]
5352
entry:
5453
%0 = load i32, i32 addrspace(200)* %a0, align 4, !tbaa !5
5554
%1 = load i32, i32 addrspace(200)* %a1, align 4, !tbaa !5
@@ -82,16 +81,16 @@ declare void @llvm.lifetime.end.p200i8(i64 immarg, i8 addrspace(200)* nocapture)
8281
define dso_local i32 @testcall8() local_unnamed_addr addrspace(200) #2 {
8382
entry:
8483
; Check that we have the right relocations and stack layout.
85-
; BOTH-LABEL: testcall8:
86-
; BOTH: auicgp ct0, %cheriot_compartment_hi(testcall8.stack_arg)
87-
; BOTH: cincoffset ct0, ct0, %cheriot_compartment_lo_i
88-
; BOTH: csetbounds ct0, ct0, %cheriot_compartment_size(testcall8.stack_arg)
89-
; BOTH: csc ct0, 8(csp)
90-
; BOTH: auipcc ct1, %cheriot_compartment_hi(__import_other_test8callee)
91-
; BOTH: clc ct1, %cheriot_compartment_lo_i
92-
; BOTH: auipcc ct2, %cheriot_compartment_hi(.compartment_switcher)
93-
; BOTH: clc ct2, %cheriot_compartment_lo_i
94-
; BOTH: cjalr ct2
84+
; CHECK-LABEL: testcall8:
85+
; CHECK: auicgp ct0, %cheriot_compartment_hi(testcall8.stack_arg)
86+
; CHECK: cincoffset ct0, ct0, %cheriot_compartment_lo_i
87+
; CHECK: csetbounds ct0, ct0, %cheriot_compartment_size(testcall8.stack_arg)
88+
; CHECK: csc ct0, 8(csp)
89+
; CHECK: auipcc ct1, %cheriot_compartment_hi(__import_other_test8callee)
90+
; CHECK: clc ct1, %cheriot_compartment_lo_i
91+
; CHECK: auipcc ct2, %cheriot_compartment_hi(.compartment_switcher)
92+
; CHECK: clc ct2, %cheriot_compartment_lo_i
93+
; CHECK: cjalr ct2
9594
%args = alloca [8 x i32], align 4, addrspace(200)
9695
%0 = bitcast [8 x i32] addrspace(200)* %args to i8 addrspace(200)*
9796
call void @llvm.lifetime.start.p200i8(i64 32, i8 addrspace(200)* nonnull %0) #5
@@ -133,39 +132,39 @@ attributes #6 = { minsize nounwind optsize }
133132

134133
; Check that we have the right import and export tables.
135134

136-
; BOTH: .section .compartment_exports,"aR",@progbits
137-
; BOTH: .type __export_example_test2,@object
138-
; BOTH: .globl __export_example_test2
139-
; BOTH: .p2align 2
140-
; BOTH:__export_example_test2:
141-
; BOTH: .half test2-__compartment_pcc_start
142-
; BOTH: .byte 0
143-
; BOTH: .byte 2
144-
; BOTH: .size __export_example_test2, 4
145-
; BOTH: .type __export_example_test6,@object
146-
; BOTH: .globl __export_example_test6
147-
; BOTH: .p2align 2
148-
; BOTH:__export_example_test6:
149-
; BOTH: .half test6-__compartment_pcc_start
150-
; BOTH: .byte 0
151-
; BOTH: .byte 6
152-
; BOTH: .size __export_example_test6, 4
153-
; BOTH: .type __export_example_test8,@object
154-
; BOTH: .globl __export_example_test8
155-
; BOTH: .p2align 2
156-
; BOTH:__export_example_test8:
157-
; BOTH: .half test8-__compartment_pcc_start
158-
; BOTH: .byte 0
159-
; BOTH: .byte 7
160-
; BOTH: .size __export_example_test8, 4
161-
; BOTH: .section .compartment_imports,"aG",@progbits,__import_other_test8callee,comdat
162-
; BOTH: .type __import_other_test8callee,@object
163-
; BOTH: .weak __import_other_test8callee
164-
; BOTH: .p2align 3
165-
; BOTH:__import_other_test8callee:
166-
; BOTH: .word __export_other_test8callee
135+
; CHECK: .section .compartment_exports,"aR",@progbits
136+
; CHECK: .type __export_example_test2,@object
137+
; CHECK: .globl __export_example_test2
138+
; CHECK: .p2align 2
139+
; CHECK:__export_example_test2:
140+
; CHECK: .half test2-__compartment_pcc_start
141+
; CHECK: .byte 0
142+
; CHECK: .byte 2
143+
; CHECK: .size __export_example_test2, 4
144+
; CHECK: .type __export_example_test6,@object
145+
; CHECK: .globl __export_example_test6
146+
; CHECK: .p2align 2
147+
; CHECK:__export_example_test6:
148+
; CHECK: .half test6-__compartment_pcc_start
149+
; CHECK: .byte 0
150+
; CHECK: .byte 6
151+
; CHECK: .size __export_example_test6, 4
152+
; CHECK: .type __export_example_test8,@object
153+
; CHECK: .globl __export_example_test8
154+
; CHECK: .p2align 2
155+
; CHECK:__export_example_test8:
156+
; CHECK: .half test8-__compartment_pcc_start
157+
; CHECK: .byte 0
158+
; CHECK: .byte 7
159+
; CHECK: .size __export_example_test8, 4
160+
; CHECK: .section .compartment_imports,"aG",@progbits,__import_other_test8callee,comdat
161+
; CHECK: .type __import_other_test8callee,@object
162+
; CHECK: .weak __import_other_test8callee
163+
; CHECK: .p2align 3
164+
; CHECK:__import_other_test8callee:
165+
; CHECK: .word __export_other_test8callee
167166
; This is not a libcall, so it shouldn't have any add to set low bits in this
168167
; pointer.
169-
; BOTH-NOT: +
170-
; BOTH: .word 0
171-
; BOTH: .size __import_other_test8callee, 8
168+
; CHECK-NOT: +
169+
; CHECK: .word 0
170+
; CHECK: .size __import_other_test8callee, 8

0 commit comments

Comments
 (0)