ac/llvm: create features list using snprintf.
authorDave Airlie <airlied@redhat.com>
Thu, 6 Jul 2017 02:00:02 +0000 (03:00 +0100)
committerDave Airlie <airlied@redhat.com>
Thu, 6 Jul 2017 22:06:04 +0000 (23:06 +0100)
Just more moving code around before adding things to it.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/common/ac_llvm_util.c

index 088f01f7ad6ccd58516d07295032ae057f51703d..4f32d4bb974122dec160da13008a596270cb76e8 100644 (file)
@@ -121,14 +121,17 @@ static const char *ac_get_llvm_processor_name(enum radeon_family family)
 LLVMTargetMachineRef ac_create_target_machine(enum radeon_family family, enum ac_target_machine_options tm_options)
 {
        assert(family >= CHIP_TAHITI);
-
+       char features[256];
        const char *triple = (tm_options & AC_TM_SUPPORTS_SPILL) ? "amdgcn-mesa-mesa3d" : "amdgcn--";
        LLVMTargetRef target = ac_get_llvm_target(triple);
+
+       snprintf(features, sizeof(features),
+                "+DumpCode,+vgpr-spilling,-fp32-denormals,-xnack");
        LLVMTargetMachineRef tm = LLVMCreateTargetMachine(
                                     target,
                                     triple,
                                     ac_get_llvm_processor_name(family),
-                                    "+DumpCode,+vgpr-spilling,-fp32-denormals,-xnack",
+                                    features,
                                     LLVMCodeGenLevelDefault,
                                     LLVMRelocDefault,
                                     LLVMCodeModelDefault);