[PATCH] C API: Add LLVMSetTargetMachineShowMCEncoding()

Juergen Ributzka juergen at apple.com
Fri Dec 19 09:09:05 PST 2014


There are several other options in MCTargetOptions. Maybe we should create a more generic method for setting all those options instead of adding a separate function for each option?

typedef enum {
  LLVMSanitizeAddress = 1,
…
} LLVMMCOption;

int LLVMSetTargetMachineMCOption(LLVMTargetMachineRef T,  LLVMMCOptions O, unsigned V)

This way we can easily add new options in the future and deprecate old ones by using a different return code.

—Juergen

> On Dec 19, 2014, at 7:43 AM, Tom Stellard <tom at stellard.net> wrote:
> 
> Ping.
> 
> On Fri, Sep 26, 2014 at 11:51:16AM -0700, Tom Stellard wrote:
>> Hi,
>> 
>> The attached patch adds LLVMSetTargetMachineShowMCEncoding() to the C API.
>> 
>> Please Review.
>> 
>> Thanks,
>> Tom
> 
>> From 3968722de1329a61418fbbe779f846c3f57f7139 Mon Sep 17 00:00:00 2001
>> From: Tom Stellard <thomas.stellard at amd.com>
>> Date: Fri, 26 Sep 2014 11:44:57 -0700
>> Subject: [PATCH 2/2] C API: Add LLVMSetTargetMachineShowMCEncoding()
>> 
>> ---
>> include/llvm-c/TargetMachine.h | 4 ++++
>> lib/Target/TargetMachineC.cpp  | 5 +++++
>> 2 files changed, 9 insertions(+)
>> 
>> diff --git a/include/llvm-c/TargetMachine.h b/include/llvm-c/TargetMachine.h
>> index d4993e7..ed7c4e5 100644
>> --- a/include/llvm-c/TargetMachine.h
>> +++ b/include/llvm-c/TargetMachine.h
>> @@ -122,6 +122,10 @@ LLVMTargetDataRef LLVMGetTargetMachineData(LLVMTargetMachineRef T);
>> void LLVMSetTargetMachineAsmVerbosity(LLVMTargetMachineRef T,
>>                                       LLVMBool VerboseAsm);
>> 
>> +/** Set the target machine's ShowMCEncoding option. */
>> +void LLVMSetTargetMachineShowMCEncoding(LLVMTargetMachineRef T,
>> +                                        LLVMBool ShowMCEncoding);
>> +
>> /** Emits an asm or object file for the given module to the filename. This
>>   wraps several c++ only classes (among them a file stream). Returns any
>>   error in ErrorMessage. Use LLVMDisposeMessage to dispose the message. */
>> diff --git a/lib/Target/TargetMachineC.cpp b/lib/Target/TargetMachineC.cpp
>> index b3e07df..0d0c1b7 100644
>> --- a/lib/Target/TargetMachineC.cpp
>> +++ b/lib/Target/TargetMachineC.cpp
>> @@ -181,6 +181,11 @@ void LLVMSetTargetMachineAsmVerbosity(LLVMTargetMachineRef T,
>>   unwrap(T)->setAsmVerbosityDefault(VerboseAsm);
>> }
>> 
>> +void LLVMSetTargetMachineShowMCEncoding(LLVMTargetMachineRef T,
>> +                                        LLVMBool ShowMCEncoding) {
>> +  unwrap(T)->Options.MCOptions.ShowMCEncoding = ShowMCEncoding;
>> +}
>> +
>> static LLVMBool LLVMTargetMachineEmit(LLVMTargetMachineRef T, LLVMModuleRef M,
>>   formatted_raw_ostream &OS, LLVMCodeGenFileType codegen, char **ErrorMessage) {
>>   TargetMachine* TM = unwrap(T);
>> -- 
>> 1.8.3.1
>> 
> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list