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:
Justin Hibbits
2014-11-07 04:46:10 +00:00
parent 75da31ff15
commit 893f22f882
7 changed files with 50 additions and 0 deletions

View File

@ -23,6 +23,7 @@
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Metadata.h"
#include "llvm/Support/CBindingWrapping.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/DataTypes.h"
#include <system_error>
@ -634,6 +635,15 @@ public:
unsigned getDwarfVersion() const;
/// @}
/// @name Utility functions for querying and setting PIC level
/// @{
/// \brief Returns the PIC level (small or large model)
PICLevel::Level getPICLevel() const;
/// \brief Set the PIC level (small or large model)
void setPICLevel(PICLevel::Level PL);
/// @}
};
/// An raw_ostream inserter for modules.