mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-23 17:28:54 +00:00
Add Position-independent Code model Module API.
Summary: This makes PIC levels a Module flag attribute, which can be queried by the backend. The flag is named `PIC Level`, and can have a value of: 0 - Backend-default 1 - Small-model (-fpic) 2 - Large-model (-fPIC) These match the `-pic-level' command line argument for clang, and the value of the preprocessor macro `__PIC__'. Test Plan: New flags tests specific for the 'PIC Level' module flag. Tests to be added as part of a future commit for PowerPC, which will use this new API. Reviewers: rafael, echristo Reviewed By: rafael, echristo Subscribers: rafael, llvm-commits Differential Revision: http://reviews.llvm.org/D5882 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221510 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -459,3 +459,16 @@ Comdat *Module::getOrInsertComdat(StringRef Name) {
|
||||
Entry.second.Name = &Entry;
|
||||
return &Entry.second;
|
||||
}
|
||||
|
||||
PICLevel::Level Module::getPICLevel() const {
|
||||
Value *Val = getModuleFlag("PIC Level");
|
||||
|
||||
if (Val == NULL)
|
||||
return PICLevel::Default;
|
||||
|
||||
return static_cast<PICLevel::Level>(cast<ConstantInt>(Val)->getZExtValue());
|
||||
}
|
||||
|
||||
void Module::setPICLevel(PICLevel::Level PL) {
|
||||
addModuleFlag(ModFlagBehavior::Error, "PIC Level", PL);
|
||||
}
|
||||
|
Reference in New Issue
Block a user