mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-25 10:27:04 +00:00
Extend C disassembler API to allow specifying target features
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218682 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -33,10 +33,11 @@ using namespace llvm;
|
||||
// functions can all be passed as NULL. If successful, this returns a
|
||||
// disassembler context. If not, it returns NULL.
|
||||
//
|
||||
LLVMDisasmContextRef LLVMCreateDisasmCPU(const char *Triple, const char *CPU,
|
||||
void *DisInfo, int TagType,
|
||||
LLVMOpInfoCallback GetOpInfo,
|
||||
LLVMSymbolLookupCallback SymbolLookUp){
|
||||
LLVMDisasmContextRef
|
||||
LLVMCreateDisasmCPUFeatures(const char *Triple, const char *CPU,
|
||||
const char *Features, void *DisInfo, int TagType,
|
||||
LLVMOpInfoCallback GetOpInfo,
|
||||
LLVMSymbolLookupCallback SymbolLookUp) {
|
||||
// Get the target.
|
||||
std::string Error;
|
||||
const Target *TheTarget = TargetRegistry::lookupTarget(Triple, Error);
|
||||
@@ -56,11 +57,8 @@ LLVMDisasmContextRef LLVMCreateDisasmCPU(const char *Triple, const char *CPU,
|
||||
if (!MII)
|
||||
return nullptr;
|
||||
|
||||
// Package up features to be passed to target/subtarget
|
||||
std::string FeaturesStr;
|
||||
|
||||
const MCSubtargetInfo *STI = TheTarget->createMCSubtargetInfo(Triple, CPU,
|
||||
FeaturesStr);
|
||||
Features);
|
||||
if (!STI)
|
||||
return nullptr;
|
||||
|
||||
@@ -101,11 +99,19 @@ LLVMDisasmContextRef LLVMCreateDisasmCPU(const char *Triple, const char *CPU,
|
||||
return DC;
|
||||
}
|
||||
|
||||
LLVMDisasmContextRef LLVMCreateDisasmCPU(const char *Triple, const char *CPU,
|
||||
void *DisInfo, int TagType,
|
||||
LLVMOpInfoCallback GetOpInfo,
|
||||
LLVMSymbolLookupCallback SymbolLookUp){
|
||||
return LLVMCreateDisasmCPUFeatures(Triple, CPU, "", DisInfo, TagType,
|
||||
GetOpInfo, SymbolLookUp);
|
||||
}
|
||||
|
||||
LLVMDisasmContextRef LLVMCreateDisasm(const char *Triple, void *DisInfo,
|
||||
int TagType, LLVMOpInfoCallback GetOpInfo,
|
||||
LLVMSymbolLookupCallback SymbolLookUp) {
|
||||
return LLVMCreateDisasmCPU(Triple, "", DisInfo, TagType, GetOpInfo,
|
||||
SymbolLookUp);
|
||||
return LLVMCreateDisasmCPUFeatures(Triple, "", "", DisInfo, TagType,
|
||||
GetOpInfo, SymbolLookUp);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user