[Mesa-dev] [PATCH 10/10] swr: [rasterizer codegen] Fix windows build
Tim Rowley
timothy.o.rowley at intel.com
Sat Mar 25 12:01:02 UTC 2017
From: George Kyriazis <george.kyriazis at intel.com>
Fix codegen build break that was introduced earlier.
---
src/gallium/drivers/swr/Makefile.am | 4 +--
src/gallium/drivers/swr/SConscript | 7 ++---
.../drivers/swr/rasterizer/codegen/gen_backends.py | 30 ++++++++++++++--------
.../swr/rasterizer/codegen/gen_llvm_ir_macros.py | 20 +++++++--------
4 files changed, 35 insertions(+), 26 deletions(-)
diff --git a/src/gallium/drivers/swr/Makefile.am b/src/gallium/drivers/swr/Makefile.am
index 3a0d8da..4602145 100644
--- a/src/gallium/drivers/swr/Makefile.am
+++ b/src/gallium/drivers/swr/Makefile.am
@@ -99,14 +99,14 @@ rasterizer/jitter/gen_builder.hpp: rasterizer/codegen/gen_llvm_ir_macros.py rast
$(PYTHON_GEN) \
$(srcdir)/rasterizer/codegen/gen_llvm_ir_macros.py \
--input $(LLVM_INCLUDEDIR)/llvm/IR/IRBuilder.h \
- --output rasterizer/jitter \
+ --output $@ \
--gen_h
rasterizer/jitter/gen_builder_x86.hpp: rasterizer/codegen/gen_llvm_ir_macros.py rasterizer/codegen/templates/gen_builder.hpp rasterizer/codegen/gen_common.py
$(MKDIR_GEN)
$(PYTHON_GEN) \
$(srcdir)/rasterizer/codegen/gen_llvm_ir_macros.py \
- --output rasterizer/jitter \
+ --output $@ \
--gen_x86_h
rasterizer/archrast/gen_ar_event.hpp: rasterizer/codegen/gen_archrast.py rasterizer/codegen/templates/gen_ar_event.hpp rasterizer/archrast/events.proto rasterizer/codegen/gen_common.py
diff --git a/src/gallium/drivers/swr/SConscript b/src/gallium/drivers/swr/SConscript
index ad16162..c37bc01 100644
--- a/src/gallium/drivers/swr/SConscript
+++ b/src/gallium/drivers/swr/SConscript
@@ -73,14 +73,14 @@ env.CodeGenerate(
target = 'rasterizer/jitter/gen_builder.hpp',
script = swrroot + 'rasterizer/codegen/gen_llvm_ir_macros.py',
source = os.path.join(llvm_includedir, 'llvm/IR/IRBuilder.h'),
- command = python_cmd + ' $SCRIPT --input $SOURCE --output rasterizer/jitter --gen_h'
+ command = python_cmd + ' $SCRIPT --input $SOURCE --output $TARGET --gen_h'
)
env.CodeGenerate(
target = 'rasterizer/jitter/gen_builder_x86.hpp',
script = swrroot + 'rasterizer/codegen/gen_llvm_ir_macros.py',
source = '',
- command = python_cmd + ' $SCRIPT --output rasterizer/jitter --gen_x86_h'
+ command = python_cmd + ' $SCRIPT --output $TARGET --gen_x86_h'
)
env.CodeGenerate(
@@ -127,7 +127,8 @@ env.CodeGenerate(
env.CodeGenerate(
target = 'rasterizer/core/gen_BackendPixelRate0.cpp',
script = swrroot + 'rasterizer/codegen/gen_backends.py',
- command = python_cmd + ' $SCRIPT --output rasterizer/core --dim 5 2 3 2 2 2 --split 0 --cpp'
+ source = swrroot + 'rasterizer/codegen/templates/gen_backend.cpp',
+ command = python_cmd + ' $SCRIPT --output $TARGET --template $SOURCE --dim 5 2 3 2 2 2 --split 0 --cpp'
)
# Auto-generated .cpp files (that need to generate object files)
diff --git a/src/gallium/drivers/swr/rasterizer/codegen/gen_backends.py b/src/gallium/drivers/swr/rasterizer/codegen/gen_backends.py
index 242ab7a..8f7ba94 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/gen_backends.py
+++ b/src/gallium/drivers/swr/rasterizer/codegen/gen_backends.py
@@ -34,7 +34,10 @@ def main(args=sys.argv[1:]):
parser = ArgumentParser("Generate files and initialization functions for all permutuations of BackendPixelRate.")
parser.add_argument('--dim', help="gBackendPixelRateTable array dimensions", nargs='+', type=int, required=True)
parser.add_argument('--outdir', help="output directory", nargs='?', type=str, default=thisDir)
+ parser.add_argument('--output', help="output filename", nargs='?', type=str)
+ parser.add_argument('--template', help="input template", nargs='?', type=str)
parser.add_argument('--split', help="how many lines of initialization per file [0=no split]", nargs='?', type=int, default='512')
+ parser.add_argument('--index', help="file to output", nargs='?', type=int, default=0)
parser.add_argument('--cpp', help="Generate cpp file(s)", action='store_true', default=False)
parser.add_argument('--cmake', help="Generate cmake file", action='store_true', default=False)
@@ -72,18 +75,25 @@ def main(args=sys.argv[1:]):
# generate .cpp files
if args.cpp:
- baseCppName = os.path.join(args.outdir, 'gen_BackendPixelRate%s.cpp')
- templateCpp = os.path.join(thisDir, 'templates', 'gen_backend.cpp')
-
- for fileNum in range(numFiles):
- filename = baseCppName % str(fileNum)
- #print('Generating', filename)
+ if not args.output:
+ baseCppName = os.path.join(args.outdir, 'gen_BackendPixelRate%s.cpp')
+ templateCpp = os.path.join(thisDir, 'templates', 'gen_backend.cpp')
+
+ for fileNum in range(numFiles):
+ MakoTemplateWriter.to_file(
+ templateCpp,
+ baseCppName % str(fileNum),
+ cmdline=sys.argv,
+ fileNum=fileNum,
+ funcList=chunkedList[fileNum])
+
+ else:
MakoTemplateWriter.to_file(
- templateCpp,
- baseCppName % str(fileNum),
+ args.template,
+ args.output,
cmdline=sys.argv,
- fileNum=fileNum,
- funcList=chunkedList[fileNum])
+ fileNum=args.index,
+ funcList=chunkedList[args.index])
# generate gen_backend.cmake file
if args.cmake:
diff --git a/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py b/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py
index dbf5647..4cd9b6f 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py
+++ b/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py
@@ -178,9 +178,8 @@ def parse_ir_builder(input_file):
'''
Auto-generates macros for LLVM IR
'''
-def generate_gen_h(functions, output_dir):
- filename = 'gen_builder.hpp'
- output_filename = os.path.join(output_dir, filename)
+def generate_gen_h(functions, output):
+ output_filename = output
templfuncs = []
for func in functions:
@@ -197,16 +196,15 @@ def generate_gen_h(functions, output_dir):
output_filename,
cmdline=sys.argv,
comment='Builder IR Wrappers',
- filename=filename,
+ filename=os.path.basename(output_filename),
functions=templfuncs,
isX86=False)
'''
Auto-generates macros for LLVM IR
'''
-def generate_x86_h(output_dir):
- filename = 'gen_builder_x86.hpp'
- output_filename = os.path.join(output_dir, filename)
+def generate_x86_h(output):
+ output_filename = output
functions = []
for inst in intrinsics:
@@ -224,7 +222,7 @@ def generate_x86_h(output_dir):
output_filename,
cmdline=sys.argv,
comment='x86 intrinsics',
- filename=filename,
+ filename=os.path.basename(output_filename),
functions=functions,
isX86=True)
@@ -238,13 +236,13 @@ def main():
# Parse args...
parser = ArgumentParser()
parser.add_argument('--input', '-i', type=FileType('r'), help='Path to IRBuilder.h', required=False)
- parser.add_argument('--output-dir', '-o', action='store', dest='output', help='Path to output directory', required=True)
+ parser.add_argument('--output', '-o', action='store', dest='output', help='Output filename', required=True)
parser.add_argument('--gen_h', help='Generate builder_gen.h', action='store_true', default=False)
parser.add_argument('--gen_x86_h', help='Generate x86 intrinsics. No input is needed.', action='store_true', default=False)
args = parser.parse_args()
- if not os.path.exists(args.output):
- os.makedirs(args.output)
+ if not os.path.exists(os.path.dirname(args.output)):
+ os.makedirs(os.path.dirname(args.output))
if args.input:
functions = parse_ir_builder(args.input)
--
2.7.4
More information about the mesa-dev
mailing list