Skip to content

Commit 7c28d7d

Browse files
author
Pavel Samolysov
committed
Extract the SPIR_GENERIC_AS constant
1 parent 302ec49 commit 7c28d7d

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//===---- SPIR.h - Declare SPIR and SPIR-V target interfaces ----*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#pragma once
10+
11+
namespace clang {
12+
namespace targets {
13+
14+
// Used by both the SPIR and SPIR-V targets. Code of the generic address space
15+
// for the target
16+
constexpr unsigned SPIR_GENERIC_AS = 4u;
17+
18+
} // namespace targets
19+
} // namespace clang

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "clang/Basic/Diagnostic.h"
1212
#include "clang/Basic/LangOptions.h"
1313
#include "clang/Basic/TargetOptions.h"
14+
#include "clang/Basic/Targets/SPIR.h"
1415
#include "clang/Frontend/FrontendDiagnostic.h"
1516
#include "clang/Frontend/Utils.h"
1617
#include "clang/Lex/HeaderSearchOptions.h"
@@ -1072,7 +1073,7 @@ void EmitAssemblyHelper::EmitAssemblyWithLegacyPassManager(
10721073
if (TargetTriple.isSPIR() || TargetTriple.isSPIRV()) {
10731074
// This function pass should run after inlining, so it is added to MPM
10741075
PerModulePasses.add(
1075-
createInferAddressSpacesPass((4))); // TODO make/use the constant
1076+
createInferAddressSpacesPass(targets::SPIR_GENERIC_AS));
10761077
}
10771078
}
10781079

0 commit comments

Comments
 (0)